跟老牛学一招oracle
作者: oldwain(http://oldwain.itpub.net)发表于: 2008.01.04 18:32
分类: Oracle
出处: http://oldwain.itpub.net/post/6/449417
---------------------------------------------------------------
刚刚从老牛那里, 学了一招:
查询表空间的使用量、剩余量:
select * from sm$ts_used;select * from sm$ts_free;
比起用其它的视图写长长的一段脚本, 简便多了。
两个视图的定义:
SQL>select text from dba_views where view_name = 'SM$TS_FREE';TEXT
--------------------------------------------------------------------------------
select tablespace_name, sum(bytes) bytes from dba_free_space
group by tablespace_name
SQL>select text from dba_views where view_name = 'SM$TS_USED';
TEXT
--------------------------------------------------------------------------------
select tablespace_name, sum(bytes) bytes from dba_segments
group by tablespace_name
据说从7.x到11g都可以用。
(需要引用, 请注明出处: http://oldwain.itpub.net)




