{"id":30,"date":"2012-03-01T02:11:57","date_gmt":"2012-03-01T02:11:57","guid":{"rendered":"http:\/\/oranotes.tuktaroff.com\/?page_id=30"},"modified":"2012-09-12T01:00:54","modified_gmt":"2012-09-12T01:00:54","slug":"one-tablespace","status":"publish","type":"page","link":"http:\/\/oranotes.tuktaroff.com\/?page_id=30","title":{"rendered":"One tablespace"},"content":{"rendered":"<p><code><br \/>\n<script type=\"text\/javascript\"> \nfunction copy(what) {\n    window.clipboardData.setData('Text',what.value);\n}\nfunction paste(what) {\n    what.value = window.clipboardData.getData('Text');\n}\n<\/script><\/p>\n<form action=\"\"><textarea name=\"data\" cols=\"50\" rows=\"10\" style=\"display:none;\"><br \/>\nSET LINESIZE 141<br \/>\nSET PAGESIZE 9999<br \/>\nSET VERIFY   OFF<\/p>\n<p>COLUMN status      FORMAT a9                 HEADING 'Status'<br \/>\nCOLUMN name        FORMAT a22                HEADING 'Tablespace Name'<br \/>\nCOLUMN type        FORMAT a12                HEADING 'TS Type'<br \/>\nCOLUMN extent_mgt  FORMAT a10                HEADING 'Ext. Mgt.'<br \/>\nCOLUMN segment_mgt FORMAT a9                 HEADING 'Seg. Mgt.'<br \/>\nCOLUMN ts_size     FORMAT 9,999,999,999,999  HEADING 'Tablespace Size'<br \/>\nCOLUMN used        FORMAT 9,999,999,999,999  HEADING 'Used (in bytes)'<br \/>\nCOLUMN free        FORMAT 9,999,999,999,999  HEADING 'Free (in bytes)'<br \/>\nCOLUMN pct_used    FORMAT 999                HEADING 'Pct. Used'<\/p>\n<p>BREAK ON report<br \/>\nCOMPUTE SUM OF ts_size  ON report<br \/>\nCOMPUTE SUM OF used     ON report<br \/>\nCOMPUTE SUM OF free     ON report<br \/>\nCOMPUTE AVG OF pct_used ON report<\/p>\n<p>SELECT<br \/>\n    d.status                                            status<br \/>\n  , d.tablespace_name                                   name<br \/>\n  , d.contents                                          type<br \/>\n  , d.extent_management                                 extent_mgt<br \/>\n  , d.segment_space_management                          segment_mgt<br \/>\n  , NVL(a.bytes, 0)                                     ts_size<br \/>\n  , NVL(a.bytes - NVL(f.bytes, 0), 0)                   used<br \/>\n  , NVL(f.bytes, 0)                                     free<br \/>\n  , NVL((a.bytes - NVL(f.bytes, 0)) \/ a.bytes * 100, 0) pct_used<br \/>\nFROM<br \/>\n    sys.dba_tablespaces d<br \/>\n  , ( select tablespace_name, sum(bytes) bytes<br \/>\n      from dba_data_files<br \/>\n      group by tablespace_name<br \/>\n    ) a<br \/>\n  , ( select tablespace_name, sum(bytes) bytes<br \/>\n      from dba_free_space<br \/>\n      group by tablespace_name<br \/>\n    ) f<br \/>\nWHERE<br \/>\n      d.tablespace_name = a.tablespace_name(+)<br \/>\n  AND d.tablespace_name = f.tablespace_name(+)<br \/>\n  AND NOT (<br \/>\n    d.extent_management like 'LOCAL'<br \/>\n    AND<br \/>\n    d.contents like 'TEMPORARY'<br \/>\n  )<br \/>\nand a.tablespace_name = upper('&TABLESPACE_NAME')<br \/>\n\/<br \/>\n<\/textarea><input type=\"button\" value=\"Clipboard\" onclick=\"copy(this.form.data)\"><\/form>\n<pre class=\"qcode\">\r\nSET LINESIZE 141\r\nSET PAGESIZE 9999\r\nSET VERIFY   OFF\r\n\r\nCOLUMN status      FORMAT a9                 HEADING 'Status'\r\nCOLUMN name        FORMAT a22                HEADING 'Tablespace Name'\r\nCOLUMN type        FORMAT a12                HEADING 'TS Type'\r\nCOLUMN extent_mgt  FORMAT a10                HEADING 'Ext. Mgt.'\r\nCOLUMN segment_mgt FORMAT a9                 HEADING 'Seg. Mgt.'\r\nCOLUMN ts_size     FORMAT 9,999,999,999,999  HEADING 'Tablespace Size'\r\nCOLUMN used        FORMAT 9,999,999,999,999  HEADING 'Used (in bytes)'\r\nCOLUMN free        FORMAT 9,999,999,999,999  HEADING 'Free (in bytes)'\r\nCOLUMN pct_used    FORMAT 999                HEADING 'Pct. Used'\r\n\r\nBREAK ON report\r\nCOMPUTE SUM OF ts_size  ON report\r\nCOMPUTE SUM OF used     ON report\r\nCOMPUTE SUM OF free     ON report\r\nCOMPUTE AVG OF pct_used ON report\r\n\r\nSELECT\r\n    d.status                                            status\r\n  , d.tablespace_name                                   name\r\n  , d.contents                                          type\r\n  , d.extent_management                                 extent_mgt\r\n  , d.segment_space_management                          segment_mgt\r\n  , NVL(a.bytes, 0)                                     ts_size\r\n  , NVL(a.bytes - NVL(f.bytes, 0), 0)                   used\r\n  , NVL(f.bytes, 0)                                     free\r\n  , NVL((a.bytes - NVL(f.bytes, 0)) \/ a.bytes * 100, 0) pct_used\r\nFROM \r\n    sys.dba_tablespaces d\r\n  , ( select tablespace_name, sum(bytes) bytes\r\n      from dba_data_files\r\n      group by tablespace_name\r\n    ) a\r\n  , ( select tablespace_name, sum(bytes) bytes\r\n      from dba_free_space\r\n      group by tablespace_name\r\n    ) f\r\nWHERE\r\n      d.tablespace_name = a.tablespace_name(+)\r\n  AND d.tablespace_name = f.tablespace_name(+)\r\n  AND NOT (\r\n    d.extent_management like 'LOCAL'\r\n    AND\r\n    d.contents like 'TEMPORARY'\r\n  )\r\nand a.tablespace_name = upper('&TABLESPACE_NAME')\r\n\/\r\n<\/pre>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SET LINESIZE 141 SET PAGESIZE 9999 SET VERIFY OFF COLUMN status FORMAT a9 HEADING &#8216;Status&#8217; COLUMN name FORMAT a22 HEADING &#8216;Tablespace Name&#8217; COLUMN type FORMAT a12 HEADING &#8216;TS Type&#8217; COLUMN extent_mgt FORMAT a10 HEADING &#8216;Ext. Mgt.&#8217; COLUMN segment_mgt FORMAT a9 HEADING &#8216;Seg. Mgt.&#8217; COLUMN ts_size FORMAT 9,999,999,999,999 HEADING &#8216;Tablespace Size&#8217; COLUMN used FORMAT 9,999,999,999,999 HEADING [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":25,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-30","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P2NVny-u","_links":{"self":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30"}],"version-history":[{"count":5,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/30\/revisions"}],"predecessor-version":[{"id":384,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/30\/revisions\/384"}],"up":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/25"}],"wp:attachment":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}