RE: How to resize the data files

  • From: "Harvinder Singh" <Harvinder.Singh@xxxxxxxxxxxxx>
  • To: "Herring Dave - dherri" <Dave.Herring@xxxxxxxxxx>, "oracle-l" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 18 Apr 2007 22:29:24 -0400

I tried that but the problem is it is giving error that table that is 
partitioned can't be moved and all the partitions of this table are already on 
the other tablespaces. If i can somehow move this reference of this table from 
this tablespace i can use the move option on all other tables in this 
tablespace or expdp/impdp to reset the HWM and shrink the files.


-----Original Message-----
From: Herring Dave - dherri [mailto:Dave.Herring@xxxxxxxxxx]
Sent: Wed 4/18/2007 8:59 PM
To: Harvinder Singh; oracle-l
Subject: 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
 WHERE a.rank1 = 1
   AND a.file_id = ddf.file_id
 ORDER BY ddf.tablespace_name, ddf.file_name;

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@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]
> 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
> 
> --
> //www.freelists.org/webpage/oracle-l
*************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be
legally privileged.

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.
*************************************************************************


--
//www.freelists.org/webpage/oracle-l


Other related posts: