{"id":275,"date":"2025-04-03T14:50:04","date_gmt":"2025-04-03T12:50:04","guid":{"rendered":"http:\/\/mariospavlidis.site\/?p=275"},"modified":"2025-07-10T10:46:56","modified_gmt":"2025-07-10T08:46:56","slug":"tablespace-usage","status":"publish","type":"post","link":"http:\/\/130.61.57.200\/index.php\/2025\/04\/03\/tablespace-usage\/","title":{"rendered":"Oracle Tablespace Usage: Analyzing Free, Used, and Actual File Space"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Monitoring tablespace usage is a critical part of Oracle database administration. As DBAs, we need to keep an eye on how much space is used, how much remains, and how it aligns with what\u2019s physically allocated on disk. We\u2019ll explore a query that gives you a clear view of your tablespace usage, including how much space is <em>actually<\/em> used by segments, the total allocated file space, and the maximum size the tablespace can reach (considering autoextensibility).<\/p>\n\n\n\n<p class=\"has-palette-color-4-color has-palette-color-5-background-color has-text-color has-background has-link-color wp-elements-f0ff446c76d5e7cba88a75150b114bc8 wp-block-paragraph\" style=\"border-width:1px\">select df.tablespace_name Tablespace,<br>nvl(totalusedspace,0) Used_MB,<br>(df.totalspace &#8211; nvl(tu.totalusedspace,0)) Free_MB, df.actualspace as Actual_File_Space,<br>df.totalspace Total_MB,<br>round(100 * ( (nvl(tu.totalusedspace,0))\/ df.totalspace),2) Pct_Used,<br>round(100 * ( (df.totalspace &#8211; nvl(tu.totalusedspace,0))\/ df.totalspace),2)<br>Pct_Free<br>from<br>(<br>select tablespace_name,round(sum(decode(autoextensible,&#8217;YES&#8217;,maxbytes,&#8217;NO&#8217;,bytes)) \/ 1048576) TotalSpace, round (sum(bytes)\/1048576) ActualSpace<br>from dba_data_files<br>group by tablespace_name<br>) df<br>,<br>(<br>select round(sum(bytes)\/(1024*1024)) totalusedspace, tablespace_name<br>from dba_segments<br>group by tablespace_name<br>) tu<br>where df.tablespace_name = tu.tablespace_name(+)<br>order by Pct_Free<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example Output<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Tablespace<\/th><th>Used_MB<\/th><th>Free_MB<\/th><th>Actual_File_Space<\/th><th>Total_MB<\/th><th>Pct_Used<\/th><th>Pct_Free<\/th><\/tr><\/thead><tbody><tr><td>USERS<\/td><td>512<\/td><td>488<\/td><td>600<\/td><td>1000<\/td><td>51.20<\/td><td>48.80<\/td><\/tr><tr><td>SYSTEM<\/td><td>780<\/td><td>220<\/td><td>800<\/td><td>1000<\/td><td>78.00<\/td><td>22.00<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Monitoring tablespace usage is a critical part of Oracle database administration. As DBAs, we need to keep an eye on how much space is used, how much remains, and how it aligns with what\u2019s physically allocated on disk. We\u2019ll explore a query that gives you a clear view of your tablespace usage, including how much [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[72,71],"class_list":["post-275","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-free","tag-tablespace"],"blocksy_meta":[],"_links":{"self":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/comments?post=275"}],"version-history":[{"count":4,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/275\/revisions"}],"predecessor-version":[{"id":317,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/275\/revisions\/317"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media\/106"}],"wp:attachment":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media?parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/categories?post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/tags?post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}