Quantcast
Channel: SCN: Message List - SAP on Oracle
Viewing all articles
Browse latest Browse all 5847

Re: Freeing up Disk space

$
0
0

Hello Craig,

 

As the segments within a tablespace are spread over all the datafiles a reorg will not free a complete datafile.

If you are wishing to recover some free space you can use the here under script to reduce the size of the datafiles.

It will recover all the free space over the datafile high water mark.

To keep some room for future tablespace/segement growth it could be clever to keep some freespace within some datafiles.

 

Best regards

 

821687 - FAQ: Space utilization and fragmentation in Oracle

If a tablespace requires a large amount of space because the data file is too large, you can reduce the size of the data file by using RESIZE:
ALTER DATABASE DATAFILE '<file>' RESIZE <new_size>;

 

 

Select 'ALTER database datafile ''' || File_name || ''' resize ' || smallest_Mb || ' M;' FROM (  SELECT       file_name as File_name,  ceil( (nvl(hwm,1)*C.VALUE)/1024/1024 ) as smallest_Mb,  ceil( blocks*C.VALUE/1024/1024) as currsize_Mb,       ceil( blocks*C.VALUE/1024/1024) - ceil( (nvl(hwm,1)*C.VALUE)/1024/1024 ) as Shrink_Mb,       a.autoextensible as Auto_extend , a.maxbytes/1024/1024 as Extend_max_MB  FROM dba_data_files a,       (select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b,       (select value from v$parameter where name = 'db_block_size') C  WHERE a.file_id = b.file_id(+) AND a.file_name in (select FILE_NAME from  dba_data_files)
) WHERE 1=1;
    



Viewing all articles
Browse latest Browse all 5847

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>