oracle回收高水位线

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字段和有数据的字段做对比,在用1减,求出没有数据的块的百分比(一般超过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');


高水位线已经下降了

名称栏目:oracle回收高水位线
文章出自:https://www.cdcxhl.com/article4/jcjsoe.html

成都网站建设公司_创新互联,为您提供外贸建站手机网站建设用户体验虚拟主机电子商务建站公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

外贸网站制作