select round((1-a.used/b.num_total)*100,0) percent from
(SELECT COUNT (DISTINCT SUBSTR(rowid,1,15)) Used FROM 表名) a,
(select blocks num_total from dba_tables where table_name='表名' and wner='用戶名') b;
通過dba_tables里的blocks字段和有數(shù)據(jù)的字段做對比,在用1減,求出沒有數(shù)據(jù)的塊的百分比(一般超過20%就需要回收了)從而判定是否需要回收高水位線
SQL> alter table test_shrik enable row movement ;
SQL> alter table test_shrik shrink space ;
SQL> select t.table_name,BLOCKS,EMPTY_BLOCKS,NUM_ROWS
from user_tables t
where table_name = upper('test_shrik');
exec dbms_stats.gather_table_stats('sys','test_shrik');
SQL> select t.table_name,BLOCKS,EMPTY_BLOCKS,NUM_ROWS
from user_tables t
where table_name = upper('test_shrik');
高水位線已經(jīng)下降了
分享標(biāo)題:oracle回收高水位線
轉(zhuǎn)載注明:
http://weahome.cn/article/jcjsoe.html