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回收高水位线
路径分享:http://bzwzjz.com/article/jcjsoe.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 高端网站设计 手机网站建设套餐 成都网站建设公司 网站建设 网站制作公司 泸州网站建设 成都网站制作 手机网站制作设计 手机网站建设 企业网站设计 成都网站建设 成都响应式网站建设公司 上市集团网站建设 成都营销网站建设 成都网站制作 成都响应式网站建设 定制网站建设 成都网站设计 成都网站建设 重庆电商网站建设 成都网站建设 品牌网站建设