ORACLE 管理论泛,SQL 篇--表空間

查看表大小

有兩種含義的表大锌:一種是分配給一個(gè)表的物理空間數(shù)量,而不管空間是否被使用屁奏⊙矣埽可以這樣查詢獲得字節(jié)數(shù):

select segment_name, bytes

from user_segments

where segment_type = 'TABLE';

或者

Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name


另一種表實(shí)際使用的空間。這樣查詢:

analyze table AREAINFOcompute statistics;


select??TABLE_NAME,TABLESPACE_NAME, NUM_ROWS ,AVG_ROW_LEN,? NUM_ROWS*AVG_ROW_LEN??

from user_tables

where table_name = 'AREAINFO';

說明:

表名稱要大寫,紅色加粗部分勇边。


查看每個(gè)表空間的大小

Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group ByTablespace_Name


看數(shù)據(jù)庫(kù)有多少個(gè)tablespace

oracle@mmsg:~>sqlplus / as sysdba


SQL*Plus:Release11.1.0.7.0 - Production on星期四7月1 17:37:14 2010


Copyright(c) 1982, 2008, Oracle.? All rightsreserved.



連接到:

OracleDatabase11gEnterprise Edition Release11.1.0.7.0 -64bit Production

Withthe Partitioning, OLAP, Data Mining and Real Application Testing options


SQL>set wrap on

SQL>set linesize 700

SQL>select * from dba_tablespaces;


TABLESPACE_NAME?? ???????????????????????????????????????????BLOCK_SIZEINITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS?? MAX_SIZE PCT_INCREASE MIN_EXTLEN STATUS???????????????? CONTENTS?????????? LOGGING??????????? FORCE_ EXTENT_MANAGEMENT??? ALLOCATION_TYPE??? PLUGGE SEGMENT_SPAC DEF_TAB_COMPRESSRETENTION????????????????? BIGFILPREDICATE_EVAL ENCRYP COMPRESS_FOR

---------------------------------------------------------------------- -------------- ----------- ----------- ----------- ---------------------- ---------- ------------------ ------------------------------------ ------ -------------------- ------------------ ------------------ ---------------- ---------------------- ------ -------------------- ------------------------------------

SYSTEM??????????????????? ?????????????????????????????????????????8192????????? 65536?????????????????????? 1? 2147483645 2147483645?????????????????????? 65536 ONLINE???????????? PERMANENT????????? LOGGING??????????? NO???? LOCAL??????????????? SYSTEM???????????? NO???? MANUAL??DISABLED???????? NOT APPLY????????????? NO???? HOST?????????? NO

SYSAUX????????????????????????????????????????????????????????????8192????????? 65536?????????????????????? 1? 2147483645 2147483645?????????????????????? 65536 ONLINE???????????? PERMANENT?????????LOGGING??????????? NO???? LOCAL??????????????? SYSTEM???????????? NO???? AUTO????DISABLED???????? NOT APPLY????????????? NO???? HOST?????????? NO

UNDOTBS1??????????????????????????????????????????????????????????8192????????? 65536????????????? ?????????1?2147483645 2147483645?????????????????????? 65536 ONLINE???????????? UNDO?????????????? LOGGING??????????? NO???? LOCAL??????????????? SYSTEM???????????? NO???? MANUAL??DISABLED???????? NOGUARANTEE??????????? NO???? HOST?????????? NO

TEMP???? ??????????????????????????????????????????????????????????8192??????? 1048576???? 1048576?????????? 1???????????? 2147483645??????????????? 0??? 1048576 ONLINE???????????? TEMPORARY????????? NOLOGGING????????? NO????LOCAL??????????????? UNIFORM?????????? ?NO????MANUAL?? DISABLED???????? NOT APPLY????????????? NO???? HOST?????????? NO

USERS?????????????????????????????????????????????????????????????8192????????? 65536?????????????????????? 1? 2147483645 2147483645?????????????????????? 65536 ONLINE????? ???????PERMANENT????????? LOGGING??????????? NO???? LOCAL??????????????? SYSTEM???????????? NO???? AUTO????DISABLED???????? NOT APPLY????????????? NO???? HOST?????????? NO

MMSG??????????????????????????????????????????????????????????????8192????????? 65536?????????????????????? 1? 2147483645 2147483645?????????????????????? 65536 ONLINE???????????? PERMANENT????????? LOGGING??????????? NO???? LOCAL??????????????? SYSTEM???????????? NO???? AUTO????DISABLED???????? NOT APPLY????????????? NO???? HOST??????????NO

MMSG_TMP??????????????????????????????????????????????????????????8192??????? 1048576???? 1048576?????????? 1???????????? 2147483645??????????????? 0??? 1048576 ONLINE???????????? TEMPORARY????????? NOLOGGING????????? NO????LOCAL??????????????? UNIFORM??????????? NO???? MANUAL??DISABLED???????? NOT APPLY????????????? NO???? HOST?????????? NO


已選擇7行犹撒。


SQL>




如何查有多少個(gè)數(shù)據(jù)庫(kù)實(shí)例

SQL>select instance_number,instance_name,status fromv$instance;


INSTANCE_NUMBERINSTANCE_NAME??? STATUS

------------------------------- ------------

????????????? 1 mmsgdb?????????? OPEN


SQL>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市粒褒,隨后出現(xiàn)的幾起案子识颊,更是在濱河造成了極大的恐慌,老刑警劉巖奕坟,帶你破解...
    沈念sama閱讀 211,348評(píng)論 6 491
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件祥款,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡月杉,警方通過查閱死者的電腦和手機(jī)刃跛,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,122評(píng)論 2 385
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來苛萎,“玉大人桨昙,你說我怎么就攤上這事∈仔福” “怎么了绊率?”我有些...
    開封第一講書人閱讀 156,936評(píng)論 0 347
  • 文/不壞的土叔 我叫張陵谨敛,是天一觀的道長(zhǎng)究履。 經(jīng)常有香客問我,道長(zhǎng)脸狸,這世上最難降的妖魔是什么最仑? 我笑而不...
    開封第一講書人閱讀 56,427評(píng)論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮炊甲,結(jié)果婚禮上泥彤,老公的妹妹穿的比我還像新娘。我一直安慰自己卿啡,他們只是感情好吟吝,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,467評(píng)論 6 385
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著颈娜,像睡著了一般剑逃。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上官辽,一...
    開封第一講書人閱讀 49,785評(píng)論 1 290
  • 那天蛹磺,我揣著相機(jī)與錄音,去河邊找鬼同仆。 笑死萤捆,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播俗或,決...
    沈念sama閱讀 38,931評(píng)論 3 406
  • 文/蒼蘭香墨 我猛地睜開眼市怎,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來了辛慰?” 一聲冷哼從身側(cè)響起焰轻,我...
    開封第一講書人閱讀 37,696評(píng)論 0 266
  • 序言:老撾萬榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎昆雀,沒想到半個(gè)月后辱志,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,141評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡狞膘,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,483評(píng)論 2 327
  • 正文 我和宋清朗相戀三年揩懒,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片挽封。...
    茶點(diǎn)故事閱讀 38,625評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡已球,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出辅愿,到底是詐尸還是另有隱情智亮,我是刑警寧澤,帶...
    沈念sama閱讀 34,291評(píng)論 4 329
  • 正文 年R本政府宣布点待,位于F島的核電站阔蛉,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏癞埠。R本人自食惡果不足惜状原,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,892評(píng)論 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望苗踪。 院中可真熱鬧颠区,春花似錦、人聲如沸通铲。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,741評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)颅夺。三九已至朋截,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間碗啄,已是汗流浹背质和。 一陣腳步聲響...
    開封第一講書人閱讀 31,977評(píng)論 1 265
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留稚字,地道東北人饲宿。 一個(gè)月前我還...
    沈念sama閱讀 46,324評(píng)論 2 360
  • 正文 我出身青樓厦酬,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親瘫想。 傳聞我的和親對(duì)象是個(gè)殘疾皇子仗阅,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,492評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容