oracle回收高水位線(xiàn)

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='用戶(hù)名') b;


通過(guò)dba_tables里的blocks字段和有數(shù)據(jù)的字段做對(duì)比,在用1減,求出沒(méi)有數(shù)據(jù)的塊的百分比(一般超過(guò)20%就需要回收了)從而判定是否需要回收高水位線(xiàn)


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');


高水位線(xiàn)已經(jīng)下降了

名稱(chēng)欄目:oracle回收高水位線(xiàn)
文章出自:http://muchs.cn/article4/jcjsoe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、手機(jī)網(wǎng)站建設(shè)用戶(hù)體驗(yàn)、虛擬主機(jī)、電子商務(wù)、建站公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作