SM$TS_USED,SM$TS_FREE,SM$TS_AVAIL,这三个在Oracle官方文档的reference上找不到相关解释。其实三者都是视图,从DBA_VIEWS中可以得到相关信息。
- SYS@ORCL> desc SM$TS_USED
- Name Null? Type
- ----------------------------------------------------------------- -------- --------------------------------------------
- TABLESPACE_NAME VARCHAR2(30)
- BYTES NUMBER
-
- SYS@ORCL> desc SM$TS_FREE
- Name Null? Type
- ----------------------------------------------------------------- -------- --------------------------------------------
- TABLESPACE_NAME VARCHAR2(30)
- BYTES NUMBER
-
- SYS@ORCL> desc SM$TS_AVAIL
- Name Null? Type
- ----------------------------------------------------------------- -------- --------------------------------------------
- TABLESPACE_NAME VARCHAR2(30)
- BYTES NUMBER
SYS@ORCL> select view_name,text_length,text from dba_views where view_name='SM$TS_USED';
VIEW_NAME TEXT_LENGTH
------------------------------ -----------
TEXT
--------------------------------------------------------------------------------
SM$TS_USED 87
select tablespace_name, sum(bytes) bytes from dba_segments
group by tablespa(ce_name
)
意即该视图是上述查询中的text列所示SQL语句的等效视图,如下可证明该结论:
SYS@ORCL> select tablespace_name,sum(bytes) bytes from dba_segments
2 group by tablespace_name;
TABLESPACE_NAME BYTES
------------------------------ ----------
SYSAUX 561971200
UNDOTBS1 20971520
USERS 3211264
SYSTEM 793051136
EXAMPLE 324206592
SYS@ORCL> select * from sm$ts_used;
TABLESPACE_NAME BYTES
------------------------------ ----------
SYSAUX 561971200
UNDOTBS1 20971520
USERS 3211264
SYSTEM 793051136
EXAMPLE 324206592
剩下二者同上
SYS@ORCL> select view_name,text_length,text from dba_views where view_name='SM$TS_FREE';
VIEW_NAME TEXT_LENGTH
------------------------------ -----------
TEXT
--------------------------------------------------------------------------------
SM$TS_FREE 89
select tablespace_name, sum(bytes) bytes from dba_free_space
group by tables
SYS@ORCL> select view_name,text_length,text from dba_views where view_name='SM$TS_AVAIL';
VIEW_NAME TEXT_LENGTH
------------------------------ -----------
TEXT
--------------------------------------------------------------------------------
SM$TS_AVAIL 89
select tablespace_name, sum(bytes) bytes from dba_data_files
group by tables
by the way,
SM$TS_USED,SM$TS_FREE,SM$TS_AVAIL,个人觉得sm有可能是sum的简写,ts则是tablespaces的简写。
感谢ORA-600的提示:-)
@760