{"id":1047,"date":"2015-09-30T08:42:11","date_gmt":"2015-09-30T08:42:11","guid":{"rendered":"http:\/\/62.131.51.129\/?p=1047"},"modified":"2015-09-30T08:42:11","modified_gmt":"2015-09-30T08:42:11","slug":"oops-how-much-tablespace-is-left","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=1047","title":{"rendered":"Oops how much tablespace is left?"},"content":{"rendered":"<p>A few days ago, I was asked to load some tables in Oracle. A rather trivial question but I wasn&#8217;t sure if enough tablespace was left. From the table definition, I came to know what tablespace was used. After that I ran below query to see how much tablespace was actually left. I want to retain this code as it might be handy in the future.<\/p>\n<pre>\ncolumn \"Tablespace\" format a13\ncolumn \"Used MB\"    format 99,999,999\ncolumn \"Free MB\"    format 99,999,999\ncolumn \"Total MB\"   format 99,999,999\nselect\n   fs.tablespace_name                          \"Tablespace\",\n   (df.totalspace - fs.freespace)              \"Used MB\",\n   fs.freespace                                \"Free MB\",\n   df.totalspace                               \"Total MB\",\n   round(100 * (fs.freespace \/ df.totalspace)) \"Pct. Free\"\nfrom\n   (select\n      tablespace_name,\n      round(sum(bytes) \/ 1048576) TotalSpace\n   from\n      dba_data_files\n   group by\n      tablespace_name\n   ) df,\n   (select\n      tablespace_name,\n      round(sum(bytes) \/ 1048576) FreeSpace\n   from\n      dba_free_space\n   group by\n      tablespace_name\n   ) fs\nwhere\n   df.tablespace_name = fs.tablespace_name;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A few days ago, I was asked to load some tables in Oracle. A rather trivial question but I wasn&#8217;t sure if enough tablespace was left. From the table definition, I came to know what tablespace was used. After that I ran below query to see how much tablespace was actually left. I want to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1048,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1047","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nice-to-know"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1047"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1047\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1047"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}