溫馨提示×

溫馨提示×

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

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

數(shù)據(jù)庫如何查看表空間的使用率

發(fā)布時間:2020-07-08 19:05:41 來源:網(wǎng)絡(luò) 閱讀:1360 作者:wq402229805 欄目:關(guān)系型數(shù)據(jù)庫

進入oracle數(shù)據(jù)庫中,輸入以下代碼即可
select total.tablespace_name,
round(total.MB, 2) as Total_MB,
round(total.MB - free.MB, 2) as Used_MB,
round((1 - free.MB / total.MB) 100, 2) || '%' as Used_Pct
from (select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_free_space
group by tablespace_name) free,
(select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_data_files
group by tablespace_name) total
where free.tablespace_name = total.tablespace_name;
數(shù)據(jù)庫如何查看表空間的使用率
SELECT a.tablespace_name, a.BYTES total, a.bytes - nvl(b.bytes, 0) free FROM (SELECT tablespace_name, SUM (bytes) bytes FROM dba_temp_files GROUP BY tablespace_name) a,(SELECT tablespace_name, SUM (bytes_cached) bytes FROM v$temp_extent_pool GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name(+)
數(shù)據(jù)庫如何查看表空間的使用率
SELECT temp_used.tablespace_name,total - used as "Free",total as "Total",round(nvl(total - used, 0)
100 / total, 3) "Free percent" FROM (SELECT tablespace_name, SUM(bytesused) / 1024 / 1024 used FROM GV$TEMP_SPACE_HEADER GROUP BY tablespace_name) temp_used,(SELECT tablespace_name, SUM(bytes) / 1024 / 1024 total FROM dba_temp_files GROUP BY tablespace_name) temp_total WHERE temp_used.tablespace_name = temp_total.tablespace_name;
數(shù)據(jù)庫如何查看表空間的使用率

那些語句待用臨時表空間
SELECT se.username,sid,serial#,sql_address,machine,program,tablespace,segtype,contents FROM v$session se, v$sort_usage su WHERE se.saddr = su.session_addr;

向AI問一下細節(jié)

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

AI