一、查詢表空間
--1、檢視表空間的名字及檔案所在位置
select tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space from sys.dba_data_files order by tablespace_name
--2、查詢表空間資訊
select username,default_tablespace,t.* from dba_users t
--3、查詢當前表空間下使用情況
select a.tablespace_name, a.bytes / 1024 / 1024 "sum mb", (a.bytes - b.bytes) / 1024 / 1024 "used mb", b.bytes / 1024 / 1024 "free mb", round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "used%" from (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name, sum(bytes) bytes, max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name = b.tablespace_name order by ((a.bytes - b.bytes) / a.bytes) desc;
二:新增表空間
三、釋放表空間
1、刪除過期使用者
drop user colin cascade;
2、查詢過期使用者相關的表空間是否還有物件
select owner, segment_name, segment_type, tablespace_name
from dba_segments
where tablespace_name in
(select tablespace_name
from dba_tablespaces
where tablespace_name like '%colin%')
3、轉移過期使用者表空間上的物件到其他表空間
alter table tab_colin move tablespace colin_song_tbs;
alter index idx_tab_colin rebuild tablespace colin_song_idx_tbs;
4、查詢無物件的表空間
select 'drop tablespace ' || tablespace_name ||
' including contents and datafiles;'
from dba_tablespaces
where not exists (select 12
from dba_segments
where dba_segments.tablespace_name =
dba_tablespaces.tablespace_name);
5、刪除之 把上述查詢出來的語句貼到文字編輯裡檢查下(ps:這裡會包含乙個temp的臨時表空間一定要去掉啊)
sql> drop tablespace stat_ftfy_chrgstay_dtbs including contents and datafiles;
tablespace dropped
sql> drop tablespace stat_ftfy_chrgnew_wixtbs including contents and datafiles;
tablespace dropped
sql> drop tablespace stat_ftfy_chrgsmr_mixtbs including contents and datafiles;
tablespace dropped
好文要頂
關注我
Oracle 刪除表中記錄 如何釋放表及表空間大小
1.檢視乙個表所佔的空間大小 select bytes 1024 1024 mb table size u.from user segments u where u.segment name jk test 2.檢視乙個表空間所佔的實際大小 select sum bytes 1024 1024 mb...
Oracle 刪除表中記錄 如何釋放表及表空間大小
1.檢視乙個表所佔的空間大小 select bytes 1024 1024 mb table size u.from user segments u where u.segment name jk test 2.檢視乙個表空間所佔的實際大小 select sum bytes 1024 1024 mb...
Oracle 釋放表及表空間大小
1.檢視乙個表所佔的空間大小 select bytes 1024 1024 mb table size u.from user segments u where u.segment name jk test 2.檢視乙個表空間所佔的實際大小 select sum bytes 1024 1024 mb...