Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to resize the data files
It wasn't clear whether or not you've reclaimed space within the
tablespaces by shrinking their objects. If you've done that and have
pockets of free space within each tablespace, one option is to move all
objects to another tablespace, then back again. This will remove the
"fragmentation", lowering your HWM.
You can view each database's HWM by a query similar to the following:
DEFINE TABLESPACE_NAME='%'; COLUMN file_name FORMAT A50 HEADING 'File Name' JUSTIFY CENTER COLUMN segment_name FORMAT A30 HEADING 'Segment Name' JUSTIFY CENTER COLUMN hwm_mb FORMAT 999,999 HEADING 'File|HWM(MB)' JUSTIFY CENTER COLUMN alloc_mb FORMAT 999,999 HEADING 'File|Size(MB)' JUSTIFY CENTER COLUMN tablespace_name NOPRINT
SELECT ddf.tablespace_name,
ddf.file_name, a.segment_name, a.partition_name, CEIL((((a.block_id - 1) + a.blocks) * a.db_block_size) / 1048576) hwm_mb, CEIL((ddf.blocks * a.db_block_size) / 1048576) alloc_mb FROM (SELECT file_id , block_id , blocks , segment_name , owner , partition_name , RANK() OVER (PARTITION BY file_id ORDER BY block_id desc) rank1 , (SELECT value FROM v$parameter WHERE name = 'db_block_size') db_block_size FROM cdba_extents WHERE tablespace_name LIKE '&TABLESPACE_NAME') a , dba_data_files ddf
COLUMN tablespace_name PRINT
"cdba_extents" is a custom version of DBA_EXTENTS that gets past performance issues under 9i with LMTs.
Dave
David C. Herring, DBA | A c x i o m Delivery Center Organization
630-944-4762 office | 630-430-5988 wireless | 630-944-4989 fax
> -----Original Message-----
> From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]
> Sent: Wednesday, April 18, 2007 4:37 PM
> To: oracle-l
> Subject: How to resize the data files
>
> Hi,
>
> We had a 4 big table in tablespace ts1 and we range partition the
tables
> into 4 partitions and assigned tablespaces ts2-ts5 and now we want to
> reduce the size of the datafiles in ts1. Even though the data for the
> big tables does not exists on ts1 anymore but due to high water mark
it
> is now allowing me to shrink the datafiles.
>
> What is the best possible way to resize the files.
>
> Thanks
> --Harvinder
>
> --
> http://www.freelists.org/webpage/oracle-l
If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please resend this communication to the sender and delete the original message or any copy of it from your computer system.
Thank you.
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Apr 18 2007 - 19:59:03 CDT
![]() |
![]() |