usage.sql檢視檔案使用率
col TABLESPACE_NAME for a20
col USED_SPACE(M) for a20
col SUM_SPACE(M) for a20
col SUM_BLOCKS for 9999999999
col USED_RATE(%) for a20
col FREE_SPACE(M) for a20
SELECT D.TABLESPACE_NAME,
SPACE || 'M' "SUM_SPACE(M)",
BLOCKS "SUM_BLOCKS",
SPACE - NVL (FREE_SPACE, 0) || 'M' "USED_SPACE(M)",
ROUND ( (1 - NVL (FREE_SPACE, 0) / SPACE) * 100, 2) || '%'
"USED_RATE(%)",
FREE_SPACE || 'M' "FREE_SPACE(M)"
FROM ( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
SUM (BLOCKS) BLOCKS
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) D,
( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) FREE_SPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
UNION ALL --如果有臨時表空間
SELECT D.TABLESPACE_NAME,
SPACE || 'M' "SUM_SPACE(M)",
BLOCKS SUM_BLOCKS,
USED_SPACE || 'M' "USED_SPACE(M)",
ROUND (NVL (USED_SPACE, 0) / SPACE * 100, 2) || '%' "USED_RATE(%)",
NVL (FREE_SPACE, 0) || 'M' "FREE_SPACE(M)"
FROM ( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
SUM (BLOCKS) BLOCKS
FROM DBA_TEMP_FILES
GROUP BY TABLESPACE_NAME) D,
( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES_USED) / (1024 * 1024), 2) USED_SPACE,
ROUND (SUM (BYTES_FREE) / (1024 * 1024), 2) FREE_SPACE
FROM V$TEMP_SPACE_HEADER
GROUP BY TABLESPACE_NAME) F
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
ORDER BY 1;
col USED_SPACE(M) for a20
col SUM_SPACE(M) for a20
col SUM_BLOCKS for 9999999999
col USED_RATE(%) for a20
col FREE_SPACE(M) for a20
SELECT D.TABLESPACE_NAME,
SPACE || 'M' "SUM_SPACE(M)",
BLOCKS "SUM_BLOCKS",
SPACE - NVL (FREE_SPACE, 0) || 'M' "USED_SPACE(M)",
ROUND ( (1 - NVL (FREE_SPACE, 0) / SPACE) * 100, 2) || '%'
"USED_RATE(%)",
FREE_SPACE || 'M' "FREE_SPACE(M)"
FROM ( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
SUM (BLOCKS) BLOCKS
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) D,
( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) FREE_SPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
UNION ALL --如果有臨時表空間
SELECT D.TABLESPACE_NAME,
SPACE || 'M' "SUM_SPACE(M)",
BLOCKS SUM_BLOCKS,
USED_SPACE || 'M' "USED_SPACE(M)",
ROUND (NVL (USED_SPACE, 0) / SPACE * 100, 2) || '%' "USED_RATE(%)",
NVL (FREE_SPACE, 0) || 'M' "FREE_SPACE(M)"
FROM ( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
SUM (BLOCKS) BLOCKS
FROM DBA_TEMP_FILES
GROUP BY TABLESPACE_NAME) D,
( SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES_USED) / (1024 * 1024), 2) USED_SPACE,
ROUND (SUM (BYTES_FREE) / (1024 * 1024), 2) FREE_SPACE
FROM V$TEMP_SPACE_HEADER
GROUP BY TABLESPACE_NAME) F
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
ORDER BY 1;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-1264018/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 檢視檔案
- swap檔案檢視
- 檢視大檔案
- Linux檢視CPU使用率Linux
- Linux檢視檔案大小Linux
- git檢視檔案內容Git
- 檢視資料檔案大小
- 檢視ebs請求檔案
- 利用tkprof檢視trace檔案
- 檢視控制檔案內容
- 如何檢視EBS 檔案版本
- win10如何檢視heic檔案_win10怎麼檢視heic檔案Win10
- Linux 磁碟 使用率 檢視 處理Linux
- Linux中如何檢視CPU使用率?Linux
- MHT Viewer for Macmhtml檔案檢視器ViewMacACMHTML
- Django - 檢視層 - 生成CSV檔案Django
- Binwalk--多重檔案檢視利器
- 使用TKPROF檢視跟蹤檔案
- linux下檢視hosts檔案Linux
- Oracle檢視trace檔案步驟Oracle
- Git 檢視檔案的歷史Git
- linux檢視檔案型別Linux型別
- 檢視檔案系統型別型別
- 檢視BAM檔案頭部資訊
- 選擇性地檢視檔案的方法 head tail sed 檢視檔案部分內容 (轉)AI
- Oracle檢視錶空間大小和使用率Oracle
- linux命令 — lsof 檢視程式開啟那些檔案 或者 檢視檔案給那個程式使用Linux
- linux檢視埠是否已開啟和檢視檔案數Linux
- Windows怎麼檢視蘋果heic檔案Windows蘋果
- Linux 檢視系統檔案命令Linux
- laravel利用artisan建立view檢視檔案LaravelView
- linux 常用檢視埠,檔案大小Linux
- php手動載入檢視檔案PHP
- linux檢視檔案許可權Linux
- 檢視檔案內容的特殊方法
- linux perl 檢視檔案狀態Linux
- 檢視檔案被什麼程式使用
- 檢視Sql Server的log檔案大小SQLServer