{"id":332,"date":"2012-03-08T04:27:30","date_gmt":"2012-03-08T04:27:30","guid":{"rendered":"http:\/\/oranotes.tuktaroff.com\/?page_id=332"},"modified":"2013-03-01T04:36:04","modified_gmt":"2013-03-01T04:36:04","slug":"resize-datafile-to-hwm","status":"publish","type":"page","link":"http:\/\/oranotes.tuktaroff.com\/?page_id=332","title":{"rendered":"Resize datafile to HWM"},"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<h2>\nCommands to resize datafiles up to HWM<br \/>\n<\/h2>\n<pre class=\"qcode\">\r\nSET LINESIZE 150\r\nSET PAGESIZE 9999\r\nSET VERIFY   OFF\r\n\r\nselect 'alter database datafile '''||file_name||''' resize '||\r\nceil( (nvl(hwm,1)*(SELECT value FROM v$parameter where name = 'db_block_size'))\/1024\/1024 )||'m;' cmd\r\nfrom dba_data_files a, ( select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b\r\nwhere a.file_id = b.file_id(+) and ceil( blocks*(SELECT value FROM v$parameter where name = 'db_block_size')\/1024\/1024) -ceil( (nvl(hwm,1)*(SELECT value FROM v$parameter where name = 'db_block_size'))\/1024\/1024 ) > 0\r\nand lower(a.file_name) like lower('%&file_name%');\r\n<\/pre>\n<form action=\"\"><textarea name=\"data\" cols=\"50\" rows=\"10\" style=\"display:none;\"><br \/>\nSET LINESIZE 150<br \/>\nSET PAGESIZE 9999<br \/>\nSET VERIFY   OFF<\/p>\n<p>select 'alter database datafile '''||file_name||''' resize '||<br \/>\nceil( (nvl(hwm,1)*(SELECT value FROM v$parameter where name = 'db_block_size'))\/1024\/1024 )||'m;' cmd<br \/>\nfrom dba_data_files a, ( select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b<br \/>\nwhere a.file_id = b.file_id(+) and ceil( blocks*(SELECT value FROM v$parameter where name = 'db_block_size')\/1024\/1024) -ceil( (nvl(hwm,1)*(SELECT value FROM v$parameter where name = 'db_block_size'))\/1024\/1024 ) > 0<br \/>\nand lower(a.file_name) like lower('%&file_name%');<br \/>\n<\/textarea><input type=\"button\" value=\"Clipboard\" onclick=\"copy(this.form.data)\"><\/form>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commands to resize datafiles up to HWM SET LINESIZE 150 SET PAGESIZE 9999 SET VERIFY OFF select &#8216;alter database datafile &#8221;&#8217;||file_name||&#8221;&#8217; resize &#8216;|| ceil( (nvl(hwm,1)*(SELECT value FROM v$parameter where name = &#8216;db_block_size&#8217;))\/1024\/1024 )||&#8217;m;&#8217; cmd from dba_data_files a, ( select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b where a.file_id = b.file_id(+) and ceil( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":11,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-332","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P2NVny-5m","_links":{"self":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/332","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=332"}],"version-history":[{"count":5,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/332\/revisions"}],"predecessor-version":[{"id":434,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/332\/revisions\/434"}],"up":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/11"}],"wp:attachment":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}