温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

oracle 回收高水位线

发布时间:2020-08-10 03:52:18 来源:ITPUB博客 阅读:108 作者:abin1703 栏目:关系型数据库
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');


高水位线已经下降了
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI