1. 程式人生 > >ORACLE 查詢表空間使用情況

ORACLE 查詢表空間使用情況

SELECT a.tablespace_name ,--表空間
Round(a.bytes/(1024*1024*1024),3),-- 大小G
    Round(b.bytes/(1024*1024*1024)),  --已使用G
Round(c.bytes/(1024*1024*1024)) ,--剩餘G
Round(b.bytes*100/a.bytes,3),    --使用百分比%
Round(c.bytes*100/a.bytes,3)     --剩餘百分比%
    FROM sys.Sm$ts_Avail a, sys.Sm$ts_Used b,sys.sm$ts_free c 
    WHERE a.tablespace_name=b.tablespace_name AND a.tablespace_name=c.tablespace_name;

1.查詢表空間使用情況
select a.segment_name, sum(a.BYTES) / 1024 / 1024 / 1024
from dba_segments a
 where owner='AML' and a.tablespace_name = 'TSIND01'
 group by a.segment_name
 order by sum(a.BYTES) / 1024 / 1024 / 1024;

2.
select * from user_cons_columns;

select * from dba_tablespace_usage_metrics where tablespace_name = 'TSIND01';

3.查看回收站
 select * from user_recyclebin;

4.清空回收站
purge recyclebin;//清空使用者回收站
purge index ;//清空索引回收站
purge table ;//清空表回收站
purge recyclebin;//清空所有使用者的回收站