execute below sql query to find out how much space can be reclaimed at dataffile level as below
SQL> select file_name,
2 ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) smallest,
ceil( blocks*&&blksize/1024/1024) currsize,
3 4 ceil( blocks*&&blksize/1024/1024) -
5 ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) savings
6 from dba_data_files a,
7 ( select file_id, max(block_id+blocks-1) hwm
8 from dba_extents
9 group by file_id ) b
10 where a.file_id = b.file_id(+)
11 /
Smallest
Size Current Poss.
FILE_NAME Poss. Size Savings
-------------------------------------------------- -------- -------- --------
/Ora10g/prod/system01.dbf 421 544 123
/Ora10gdb10/oradata/prod/collectord01.dbf 1,223 1,374 151
/sv101/db14/oradata/prod/prdsselx00p_06.dbf 19,991 20,000 9
/Ora10gdb01/oradata/prod/disceuld_01.dbf 5,502 5,502 0
/Ora10gdb03/oradata/prod/prodprds2d01.dbf 1,585 1,585 0
/Ora10gdb03/oradata/prod/prodprds2x01.dbf 1,350 1,350 0
/Ora10gdb07/oradata/prod/prdsotlhx00p_01.dbf 19,991 19,991 0
/Ora10gdb08/oradata/prod/prdssrd00p_01.dbf 24,991 25,000 9
/Ora10gdb09/oradata/prod/prdssrx00p_01.dbf 17,251 17,401 150
/Ora10gdb08/oradata/prod/prdssrd00p_02.dbf 24,991 25,000 9
/Ora10gdb04/oradata/prod/tools01.dbf 20 20 0
/Ora10gdb01/oradata/prod/users_01.dbf 4 10 6
/Ora10gdb05/oradata/prod/ctsreportsd02.dbf 11,511 11,550 39
/Ora10gdb01/oradata/prod/prdsmatrix_04.dbf 20,000 20,000 0
/Ora10gdb01/oradata/prod/prdsmatrix_05.dbf 20,000 20,000 0
/Ora10gdb01/oradata/prod/datamartd_05.dbf 19,997 19,997 0
/Ora10gdb01/oradata/prod/datamartd_06.dbf 19,997 20,000 3
/Ora10gdb01/oradata/prod/datamartd_07.dbf 19,997 20,000 3
/Ora10gdb05/oradata/prod/prdssachd00p_08.dbf 9,421 19,991 10,570
below query will provide the statement that can executed to shrink the datfiles and reclaim space at OS level
SQL> SQL> SQL> select 'alter database datafile ''' || file_name || ''' resize ' ||
2 ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) || 'm;' cmd
3 from dba_data_files a,
4 ( select file_id, max(block_id+blocks-1) hwm
5 from dba_extents
6 group by file_id ) b
where a.file_id = b.file_id(+)
7 8 and ceil( blocks*&&blksize/1024/1024) -
9 ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) > 0
10 /
alter database datafile '/Ora10gdb10/oradata/prod/collectord01.dbf' resize
1223 m;
No comments:
Post a Comment