浏览 8248 次
锁定老帖子 主题:Oracle 查询表空间使用情况
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-04-02
最后修改:2009-04-02
通过查询dba_free_space表可以了解一个tablespace的空间使用情况。 SQL> select 2 tablespace_name, 3 count(*) as extends, 4 round(sum(bytes)/1024/1024, 2) as MB, 5 sum(blocks) as blocks 6 from dba_free_space group by tablespace_name; TABLESPACE EXTENDS MB BLOCKS ---------- ---------- ---------- ---------- UNDOTBS1 16 771.69 49388 SYSAUX 46 8.44 540 BLOBS 375 805.63 51560 USERS 645 67.69 4332 SYSTEM 1 4.75 304 INDX 1871 1071.56 68580 WCAUDIT 1 499.94 31996
SQL> select tablespace_name, sum(bytes)/1024/1024 as MB from dba_data_files group by tablespace_name; TABLESPACE MB ---------- ---------- SYSAUX 340 UNDOTBS1 805 BLOBS 1000 USERS 6984 SYSTEM 360 WCAUDIT 500 INDX 1500
3. 查询表空间使用率 SQL> select 2 total.tablespace_name, 3 round(total.MB,2) as Total_MB, 4 round(total.MB-free.MB, 2) as Used_MB, 5 round((1-free.MB/total.MB)*100, 2) as Used_Pct 6 from 7 (select tablespace_name, sum(bytes)/1024/1024 as MB from dba_free_space group by tablespace_name) free, 8 (select tablespace_name, sum(bytes)/1024/1024 as MB from dba_data_files group by tablespace_name) total 9 where 10 free.tablespace_name=total.tablespace_name; TABLESPACE TOTAL_MB USED_MB USED_PCT ---------- ---------- ---------- ---------- UNDOTBS1 805 33.31 4.14 SYSAUX 340 331.56 97.52 BLOBS 1000 194.38 19.44 USERS 6984 6916.31 99.03 SYSTEM 360 355.25 98.68 INDX 1500 428.44 28.56 WCAUDIT 500 .06 .01 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |