Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to resize the data files

RE: How to resize the data files

From: Harvinder Singh <Harvinder.Singh_at_MetraTech.com>
Date: Wed, 18 Apr 2007 22:29:24 -0400
Message-ID: <D6424CD4C8A3C044BBC49877ED51C518035F18F3@ex2003.metratech.com>


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_at_acxiom.com] 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_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
*************************************************************************
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.


--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 18 2007 - 21:29:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US