Reg alter table move statement

Hi friends,
I am having a table with 10GB. i moved the table to the same tablespace using "alter table move" statement.
previously my tablespace had 6 GB freespace. To move the table i resized datafile to increase freespace in tablespace.
after moving, my table size reduced to 8GB. now i want to reduce the datafile size to 6GB again. but its throwing error
ORA-03297: file contains used data beyond requested RESIZE value
Can't i reduce the datafile size to 6GB again?
thanks in advance

resize will not released space below the high water mark.
The simpliest way how to proceed in this case is to move all tables to the new tablespace and drop the original including datafiles. And rename new tablespace back to the old ones name if You want.
You can read some more discussions here:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766625833673

Similar Messages

  • Alter table move in 8.1.7

    I did a alter table move on one of the tables in 8.1.7 database
    before alter table move..
    TABLE_NAME ACTUAL_SIZE_MB CUR_SIZE_MB FRAGMENTATION PROJECTED_SAVINGS_MB
    UDA_ITEM_FF 36.07 328 89 291.93
    after the alter table move..
    TABLE_NAME ACTUAL_SIZE_MB CUR_SIZE_MB FRAGMENTATION PROJECTED_SAVINGS_MB
    UDA_ITEM_FF 57
    why after the alter table move, I am only able to see the current size and not the actual size?
    any inputs welcome

    Handle:  dee
    Status Level:  Newbie (5)
    Registered:  Jun 14, 2010
    Total Posts:  61
    Total Questions:  30 (30 unresolved)
    If its working , Please mark thread as answered why you leave your thread in Open Status

  • In which oracle release alter table move tablespace introduce

    Hi,
    Can you please provide me one information that from which oracle realease oracle introduce alter table move tablespace tablespace_name; ...
    Thanks

    user644122 wrote:
    Hi,
    Can you please provide me one information that from which oracle realease oracle introduce alter table move tablespace tablespace_name; ...
    ThanksDon't know whether it was in Oracle 7, but documentation says that it was in Oracle 8i
    Look at this link:
    http://www.oracle.com/pls/db102/print_hit_summary?search_string=move+tablespace
    By the way, why you need this information?
    Edited by: Kamran Agayev A. on Oct 2, 2009 11:54 PM

  • Options for resize datafile lower than high watermark besid alter table mov

    hello all,
    I have an issue where i am getting ORA-03297 error when trying to resize the datafile. Its becuase of high watermarks. I know i have couple of options...either resize it till the high watermark or Drop or move segments containing extents in this region prior to
    resizing the file....but the situation is this....this a test env...and we have couple of chained rows and doing that(alter table move) will get rid of our chained rows and we do not want that....as we are testing the removal of chained row from our prod systems....as i mentioned we cant do alter table move
    what other options do we have in order to shrink datafile below highwater mark besides moving or droping the segment into a different tablespace as we want to preserve the chianed rows for our testing and making the DB smaller in size (space issue on the server ) ??? any ideas or any thoughts ??
    we are on 10.2.0.3 on AIX system
    i have already went thru these metalink doc .... on that error
    Note 1029252.6 - How to Resize a Datafile
    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

    i am sorry not able to get your question ??
    I want to shrink the space of the Datafile without removing the chaned rows for testing the removal of chianed row for prod. The reason why is becoz of rman backup space issue. If we shrink the datafile our DB will be down to 150GB....and if we cant its about 450GB...which is big difference...and the reason for backup for this dev env is because once we have tested teh removal of chained rows...we will restore it again and re-test it and its a very mission critial system...we need to test this min of 3 times to get teh change approved...thats why...if we have a backup now...we can remove chain rows and then restore it back to this point and test it again...if you know wat i mean

  • Shrink,alter table move

    hi
    This is the scenerio
    a,b,c: distinct blocks
    f:free blocks
    Assume the extent is like:
    aaafffccccbbfb
    after shrink does it become like
    aaabbbccccffff
    or
    aaafffccccbbbf

    Ricardo,
    Both the things are same.They both are used to remove the fragmentation.The way they work may be different but the output of either will be the same.Free space will be on one side only ie after the hight water mark.You do it by move or by shrink,you will end up with the same thing.You put free space anywhere in the scenerio,it will come up to one end only.If it wont than I guess we are back from where we started.
    That said,check back the Oracle doc for both the commands.Also search for the same topic in http://hemantoracledba.blogspot.com/2008/03/alter-table-shrink-space.html
    HTH
    Aman....

  • Reg : internal table & Perform statement

    hi all
         i have 3 internal tables ,
    *     in first internal table i have mark-1 ,*
    *     in 2nd internal table i have mark-2 ,*
    *     using "PERFORM"  i have to add mark 1 & mark 2*
    *     and i need to display the total in  3rd internal table.*
    *     how to do by using "PERFORM" .*
                    Kindly clarify.
    with kind regards
    vel

    Raghupathy is right you just have to write:
    porgram code......
    perform sum_of_tables tables itab1
                                               itab2
                                               itab3.
    program code....
    definition of form:
    form_sum_of_tables tables itab1
                                          itab2
                                          itab3.
    definiton type of witab1, witab2, witab3.
    loop itab1 into witab1.
    loop itab2 into witab2.
    witab3-total = witab1-mark1 plus witab2-mark2.
    append witab3 to itab3.
    endloop.
    endloop.
    endform.
    It will return itab3 which is sum of itab1 and itab2.

  • Small problem in table move

    The base table was created in a DMT and all the partitions were created in LMT.
    Now i want the table also to be in LMT.
    When attempted a move with alter table tablename move tablespace it's giving an error.
    SQL> ALTER TABLE HOLDINGDBO.POSITION_STAGE MOVE TABLESPACE HOLDING_GEN;
    ALTER TABLE HOLDINGDBO.POSITION_STAGE MOVE TABLESPACE HOLDING_GEN
    ERROR at line 1:
    ORA-14511: cannot perform operation on a partitioned object.

    ORA-14511: cannot perform operation on a partitioned object.Of course it can't. The move clause targets a segment. Alas, the top level object (table) here, does not have any segment. Hence you can't move a partitionned table as a whole.
    Instead just look at the alter table move partition statement in TFM.
    e.g.:ALTER TABLE HOLDINGDBO.POSITION_STAGE MOVE PARTITION POS_OLD TABLESPACE HOLDING_PTS_OLD;Regards,
    Yoann.

  • Will alter table table_name move statement change the storage parammeter

    Hi there,
    I have a question about table reorgnization. Will alter table
    table_name move SQL statment change the table's storage parameter
    or keep the same as the original one? If I want to use alter
    table statement to do table defragmentation and change the
    initial and next storage parameter, how will I write this SQL
    statement?
    Thanks in advance.

    Thanks. My table has 5000 extents each of which is 64k, so I
    think I need to do table defragmentation to improve performance.
    If I use alter table table_name move without storage parameter
    and tablespace name, I will relocate this table in current
    tablespace and adopt the current tablespace's storage parameter
    as my table's new storage paramater which is still 64k. After
    that, if I issue alter
    table table_name storage (initial 50M next=50M) command, will it
    change this table's storage parameter and decrease the totoal
    extents number? I ask this question because I use OEM2.2 tuning
    pack reorg wizard to generate the job script to do table
    defragmentation, but in the job script there is no new storage
    parameter. It only generate alter table table_name move
    statement, so I wonder if I don't need to modify this job scripts
    and after it executes this job script, I issue alter table
    table_name storage parameter command manaully. Will this solve
    my problem or I must modify the job script and add new storage
    parameter in the job script?

  • Multiple Alter Table Statements in one batch

    Hi Team,
    We have in one of our upcoming release two columns being added to a table that has over 20 million records and 14 indexes.
    We needed to add two columns to the table both not null (bit). Because it was taking a while to add the columns, we thought that putting these two alter statements in one batch would speed up the operation significantly but to my surprise it did not.
    Conclusion from my test: individual alter statements or batch alter statements take the same time
    Here are me test and results - table Order1 and Order2 are exactly the same structure and data.
    Test case 1:
    ===================
    ALTER TABLE Order1
    ADD OR_N BIT DEFAULT 0 NOT NULL
    go
    ALTER TABLE AccountTradeConfirmation_Alter1
    ADD OR_S BIT DEFAULT 0 NOT NULL
    Go
    Elapsed Time: 2 hrs
                 Mar 18 2015 5:56PM
    (1 row affected)
    Non-clustered index (index id = 3) is being rebuilt.
    Non-clustered index (index id = 4) is being rebuilt.
    Non-clustered index (index id = 5) is being rebuilt.
    Non-clustered index (index id = 6) is being rebuilt.
    Non-clustered index (index id = 7) is being rebuilt.
    Non-clustered index (index id = 8) is being rebuilt.
    Non-clustered index (index id = 9) is being rebuilt.
    Non-clustered index (index id = 10) is being rebuilt.
    Non-clustered index (index id = 11) is being rebuilt.
    Non-clustered index (index id = 12) is being rebuilt.
    Non-clustered index (index id = 13) is being rebuilt.
    Non-clustered index (index id = 14) is being rebuilt.
    (21777920 rows affected)
    Non-clustered index (index id = 3) is being rebuilt.
    Non-clustered index (index id = 4) is being rebuilt.
    Non-clustered index (index id = 5) is being rebuilt.
    Non-clustered index (index id = 6) is being rebuilt.
    Non-clustered index (index id = 7) is being rebuilt.
    Non-clustered index (index id = 8) is being rebuilt.
    Non-clustered index (index id = 9) is being rebuilt.
    Non-clustered index (index id = 10) is being rebuilt.
    Non-clustered index (index id = 11) is being rebuilt.
    Non-clustered index (index id = 12) is being rebuilt.
    Non-clustered index (index id = 13) is being rebuilt.
    Non-clustered index (index id = 14) is being rebuilt.
    (21777920 rows affected)
                 Mar 18 2015 7:52PM
    Test case 2:
    ===================
    ALTER TABLE Order2
    ADD OR_N BIT DEFAULT 0 NOT NULL, OR_S BIT DEFAULT 0 NOT NULL
    go
    2 hrs elapsed time
                 Mar 20 2015 11:10AM
    (1 row affected)
    Non-clustered index (index id = 3) is being rebuilt.
    Non-clustered index (index id = 4) is being rebuilt.
    Non-clustered index (index id = 5) is being rebuilt.
    Non-clustered index (index id = 6) is being rebuilt.
    Non-clustered index (index id = 7) is being rebuilt.
    Non-clustered index (index id = 8) is being rebuilt.
    Non-clustered index (index id = 9) is being rebuilt.
    Non-clustered index (index id = 10) is being rebuilt.
    Non-clustered index (index id = 11) is being rebuilt.
    Non-clustered index (index id = 12) is being rebuilt.
    Non-clustered index (index id = 13) is being rebuilt.
    Non-clustered index (index id = 14) is being rebuilt.
    (21777920 rows affected)
                 Mar 20 2015 1:12PM

    Hi Kiran,
    I have read your response a few times and I was not able to understand your angle. I assume based on the results of my test that Sybase does the following in processing the alter statements
    ALTER TABLE Order2
    ADD OR_N BIT DEFAULT 0 NOT NULL, OR_S BIT DEFAULT 0 NOT NULL
    go
    process alter ADD OR_N BIT
    -- > make copy of table
    ---> alter original table
    --> put data back in
    process alterOR_S BIT
    -- > make copy of table
    ---> alter original table
    --> put data back in
    rebuild index
    my expectation was that it would make a copy of the table only once and process the two alter statements. Also when doing the alter separately (test1) it rebuilt the index twice, however using the batch the index was rebuilt once (at least only one message displayed).
    Regards.

  • Commit after alter table statement or not?

    Hi,
    Is it necessary to put the a commit after the following statement or is it automatically committed:
    Alter table tab_name drop column col_name;
    Thanks

    Khurram,
    Isnt Eric you are , i mean isnt yours synonym :)Erm...simple answer. No. We are not the same person. I just know that Eric, like yourself, makes good contributions to these threads and then someone like that is coming on the forums and trying to make himself look better and put down the regular contributors which isn't really on is it, I think you'll agree.
    CREATE PUBLIC SYNONYM Eric FOR Blushadow;
    hehe.

  • Table compression and alter table statement

    Friends
    I am trying to add columns to a table which is compressed. Since Oracle treats compressed tables as Object tables, I cannot add columns directly so I tried to uncompress table first and then add columns. This doesnt seems to work.
    What could be issue.
    Thanks
    Vishal V.
    Script to test is here and results are below.
    -- Test1 => add columns to uncompressed table -> Success
    DROP TABLE TAB_COMP;
    CREATE TABLE TAB_COMP(ID NUMBER) NOCOMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    -- Test2 =. try adding columns to compressed tables, uncompress it and then try again -> Fails
    DROP TABLE TAB_COMP;
    CREATE TABLE TAB_COMP(ID NUMBER) COMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP move NOCOMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    SQL> -- Test1 => add columns to uncompressed table -> Success
    SQL> DROP TABLE TAB_COMP;
    Table dropped.
    SQL> CREATE TABLE TAB_COMP(ID NUMBER) NOCOMPRESS;
    Table created.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    Table altered.
    SQL>
    SQL> -- Test2 =. try adding columns to compressed tables, uncompress it and then try again -> Fails
    SQL> DROP TABLE TAB_COMP;
    Table dropped.
    SQL> CREATE TABLE TAB_COMP(ID NUMBER) COMPRESS;
    Table created.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables
    SQL> ALTER TABLE TAB_COMP move NOCOMPRESS;
    Table altered.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables

    Which version of oracle you are using?
    1* create table test1234(a number) compress
    SQL> /
    Table created.
    Elapsed: 00:00:00.02
    SQL> alter table test1234 add(b varchar2(200));
    Table altered.
    Elapsed: 00:00:00.02

  • ALTER TABLE vs DROP/CREATE statements

    Hello Everyone,
    I have created a script in order to update our database which includes adding new columns to a table. However, database changes and script generation must now be done using the Erwin data modeler and script generated using a compare option (within Erwin) which compares the model with the actual database.
    I had a script of a few lines with a few ALTER TABLE ...ADD COLUMN statements to add the new columns.
    Now, in Erwin, instead of generating 'ALTER TABLE...ADD COLUMN statements, Erwin has generated an ALTER TABLE...RENAME and CREATE TABLE statements which as a side effect will drop/re-create the table, all of it's indexes, constraints, foreign keys, etc.
    Instead of a few simple "hand written" lines to run a fast script, the script is a few pages long with all of those DROP/CREATE statements, which makes the script way too much complicated and takes much longer to run.
    And this, even though the Erwin option "USE ALTER TABLE ADD COLUMN" statement to create columns.
    I was told that the DROP/CREATE is normal and that this is the way it should be done.
    Am I out of it by thinking that it should use ALTER TABLE ADD COLUMN statements to add new columns to a table and not the DROP/CREATE methodology ? Am I missing something ? Do these new "data thinkers" know something that I am missing ?
    Makes me think of the 80s when people were generating dBase application with the included application generator and were ending up with all kinds of useless and non efficient code.
    Any though on this ? Am I out in the field ?
    Thank you.

    Thank you both for your replies.
    Neil,
    I didn't think that adding new blank columns using the ALTER TABLE ADD COLUMN statement would make the table more fragmented than it already was to begin with.
    I would have think that this kind of maintenance would take place on it's own, outside of a new deployment release.
    I have always used the ALTER TABLE ADD COLUMN instead of the DROP/CREATE TABLE statements to add new columns to a table because of the simplicity, speed and lower risk involved compare to dropping a table and all of it's objects then re-create all of them and doing an import.
    What do any of you do when you need to add new columns to a table ? Use the drop table and re-create or the ALTER TABLE ADD COLUMN ?
    Any comments welcome.
    Thanks again.

  • SAP HANA - How to run alter table statement in HANA procedure?

    I am trying to run alter table statement in a procedure. HANA gives error saying
    SAP DBTech JDBC: [257] (at 1338): sql syntax error: ALTER TABLE is not allowed in SQLScript: line 36 col 8 (at pos 1338)
    How to run alter table statements in procedure?
    Thanks,
    Suren.

    Hi Rich Heilman,
    Thanks for your response.  I have tried with dynamic SQL. I am trying to add partitions to a non portioned table.
    EXECUTE IMMEDIATE 'ALTER TABLE ' || :SCHEMA_NAME || '.TARGET_TABLE PARTITION BY RANGE (TARGET_TYPE_ID) (PARTITION VALUE = 1, PARTITION VALUE = 2, PARTITION VALUE = 3, PARTITION VALUE = 4, PARTITION OTHERS)';
    Execution fails with error
    Could not execute 'CALL PARTITION_TARGET_TABLE('SUREN_TEST')' in 1.160 seconds .
    [129]: transaction rolled back by an internal error:  [129] "SUREN_TEST"."PARTITION_TARGET_TABLE": line 53 col 3 (at pos 2173): [129] (range 3)
    Any reasons for this error?
    Thanks,
    Suren.

  • Performance for ALTER TABLE statements

    Hi,
    I'd like to improve performance for scripts running several ALTER TABLE statements. I have two questions regarding this.
    This is the original code:
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL );
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_INVOICED NUMBER NULL );
    1. Would I gain any performance by making the following changes?
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL,
    QTY_INVOICED NUMBER NULL );
    These columns are later on filled with values and then made NOT NULL.
    2. Would I gain anything by make these columns NOT NULL with a DEFAULT value in the first statement and then later on insert the values?
    /Roland Bali
    null

    1. It wud definitely increase the performance.
    2. You can only have NOT NULL columns added to an existing table if the table is empty.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Roland Bali ([email protected]):
    Hi,
    I'd like to improve performance for scripts running several ALTER TABLE statements. I have two questions regarding this.
    This is the original code:
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL );
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_INVOICED NUMBER NULL );
    1. Would I gain any performance by making the following changes?
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL,
    QTY_INVOICED NUMBER NULL );
    These columns are later on filled with values and then made NOT NULL.
    2. Would I gain anything by make these columns NOT NULL with a DEFAULT value in the first statement and then later on insert the values?
    /Roland Bali<HR></BLOCKQUOTE>
    Naveen

  • Alter Table Statements in Designer

    Hi Guys,
    Just wondering if anyone knows if it's possible to store Alter Table statements in Designer 9i?
    Anton

    Hi,
    The designer generate alter statements for you.
    e.g You have a table emp with empno number(8) in designer and in your application database. You cahnged empno to number(12) in designer. Generate ddl pointing to your application database. Designer generate an ALTER table script for you.

Maybe you are looking for

  • NPROC:Dependent requirement not getting generated

    Hi Experts, We have an issue wherein we have Depedent requirement for a HALB material against FERT material requirement.But, the MD04 screen of HALB material doesn't show any Dependent requirement. Infact, the MD04 screen of the FERT material shows N

  • Maverick 10.9.2 upgrade facetime camera not working any more

    Hei After upgrading to maverick 10.9.2 on my iMac 2009, the camera was not found in Facetime and all other products using the camera, like skype. I phoned apple support, but the guy told me that the camera was defect or I had to re-installed maverick

  • IDOC to FILE doubt

    hi, I am doing IDOC to FILE scenario. and I have imported MATMAS.MATMAS05 to IR and Mapped the following fields to the target  message type MaterialNumber MaterialType IndustrySector MaterialGroup OrderUnit NameWhoChanged Please explain me the follow

  • RFC with Multilevel Hierarchy call from Server Proxy

    Dear Experts, We would like to call BAPI inside a server proxy. PI has created an interface structure exactly identical as the BAPI structure, but while generating ABAP proxy, system has added additional controller structure for each hierarchy. Now o

  • How can I get a new phone while under a contract?

    I got my iPhone 5c in December 2013 and had to get the screen replaced about 4 months ago. It was not fixed by apple. 2 months ago it dropped again and only the top of the phone smashed, though there were no problems and the camera could still be use