Cann't resize datafile in 10g

hi,
i am facing this problem:
the size of datafile '+DG1/orcl/datafile/erp01.dbf' is 8798m.
but only 4822m(54.81%) was in use.
so i want to resize this datafile to smaller size:
SQL> alter database datafile '+DG1/orcl/datafile/erp01.dbf' resize 7000m;
ERROR at line 1:
ORA-03297: file contains used data beyond requested RESIZE value
i have tried by coalesce the tablespace:
SQL> alter tablespace erp coalesce;
but still resize the datafile to smaller size.

Error: ORA 3297
Text: file contains <num> blocks of data beyond requested RESIZE value
Cause: Some portion of the file in the region to be trimmed is currently in
use by a database segment.
Action: Drop or move segments containing extents in this region prior to
resizing the file, or choose a resize value such that only free space
is in the trimmed region.
Oracle Metalink Doc ID: Note:38691.1
Adith

Similar Messages

  • Syntax to resize datafile in 10g

    syntax to resize datafile in 10g

    the reason is
    in 10g if u want to create tablespace the syntax is
    create tablespace table_name datafile 10M;No, actually. The syntax on how to create a tablespace is exactly the same today as it was in 1999. Create tablespace X datafile '/path/filename' size 10M.
    It is, however, possible to omit both the path and size clause if you want to use Oracle Managed Files (OMF):
    alter system set db_create_file_dest=/path/filename;
    create tablespace X;
    And then it's possible to add back the size clause if you don't like the default 100M autoextend on which OMF gives you:
    create tablespace X datafile size 10M;
    or
    create tablespace X datafile size 10m autoextend off;
    or
    create tablespace X datafile size 10m autoextend on next 10m maxsize 400m;
    Point is, the syntax for creating a tablespace has many different variations and options, but the basic syntax hasn't changed a bit. The other point is: what has creating a tablespace got to do with what you originally asked about, which was resizing an existing datafile?
    to add datafile
    alter tablespace table_name add datafile;
    it will add datafile with default size and with name
    according to its naming convention.Yes, but you are not obliged to let that happen.
    alter system set db_create_file_dest=/path/filename;
    alter tablespace X add datafile '/different/path/myownfilename' size 37M;
    ...you switch on OMF and then decide you don't want to use it for one particular file. The presence/existence of OMF is an addition of features if you want to use them. It doesn't take anything away from you and if you want to specify all the parts of the create or alter tablespace clause yourself, you can do so, no sweat -at which point, your syntax will look incredibly like what you would have issued in 8i or 9i days.
    Analogy time: yes, today, you can build homes out of steel, concrete, carbon-reinforced composites, whereas in the 16th century you might have used timber, wattle and daub. But a house still has rooms, chimney flues, windows, doors. The house I live in would be recognisable to Shakespeare as a house. And what he lived in would be something I could live in too.
    Yeah, well: maybe analogies aren't all they're cracked up to be! But the underlying truth is that Oracle gives you new features in new versions and using them can be highly convenient and useful. Nevertheless, if you understand the underlying principles,the old stuff is still there, still recognisable, still usable.
    thats why i am asking for syntax to resize datafile
    in 10g ,i had fired above sqls with no errors.Again, I am a little at a loss understanding why the fact that the syntax for creating a tablespace has new options should cause you to think anything weird has happened to the syntax for resizing a datafile.
    As others I think have already mentioned: there always were and still remain only three ways of making a tablespace bigger:
    add a datafile
    resize an existing datafile
    switch on autoextension of an existing datafile
    alter tablespace X add datafile ['/path/filename'][size 10m];
    alter database datafile '/path/filename' resize 54m;
    alter database datafile '/path/filename' autoextend on [next Xm] [maxsize Ym];
    None of that syntax is different from what you'd use in version 7. Yes, some commands have optional clauses -and some of the clauses which are optional in 10g were compulsory in 7 or 8. But the general syntax is identical, still.

  • Will resizing datafile after shrink segment minimize the rman bkp duration

    Hi ,
    We have 1 TB database where in the RMAN backup runs for nearly 35 Hrs .
    At database level if i shrink the segments to reclaim space and then resize datafile , will it have my RMAN backup duration time to decrease .
    Kindly let me know if this can be done .

    whats the database version.
    As in 10g Rel 2 See "UNUSED BLOCK COMPRESSION"
    Unused Block Compression Of Datafile Backups to Backup Sets
    When backing up datafiles into backup sets, RMAN does not back up the contents of data blocks that have never been allocated. (In previous releases, this behavior was referred to as NULL compression.)
    RMAN also skips other datafile blocks that do not currently contain data, if all of the following conditions apply:
    The COMPATIBLE initialization parameter is set to 10.2
    There are currently no guaranteed restore points defined for the database
    The datafile is locally managed
    The datafile is being backed up to a backup set as part of a full backup or a level 0 incremental backup
    The backup set is being created on disk.
    Skipping unused data blocks where possible enables RMAN to back up datafiles using less space, and can make I/O more efficient.
    http://docs.oracle.com/cd/B19306_01/backup.102/b14194/rcmsynta009.htm

  • Facing Problem in  resizing datafile

    Hi i m facing problem in resizing a datafile of size 2.5 gb, i infact import data of 2gb in this file then reorganize data in different tablespace now the used size of this datafile is 96mb , when i issue command to reduce it to 200mb it gives me error that data exist u cannot resize datafile,
    tell me what should be done to resize it.
    thanks

    Hi,
    You can create a working tablespace with a good size
    CREATE TABLESPACE tbs_tmp
    DATAFILE 'D:\Oracle\oradata\SID\file_tmp.dbf' SIZE 100M
    EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K;
    And move all segments from your tablespace TBS1 into this new tbs
    (select segment_name,segment_type from dba_segments where tablespace_name = 'TBS1')
    If indexes :
    alter index owner.index_name rebuild tablespace tbs_tmp;
    If table :
    alter table owner.table_name move tablespace tbs_tmp;
    Ensure that the tablespace TBS1 is empty
    select segment_name,segment_type from dba_segments where tablespace_name = 'TBS1'
    After what, if no row return, you can drop your first tablespace,
    DROP TABLESPACE tbs1 INCLUDING CONTENTS CASCADE CONSTRAINTS;
    recreate it with a goos size,
    CREATE TABLESPACE tbs1
    DATAFILE 'D:\Oracle\oradata\SID\file_tbs1.dbf' SIZE 100M
    EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K;
    and move all segment from tbs_tmp into this new tbs1
    (select segment_name,segment_type from dba_segments where tablespace_name = 'TBS_TMP')
    If indexes :
    alter index owner.index_name rebuild tablespace tbs1;
    If table :
    alter table owner.table_name move tablespace tbs1;
    Ensure that the tablespace TBS1 is empty
    select segment_name,segment_type from dba_segments where tablespace_name = 'TBS_TMP'
    If no row return, drop the working tablespace
    DROP TABLESPACE tbs_tmp INCLUDING CONTENTS CASCADE CONSTRAINTS;
    Nicolas.

  • Adding and resizing datafiles seems to take long.

    We have an Oracle 11g R2 Data Guard configuration using Physical Standby.
    Simple One Primary and One Standby.
    Parameter configurations
    standby_file_creation = 'AUTO' and db_file_name_convert are in use
    How can we monitor the adding and resizing datafiles on both the Primary and Standby?

    The Sys Admin, Storage Team and Network Team found out it was a configuration problem on the software firewall between the Database Host and the NAS.

  • RESIZE DATAFILE

    On Oracle 7.3 can I resize datafile from 1900 Mb to 1500Mb during the db is open?
    regards
    pedro

    It works with 7.3, IF your data file isn't fragmented so that there are blocks in use beyond the value you wish to resize to. In other words you have a lot of used blocks then a lot of free blocks, followed by more used blocks. In that case your only option is exp/drop tables/imp.

  • Resize datafile when database is mount

    Hello,
    I need resize datafile when database is mount not open(I recover database).
    Is it posible?

    Try making the tablespace offline, opening the database and resizing the datafile. After you resize the datafile, recover the tablespace or just the datafile.
    In Oracle documentation: Backup & Recovery Guide, you can find more details of these options:
    =>RECOVER TABLESPACE Statement
    RECOVER TABLESPACE performs media recovery on all datafiles in the tablespaces listed. For example, enter the following at the SQL prompt to recover tablespace TBS_1:
    RECOVER TABLESPACE tbs_1
    The tablespaces must be offline to perform the recovery. Oracle indicates an error if none of the files require recovery.
    => RECOVER DATAFILE Statement
    RECOVER DATAFILE lists the datafiles to be recovered. For example, enter the following at the SQL prompt to recover datafile /oracle/dbs/tbs_22.f:
    RECOVER DATAFILE '/oracle/dbs/tbs_22.f'
    The database can be open or closed, provided that you can acquire the media recovery locks. If the database is open in any instance, then datafile recovery can only recover offline files.
    Hope it helps.
    Eliane

  • Resizing datafiles in oracle 10g

    Hi,
    My total datafile size was showing around 100g (physical file size).
    But when actually query dba_segments to see how much tables and indexes are occupying it is coming around max of 30g.
    So how can i reclaim the remaining datafile size.
    As i know the files were extended and i have used some queries but i was unable to reclaim the space.
    Can any one hep me.

    Thanks for all ur suggestions.
    I am using a query to resize
    SELECT
    '/* '||to_char(CEIL((f.blocks-e.hwm)*(f.bytes/f.blocks)/1024/1024),99999999)||' M */ ' ||
    'alter database datafile '''||file_name||''' resize '||CEIL(e.hwm*(f.bytes/f.blocks)/1024/1024)||'M;' SQL
    FROM
    DBA_DATA_FILES f,
    SYS.TS$ t,
    (SELECT ktfbuefno relative_fno,ktfbuesegtsn ts#,
    MAX(ktfbuebno+ktfbueblks) hwm FROM sys.x$ktfbue GROUP BY ktfbuefno,ktfbuesegtsn) e
    WHERE
    f.relative_fno=e.relative_fno and t.name=f.tablespace_name and t.ts#=e.ts#
    and f.blocks-e.hwm > 1000
    ORDER BY f.blocks-e.hwm DESCBut even i resize it more than the given space it will throw an error saying
    ORA-03297: file contains used data beyond requested RESIZE value
    I think the file was extended with lot of free blocks in the middle ,how can make my file size to my actual table size+index size.
    Can anyone help me.

  • Problem while resizing datafiles..

    Hi Experts,
    Im facing problems while resizing my datafiles. I am using Oracle 10g on Windows 2003 server.
    I had a datafile of size 20GB.
    I have 3 schemas sch1, sch2,sch3 and all have objects.
    I dropped sch1 and truncated some tables in sch2.
    I found the freespace available in my datafile 16GB.
    When I try to resize the datafile to 5GB, I am getting ora-03297 error.
    I checked for object that are beyond 5GB using the follwing query.
    I found sch3 objects are present beyond 5GB mark on that datafile.
    How can I resize the datafile to 5GB??
    Is there any other way to resize the datafile?? Please help me.
    SELECT owner, segment_name, segment_type, tablespace_name, file_id,
    ((block_id+1)*(SELECT value FROM v$parameter
    WHERE UPPER(name)='DB_BLOCK_SIZE')+BYTES) end_of_extent_is_at_this_byte
    FROM dba_extents
    WHERE ((block_id+1)*(SELECT value FROM v$parameter
    WHERE UPPER(name)='DB_BLOCK_SIZE')+BYTES) > (<needed size in MB>*1024*
    1024)
    AND tablespace_name='<tablespace_name>'
    ORDER BY file_id, end_of_extent_is_at_this_byte;
    Thanks in advance.

    take a look at the metalink docs...probably coz of high water marks u r not able to do that..
    Note 130866.1 - How to Resolve ORA-03297 When Resizing a Datafile by Finding the Table Highwatermark     
    Note 237654.1 - Resizing a Datafile Returns Error ORA-03297

  • Unable to RESIZE datafile

    I have an issue with resizing a datafile. My USERS tablespace only uses about 9.9MB but the datafile USER01.dbf is 14GB. Per [Tom Kyte|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1065432640718] , I issue column tablespace_name format a20
    column "Name" format a45
    break on file_id skip 1
    ttitle &1
    select file_id, block_id, blocks,
           owner||'.'||segment_name "Name"
    from   sys.dba_extents
    where  tablespace_name = upper('&1')
    UNION
    select file_id, block_id, blocks,
           'Free'
    from   sys.dba_free_space
    where  tablespace_name = upper('&1')
    order by 1,2,3From the spool file
    FILE_ID BLOCK_ID BLOCKS Name
    4 593 8 PLPDF.SYS_IL0000073096C00022$$
    601 8 PLPDF.SYS_LOB0000073096C00025$$
    609 8 PLPDF.SYS_IL0000073096C00025$$
    617 8 PLPDF.PLPDF_ADD_PK
    625 8 PLPDF.PLPDF_TTF_ADD_CW
    *633 16776 Free*
    17409 8 OE8.CUSTOMERS
    17417 56 Free >
    Question is how do I clean the 16776 Free blocks?? OR am I going about this the wrong way??
    Thanks a bunch in advance.
    Edited by: OracleNewbie828 on Aug 24, 2010 10:21 AM
    Sorry ... Forget to mention. It's Oracle 10gR2 on Win2k3*

    The funny thing is that the ability to move data within tablespaces has a lot to do with which version of Oracle you are running but yet you did not tell us that...
    So here are some questions for you...
    1) What version of Oracle do you currently run?
    If 10g then check out http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/schema.htm#ADMIN10161
    2) What types of objects are in the tables within the tablespaces that are supported by these datafiles?
    In particular I am wondering if you use LOBs, because that throws entire new perspective on things.
    Regards
    Tim
    Edited by: Tim Boles on Aug 24, 2010 10:49 AM

  • Lock during resize datafile

    Dear all,
    During the execution of an "ALTER DATABASE DATAFILE <FILE#> RESIZE <SIZE> " query does Oracle puts some kind of a lock on that datafile or make it unavaliable for use (till the resize is complete) ? Or is it just possible to use the datafile normally during the execution of the "ALTER DATABASE" statement ?
    Version : 10.1.0.5
    Windows 2003
    Thanks in advance,
    Regards

    Hi,
    I've personally never experienced issues with datafile resizing, even on systems with 1000's of users with many active sessions. Although you may wish to note in the Oracle 10g documentation regarding ALTER DATABASE datafile clause it states:
    "You can use any of the following clauses when your instance has the database mounted, open or closed, and the files involved are not in use."
    Cheers,
    Stuart.

  • Which is better? Resize datafile or add datafile in same diskgroup.

    Hi All,
    Can you explain which is better option between adding a datafile or resizing one in a diskgroup with 20 disks?
    Regards,
    Avi

    hello buddy,
    Since you know that a small file datafile has a limitation of 32gb then if your tablespace is out of this space then the solution is add more dfiles, also, in my point of view less datafiles in a hughe database is better for evite ckpt contention. The answer is dependo always for your situation!!!
    I hope it helps
    best regards,
    Rodrigo Mufalani
    www.mufalani.com.br

  • ALTER SYSTEM DUMP DATAFILE in 10g

    Hi all,
    When I refered to the the documentation "Oracle Database SQL Reference 10g Release 2 (10.2)"
    to obtain information about the command "ALTER SYSTEM DUMP DATAFILE", I did not see it there.
    Is it obsolete?
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_2013.htm#i2053602
    Actually, when I tested it, I did not see any trace file generated.
    Any guideline is appreciated.

    Which OS are you on?
    However, ALTER SYSTEM DUMP DATAFILE commands works with 10g, no issues.
    Do the following:
    ALTER SESSION SET TRACEFILE_IDENTIFIER = 'DUMPFILE';
    ALTER SYSDATE DUMP DATAFILE 'FILE.DBF' BLOCK 1;
    and now look into your dump you will have file name with prefix as DUMPFILE.
    Jaffar

  • Add or resize datafile

    My db is Oracle 8.1.7. Recently I found one of my tablespace is used about to 80%.
    The tablespace has 3 4g-size-datafile. What should I do ? Add a new datafile or resize the datafiles?
    Which one better?

    Well it depends
    If there are going to be in the single array adding/resize doest not have any difference
    IF you are going to add a file in different disk it can help to reduce I/O but maintenance overhead will arise with number of datafiles
    Virtually you can select anything

  • Resize datafile or add new datafile which is good?

    Hi all
    we have 80 GB database size and only two tablespace have space around 60 Gb
    these two tablespace have one database each around 30 gb so
    My question is it good to resize current datafile or
    It it good to add new datafile ?

    Your question is which is "best"; add datafile or resize right? If yes, then I think below links will answer you :
    http://www.freelists.org/post/oracle-l/Datafile-size-Is-bigger-better,9
    datafile and size
    Bigfile or smallfile tablespace?
    Just go through these link. I am sure answer in it.
    Regards
    Girish Sharma

Maybe you are looking for

  • Photostream for multiple devices sharing the same AppleID

    I have my iPhone 4 setup with PhotoStream to import all my photos to my PC. My wife recently got an iPhone 4S and is using the same AppleID, so all her photos are also imported to the same folder on my PC. This is great and I love the setup. But the

  • Reinstalling OS X on Macbook pro HD

    I' m having some problems fixing my MBP, i'm getting into recovery HD too try to erase the whole HD and reinstal OS X, the disk utility says that it's no possible to unmount the disk, since the current OS X is not booting, i backed up all my importan

  • Macbook pro crashes in sleep mode ALL the time - with LOG. HELP!

    Hi there, My macbook pro 13' intel 2.26 5 GB RAM, currently running Mac Os Lion 10.7.1 constantly crashes when going to sleep mode. This happens regardless of the lid being closed or not. Here's the log from the last crash.. hope it helps anyone givi

  • How to restore my thunderbird account

    I tried to log on to my thunderbird account and it is not there. A window pops up asking me if I want to open a new account, which I did, but all of my saved information is gone. How can I restore the account with all of my saved files? Thanks for yo

  • How to utilize 'Location' in Smart Folders

    I've been trying to make a smart folder that I can use in conjunction with Dropbox, to filter what photos I am yet to upload. I was thinking something along the lines of 'Location is Pictures' and 'Location is not Dropbox' or something similar. Thoug