统计数据库每天的数据增长量的脚本
論壇上一個統計數據庫數據增長的腳本,雖然沒測試過,大家評價很好,應該不錯,收藏留著備用!其實EM里面統計表空間的增加百分比也能查看。
set linesize 1000?
set pagesize 100?
select t.*
? from (SELECT D.TABLESPACE_NAME,
?????????????? SPACE "SUM_SPACE(M)",
?????????????? BLOCKS SUM_BLOCKS,
?????????????? SPACE - NVL(FREE_SPACE, 0) "USED_SPACE(M)",
?????????????? ROUND((1 - NVL(FREE_SPACE, 0) / SPACE) * 100, 2) "USED_RATE(%)",
?????????????? FREE_SPACE "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 "SUM_SPACE(M)",
?????????????? BLOCKS SUM_BLOCKS,
?????????????? USED_SPACE "USED_SPACE(M)",
?????????????? ROUND(NVL(USED_SPACE, 0) / SPACE * 100, 2) "USED_RATE(%)",
?????????????? SPACE - USED_SPACE "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,
?????????????????????? ROUND(SUM(BLOCKS * 8192) / (1024 * 1024), 2) USED_SPACE
????????????????? FROM V$SORT_USAGE
???????????????? GROUP BY TABLESPACE) F
???????? WHERE D.TABLESPACE_NAME = F.TABLESPACE(+)) t
order by "USED_RATE(%)" desc;
總結
以上是生活随笔為你收集整理的统计数据库每天的数据增长量的脚本的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle删除数据文件
- 下一篇: 使用SecureCRT录制自动脚本