溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

查詢DB表實(shí)際大小

發(fā)布時(shí)間:2020-02-27 15:53:00 來源:網(wǎng)絡(luò) 閱讀:686 作者:00_yatou 欄目:關(guān)系型數(shù)據(jù)庫

1.查詢DB表實(shí)際大小(保證clob/blob/nclob lob大字段)

 select round(sum(bytes/1024/1024/1024),2) ||'G' from dba_segments where owner='用戶' 
 and segment_name ='表' OR segment_name IN (select SEGMENT_NAME from dba_LOBS where TABLE_NAME='表' and owner='用戶');

如果不是dba用戶可以用user_segments & user_lobs 且不需要owner.


2. 查詢表里L(fēng)OB大字段

   select round(sum(b.BYTES/1024/1024),2) ||'M' from dba_lobs a, dba_segments b  
 where a.segment_name = b.segment_name  and a.owner = '用戶(大寫)' and a.table_name = '表(大寫)' ;


3.查詢表大小不帶LOB大字段

select round(sum(bytes/1024/1024/1024),2) ||'G' from user_segments where segment_name ='表';


4.表數(shù)據(jù)被刪除

a. 若表的數(shù)據(jù)被truncate,上述方法查到的數(shù)據(jù)會(huì)立即變化

b. 若表的數(shù)據(jù)被delete,則需要對表進(jìn)行收縮,上述查詢才會(huì)變化;

 alter table 表名 enable row movement;
 alter table 表名 shrink space;


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI