{"id":454,"date":"2021-08-14T08:00:00","date_gmt":"2021-08-14T08:00:00","guid":{"rendered":"https:\/\/datablog.roman-halliday.com\/?p=454"},"modified":"2021-08-12T08:48:08","modified_gmt":"2021-08-12T08:48:08","slug":"checking-tablespace-usage-availability-in-oracle","status":"publish","type":"post","link":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/","title":{"rendered":"Checking tablespace Usage &#038; Availability in Oracle"},"content":{"rendered":"\n<p>This is a little bit of code that I keep to hand for viewing how much of the allocated disk space is used in an oracle tablespace. I&#8217;m not sure where I stole the original from, but it has been modified since.<\/p>\n\n\n\n<p>View each tablespace in oracle and the amount of allocated disk space used. Note that the amount and percent &#8220;free&#8221; doesn&#8217;t take into account cases where the tablespace can grow automatically.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--------------------------------------------------------------------------------\n-- A report for checking disk space\/tablespace usage\n--------------------------------------------------------------------------------\nWITH df AS (\nSELECT tablespace_name,\n       ROUND(SUM(bytes) \/ 1048576) TotalSpace\n  FROM dba_data_files\n GROUP BY tablespace_name\n), tu AS (\nSELECT round(SUM(bytes)\/(1024*1024)) totalusedspace,\n       tablespace_name\n  FROM dba_segments\n GROUP BY tablespace_name\n)\nSELECT df.tablespace_name                                                       \"Tablespace\",\n       totalusedspace                                                           \"Used MB\",\n       (df.totalspace - tu.totalusedspace)                                      \"Free MB\",\n       df.totalspace                                                            \"Total MB\",\n       CAST( totalusedspace\/1024 AS NUMBER(20,2))                               \"Used GB\",\n       CAST((df.totalspace\/1024 - tu.totalusedspace\/1024) AS NUMBER(20,2))      \"Free GB\",\n       CAST( df.totalspace\/1024 AS NUMBER(20,2))                                \"Total GB\",\n       round(100 * ( (df.totalspace - tu.totalusedspace)\/ df.totalspace))       \"Pct. Free\",\n       100 - round(100 * ( (df.totalspace - tu.totalusedspace)\/ df.totalspace)) \"Pct. Used\"\n  FROM df\n    INNER JOIN tu\n       ON df.tablespace_name = tu.tablespace_name\n ORDER BY df.tablespace_name\n;<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>View each tablespace in oracle and the amount of allocated disk space used.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[24,7],"class_list":["post-454","post","type-post","status-publish","format-standard","hentry","category-databases","category-oracle","tag-partition","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Checking tablespace Usage &amp; Availability in Oracle - Rows Across The Lake<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Checking tablespace Usage &amp; Availability in Oracle - Rows Across The Lake\" \/>\n<meta property=\"og:description\" content=\"View each tablespace in oracle and the amount of allocated disk space used.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/\" \/>\n<meta property=\"og:site_name\" content=\"Rows Across The Lake\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-14T08:00:00+00:00\" \/>\n<meta name=\"author\" content=\"david\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@d_roman_h\" \/>\n<meta name=\"twitter:site\" content=\"@d_roman_h\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"david\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/\"},\"author\":{\"name\":\"david\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\"},\"headline\":\"Checking tablespace Usage &#038; Availability in Oracle\",\"datePublished\":\"2021-08-14T08:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/\"},\"wordCount\":81,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\"},\"keywords\":[\"partition\",\"SQL\"],\"articleSection\":[\"Databases\",\"Oracle\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/\",\"url\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/\",\"name\":\"Checking tablespace Usage & Availability in Oracle - Rows Across The Lake\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#website\"},\"datePublished\":\"2021-08-14T08:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2021\\\/08\\\/14\\\/checking-tablespace-usage-availability-in-oracle\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Checking tablespace Usage &#038; Availability in Oracle\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#website\",\"url\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/\",\"name\":\"Rows Across The Lake\",\"description\":\"Data &amp; Databases\",\"publisher\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\",\"name\":\"david\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\",\"caption\":\"david\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Checking tablespace Usage & Availability in Oracle - Rows Across The Lake","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/","og_locale":"en_GB","og_type":"article","og_title":"Checking tablespace Usage & Availability in Oracle - Rows Across The Lake","og_description":"View each tablespace in oracle and the amount of allocated disk space used.","og_url":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/","og_site_name":"Rows Across The Lake","article_published_time":"2021-08-14T08:00:00+00:00","author":"david","twitter_card":"summary_large_image","twitter_creator":"@d_roman_h","twitter_site":"@d_roman_h","twitter_misc":{"Written by":"david","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/#article","isPartOf":{"@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/"},"author":{"name":"david","@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b"},"headline":"Checking tablespace Usage &#038; Availability in Oracle","datePublished":"2021-08-14T08:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/"},"wordCount":81,"commentCount":0,"publisher":{"@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b"},"keywords":["partition","SQL"],"articleSection":["Databases","Oracle"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/","url":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/","name":"Checking tablespace Usage & Availability in Oracle - Rows Across The Lake","isPartOf":{"@id":"https:\/\/datablog.roman-halliday.com\/#website"},"datePublished":"2021-08-14T08:00:00+00:00","breadcrumb":{"@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2021\/08\/14\/checking-tablespace-usage-availability-in-oracle\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/datablog.roman-halliday.com\/"},{"@type":"ListItem","position":2,"name":"Checking tablespace Usage &#038; Availability in Oracle"}]},{"@type":"WebSite","@id":"https:\/\/datablog.roman-halliday.com\/#website","url":"https:\/\/datablog.roman-halliday.com\/","name":"Rows Across The Lake","description":"Data &amp; Databases","publisher":{"@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/datablog.roman-halliday.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b","name":"david","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g","caption":"david"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g"}}]}},"_links":{"self":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts\/454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/comments?post=454"}],"version-history":[{"count":1,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts\/454\/revisions"}],"predecessor-version":[{"id":455,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts\/454\/revisions\/455"}],"wp:attachment":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/media?parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/categories?post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/tags?post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}