SM$TS_USED,SM$TS_FREE,SM$TS_AVAIL

路途中的人2012發表於2016-03-16
SM$TS_USED,SM$TS_FREE,SM$TS_AVAIL,這三個在Oracle官方文件的reference上找不到相關解釋。其實三者都是檢視,從DBA_VIEWS中可以得到相關資訊。

點選(此處)摺疊或開啟

  1. SYS@ORCL> desc SM$TS_USED
  2.  Name                                 Null? Type
  3.  ----------------------------------------------------------------- -------- --------------------------------------------
  4.  TABLESPACE_NAME                             VARCHAR2(30)
  5.  BYTES                                     NUMBER

  6. SYS@ORCL> desc SM$TS_FREE
  7.  Name                                 Null? Type
  8.  ----------------------------------------------------------------- -------- --------------------------------------------
  9.  TABLESPACE_NAME                             VARCHAR2(30)
  10.  BYTES                                     NUMBER

  11. SYS@ORCL> desc SM$TS_AVAIL
  12.  Name                                 Null? Type
  13.  ----------------------------------------------------------------- -------- --------------------------------------------
  14.  TABLESPACE_NAME                             VARCHAR2(30)
  15.  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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29067253/viewspace-2058489/,如需轉載,請註明出處,否則將追究法律責任。

相關文章