Welcome! Wikis are websites that everyone can build together. It's easy!

Comprehensive Tablespace Report with Oracle OLAP Multidimensional Datatype Information

Run this script in SQL*Plus/iSQL*Plus to generate a report that even includes information about OLAP option Multidimensional Datatypes:

set lines 150 pages 500 feedback off head on
clear bre col comp buff

col name for a14 hea "Tablespace"
col ownr for 990 hea "Users"
col ttype for a1 hea "T|Y|P|E"
col auto for a1 hea "A|U|T|O"
col bigf for a1 hea "B|I|G|F"
col lgg for a1 hea "L|O|G|G"
col extmgt for a1 hea "E|X|T|M"
col segm for a1 hea "S|E|G|M"
col plg for a1 hea "P|L|U|G"
col comp for a1 hea "C|O|M|P"
col status for a1 hea "L|I|V|E"
col sz for 999,990.9 hea "(MB)|On Disk"
col usd for 999,990.9 hea "(MB)|Occupying"
col awsz for 999,990.9 hea "(MB)|AW Size"
col aws for 990 hea "AW|CNT"
col segs for 990 hea "AW|PTN"

bre on REPORT;

comp sum lab total of aws on REPORT;
comp sum lab total of awsz on REPORT;
comp sum lab total of fr on REPORT;
comp sum lab total of segs on REPORT;
comp sum lab total of sz on REPORT;
comp sum lab total of usd on REPORT;

-- optional create a view definition
-- create or replace view aw_storage as

select d.tablespace_name name, substr(d.contents, 1, 1) ttype,
substr(a.autoextensible, 1, 1) auto, decode(d.bigfile, 'YES', 'Y', 'NO', 'N', '?') bigf,
decode(d.logging,'LOGGING','Y','NOLOGGING','N','?') lgg,
decode(d.extent_management, 'LOCAL', 'L', 'DICTIONARY', 'D', '?') extmgt,
substr(d.segment_space_management, 1, 1) segm, substr(d.plugged_in, 1, 1) plg,
decode(d.def_tab_compression, 'ENABLED', 'Y', 'DISABLED', 'N', '?') comp,
decode(d.status, 'ONLINE', 'Y', 'OFFLINE', 'N', '?') status,
NVL(o.ownr,0) ownr, NVL(a.bytes/1024/1024,0) sz,
((NVL(a.bytes/1024/1024,0))-(NVL(NVL(f.bytes,0),0)/1024/1024)) usd,
NVL(g.bytes/1024/1024,0) awsz, NVL(g.awcnt,0) aws, NVL(g.segcnt,0) segs
from sys.dba_tablespaces d,
(select tablespace_name, autoextensible, sum(bytes) bytes
from dba_data_files group by tablespace_name, autoextensible) a,
(select tablespace_name, sum(bytes) bytes
from dba_free_space group by tablespace_name) f,
(select dbas.tablespace_name, count(distinct table_name) as awcnt, count(*) as segcnt,
sum(dbas.bytes) bytes
from dba_lobs dbal, dba_segments dbas where dbal.column_name = 'AWLOB' and
dbal.segment_name = dbas.segment_name group by dbas.tablespace_name) g,
(select tablespace_name, count(distinct owner) ownr
from dba_segments group by tablespace_name) o
where d.tablespace_name = a.tablespace_name(+) and d.tablespace_name = f.tablespace_name(+) and
d.tablespace_name = g.tablespace_name(+) and d.tablespace_name = o.tablespace_name(+) and
d.contents != 'TEMPORARY'
union all
select d.tablespace_name name, substr(d.contents, 1, 1) ttype,
substr(a.autoextensible, 1, 1) auto, decode(d.bigfile, 'YES', 'Y', 'NO', 'N', '?') bigf,
decode(d.logging,'LOGGING','Y','NOLOGGING','N','?') lgg,
decode(d.extent_management, 'LOCAL', 'L', 'DICTIONARY', 'D', '?') extmgt,
substr(d.segment_space_management, 1, 1) segm, substr(d.plugged_in, 1, 1) plg,
decode(d.def_tab_compression, 'ENABLED', 'Y', 'DISABLED', 'N', '?') comp,
decode(d.status, 'ONLINE', 'Y', 'OFFLINE', 'N', '?') status,
NVL(o.ownr, 0) ownr, NVL(a.bytes /1024/1024, 0) sz,
((NVL(a.bytes/1024/1024,0))-(NVL((a.bytes-t.bytes), a.bytes)/1024/1024)) usd,
NVL(g.bytes/1024/1024,0) awsz, NVL(g.awcnt,0) aws, NVL(g.segcnt,0) segs
from sys.dba_tablespaces d,
(select tablespace_name, autoextensible, sum(bytes) bytes
from dba_temp_files group by tablespace_name, autoextensible) a,
(select tablespace_name, sum(bytes_cached) bytes
from gv$temp_extent_pool group by tablespace_name) t,
(select dbas.tablespace_name, count(distinct table_name) as awcnt, count(*) as segcnt,
sum(dbas.bytes) bytes
from dba_lobs dbal, dba_segments dbas
where dbal.column_name = 'AWLOB' and dbal.segment_name = dbas.segment_name
group by dbas.tablespace_name) g,
(select tablespace_name, count(distinct owner) ownr
from dba_segments group by tablespace_name) o
where d.tablespace_name = a.tablespace_name(+) and d.tablespace_name = t.tablespace_name(+) and
d.tablespace_name = g.tablespace_name(+) and d.tablespace_name = o.tablespace_name(+) and
d.contents = 'TEMPORARY'
order by ttype, name;


............ T A B L E S P C L
............ Y U I O X E L O I
............ P T G G T G U M V ..... ......(MB) ......(MB) ......(MB) ..AW ..AW
Tablespace.. E O F G M M G P E Users ...On.Disk .Occupying ...AW.Size .CNT .PTN
------------ - - - - - - - - - ----- ---------- ---------- ---------- ---- ----
SCOTT_TEST...P N N Y L A N N Y ....0 .......1.0 .......0.1 .......0.0 ...0 ...0
SYSAUX.......P Y N Y L A N N Y ...14 .....290.0 .....282.7 ......18.9 ...5 ...5
SYSTEM...... P Y N Y D M N N Y ....3 .....460.0 .....450.9 .......0.0 ...0 ...0
SCOTT........P N N Y L A N N Y ....1 ..622573.0 ..541954.8 ..509348.0 ...1 ...8
SCOTT_2000...P N N Y L A N N Y ....1 ....1107.0 ....1106.1 .......0.0 ...0 ...0
SCOTT_2001...P N N Y L A N N Y ....1 ....1625.0 ....1624.1 .......0.0 ...0 ...0
SCOTT_2002...P N N Y L A N N Y ....1 ....1706.0 ....1705.1 .......0.0 ...0 ...0
SCOTT_2003...P N N Y L A N N Y ....1 ....1757.0 ....1756.1 .......0.0 ...0 ...0
SCOTT_2004...P N N Y L A N N Y ....1 .....900.0 .....892.1 .......0.0 ...0 ...0
USERS........P Y N Y L A N N Y ....1 .......5.0 .......0.4 .......0.0 ...0 ...0
SCOTT_TEMP...T N N N L M N N Y ....0 ...86175.0 ...36764.5 .......0.0 ...0 ...0
SCOTT_TMP....T N Y N L M N N Y ....0 ...61440.0 ...37875.0 .......0.0 ...0 ...0
TEMP........ T Y N N L M N N Y ....0 ....4277.0 ....4276.0 .......0.0 ...0 ...0
UNDO.........U N N Y L M N N Y ....1 ....8192.0 ....2332.9 .......0.0 ...0 ...0
UNDOTBS1.....U Y N Y L M N N Y ....1 ......60.0 ......12.1 .......0.0 ...0 ...0
.....................................---------- ---------- ---------- ---- ----
total..................................790568.0 ..631032.6 ..509366.9 ...6 ..13


Columns Explained:

...Tablespace.= Tablespace Name
...TYPE.......= Undo (U), Temporary (T) or Permanent (P)
...AUTO.......= Auto Extensible: Yes (Y) or No (N)
...BIGF.......= Bigfile Tablespace: Yes (Y) or No (N)
...LOGG.......= Logging: Yes (Y) or No (N)
...EXTM.......= Extent Management: Local (L) or Dictionary (D)
...SEGM.......= Segment Space Management: Auto (A) or Manual (M)
...PLUG.......= Plugged In: Yes (Y) or No (N)
...COMP.......= Compression: Yes (Y) or No (N)
...LIVE.......= Status: Online (Y) or Offline (N)
...Users......= Count of Schemas with Objects in Tablespace
...On Disk....= Total Size of Tablespace in MB on Disk
...Occupying..= Total Space occupied in MB by objects in Tablespace
...AW Size....= Space is consumed in MB by Analytic Workspaces in Tablespace
...AW CNT.....= Count of Analytic Workspaces in Tablespace
...AW PTN.....= Count of Partitions for Analytic Workspaces in Tablespace



Latest page update: made by olapdba , Jan 11 2008, 5:08 PM EST (about this update About This Update olapdba Edited by olapdba

16 words added

view changes

- complete history)
Keyword tags: None
More Info: links to this page

There are no threads for this page. 

Anonymous  (Get credit for your thread)


Wiki pages
Top Contributors