Oracle resize datafile

select 'alter database datafile ''' || file_name || ''' resize ' ||
       ceil((nvl(hwm, 1) * 8192) / 1024 / 1024) || 'm;' 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(blocks * 8192 / 1024 / 1024) -
       ceil((nvl(hwm, 1) * 8192) / 1024 / 1024) > 0;

 

posted @ 2018-06-14 14:43  Ayumie  阅读(714)  评论(0编辑  收藏  举报