Alter table modify lob shrink space hangs despite ddl_lock_timeout

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
The following command hangs despite session parameter ddl_lock_timeout being set to 0:
alter table <table> modify lob (<column>) (shrink space);
Data type of <column> is CLOB. In another session a transaction on <table> is open, with a simple update on a different (non-LOB) column.
Looks like a bug to me, but have no access to metalink for confirmation/SR submission and would appreciate any comments/help on this issue.

From Oracle 11 documentation ( http://docs.oracle.com/cd/B28359_01/server.111/b28310/schema003.htm#CBBBIADA )
"Segment shrink is an online, in-place operation. DML operations and queries can be issued during the data movement phase of segment shrink."
Simon

Similar Messages

  • Impact to production if I shrink space on table...

    Hello experts.
    I am running Oracle 11.2 and saw in OEM that I have a table that is candidate for shrinking space.
    According to OEM, I can gain 5G by shrinking the table.
    The table is 16G, so if I shrink the table, then it should reduce to approx. 11G, right?
    This table is the primary table used by our application, so impact to production is very important.
    Okay, so I'm wondering what the impact to production is on the table while I shrink the space on the table.
    I am testing it now in my test environment.
    First, I found I had a function based index which has to be dropped before I can shrink the table.
    So I ran dbms_metadata to get the syntax to recreate the FBI, then dropped the FBI.
    Next, i ran alter table owner.tablename enable row movement;
    Then, I ran alter table owner.tablename shrink space cascade;
    While I am running the shrink table command, I opened another session and I queried the table and even did updates on the table.
    I was quite surprised in that the table is not locked and is still accessible for update and select statements.
    In fact, I do not see any noticeable impact by the shrink table command.
    Obviously, I am not in the production environment with hundreds of concurrent users, but my question is what kind of impact should I expect to see if I do this in production with people hitting this table? (No, this is not an IOT.)
    Any ideas?
    Edited by: 974632 on Feb 19, 2013 5:54 AM
    NOTE: The table shrink command took: Elapsed: 00:43:17.19
    Recreating the function based index took: Elapsed: 00:00:28.80

    Uwe Hesse wrote:
    What you observe is standard behavior.
    A potential impact comes from the massive internal DELETE & INSERT during the shrink operation.
    Will generate lots of redo & undo therefore.
    That's is not necessarily a problem, though.
    Kind regards
    Uwe Hesse
    "Don't believe it, test it!"
    http://uhesse.com
    Uwe,
    Correct me if I'm wrong, but my thought on reading the OP is that he could very well see a performance degradation during the shrink operation, but I'd also expect to see some overall improvement after the operation due to a large decrease in the number of blocks that would have to be scanned during any FTS, and possibly some cascading of that effect back through any indexes on that table.

  • Delete AUD$ table do not free space

    Hi,
    We have an Oracle 10g database (10.2.0.4) with the Oracle auditing feature on.
    Our problem is that I delete on regular basis the AUD$ rows, but the system do not free the space on the tablespace. The system free the space only after a truncate.
    The actual situation is:
    SQL> select segment_name,bytes/1024/1024 as Mb from dba_segments where bytes/1024/1024 > 1000 and TABLESPACE_NAME='SYSTEM';
    SEGMENT_NAME                                                                              MB
    AUD$                                                                                             10161
    SQL> select count(*) from sys.aud$;
    COUNT(*)
    +1073+
    Someone can help me with this!?
    The delete of the table is done with a simple script:
    select count(*) from sys.aud$;
    delete from sys.aud$ where NTIMESTAMP# < sysdate -(1/24*6);
    select count(*) from sys.aud$;
    commit;
    exit;
    Thanks
    Nunzio

    Nunzio Cafarelli wrote:
    EdStevens wrote:
    Nunzio Cafarelli wrote:
    Hi,
    thanks for your answer.
    The scrink and the coalesce feature do not works:
    SQL> alter table SYS.AUD$ enable row movement;
    alter table SYS.AUD$ shrink space;
    alter table SYS.AUD$ coalesce;
    Table altered.
    SQL> SQL> alter table SYS.AUD$ shrink space
    ERROR at line 1:
    ORA-10635: Invalid segment or tablespace type
    SQL> SQL> alter table SYS.AUD$ coalesce
    ERROR at line 1:
    ORA-01735: invalid ALTER TABLE optionthe only way I have is to move the table in a different tablespace and in case move back.
    Do you know if that is a know bug!?No it is not a bug.
    Why are you concerned about the space being released? If it were you'd just have to re-aquire it as new rows are added to the table.
    As rows are added, when an extent is filled a new extent is allocated. If rows are deleted those extents remain allocated to the table and are re-used as needed. The aud$ table is a perfect example of a table which most definately will need to reuse that space, so it it a total waste of effor to try to reclaim it.Hi, that is the real point, it seems that the table don't use the allocated space.
    It constantly grows and reclaim new space. That is the real problem for me.You haven't demonstrated that. You only showed us a one-time snapshot of the space used and the row count.
    You need to track this over several days / iterations of deleting rows. Show us that over a period of time the row count is fairly stable and yet the space used continues to increase.
    If, today the rowcount is 'x' and the space allocated (measured in blocks or extents) is 'y', and you delete a bunch (or even all) rows, space allocated should remain 'y'. Then tomorrow, you should have near 'x' rows again (assuming a fairly level amount of audited activity). And space allocated should still be 'y' .. maybe allowing for a slight increase in 'x' triggering one more extent. But if you are regularly pruning the row count, the number of extents should stabilize. If not, then you do have an issue, but I haven't yet seen proof of that happening.
    >
    >>
    Can this create problems since AUD$ is a system table!?No, but you don't want a very active table like that in your SYSTEM tablespace. Oracle puts it there by default, but there have been well known procedures on the net for YEARS on how to move it to another TS. Thanks
    With 11g, they've even introduced the dbms_audit_management package to help with these tasks.I know, I hope the my customer will authorize the upgrade soon.
    Thanks for your suggestion to upgrade sybrand_b, but as you can understand, sometime the upgrade are not possible until the software vendor will authorize that, so, we need to work on version 10.2.0.4 for some other months.
    Regards
    Nunzio
    P.S. I think that there are problems, after the move of the table to a different tablespace, and the move back to SYSTEM, the used space was around 2Gb, but I was not able to resize the datafile. Don't move it back. Get it out of SYSTEM and leave it there.I think that I'll do this, at least to not risk the corruption of the system tablespace.
    Thanks again for your answers.
    regards
    Nunzio

  • Shrink table with LOB column

    Hello,
    I have a table with 1.000.000 BLOB records. I updated almost a half of the records with NULL. Now I try to reclaim the free space using:
    ALTER TABLE table MODIFY LOB (column) (SHRINK SPACE);
    It's still running from some time, but what I am surprised about is that this operation generates a lot of redo logs (the full table had 30Gb, after the update it should have 15Gb, and by now I already have about 8Gb of generated archive logs).
    Do you know why this operation generates redo logs?
    Thank you,
    Adrian

    The REDO stream that Oracle generates is full of physical addresses (i.e. ROWIDs). If you run an update statement
    UPDATE some_table
      SET some_column = 4
    WHERE some_key = 12345;Oracle actually records in the REDO the logical equivalent of
    UPDATE some_table
      SET some_column = 4
    WHERE ROWID = <<some ROWID>>That is, Oracle converts your logical SQL statement into a series of updates to a series of physical addresses. That's a really helpful thing if the REDO has to be re-applied at a later date because Oracle doesn't have to do all the work of processing the logical SQL statement again (this would be particularly useful if your UPDATE statement were running a bunch of queries that took minutes or hours to return).
    But that means that if you are physically moving rows around, you have to record that fact in the redo stream. Otherwise, if you had to re-apply the redo information (or undo information) in the future, the physical addresses stored in the redo logs may not match the physical addresses in the database. That is, if you move the row with SOME_KEY = 12345 from ROWID A to ROWID B and move the row with SOME_KEY = 67890 from ROWID C to ROWID A, you have to record both of those moves in the redo stream so that the statement
    UPDATE some_table
      SET some_column = 4
    WHERE ROWID = <<ROWID A>>updates the correct row.
    Justin

  • Is alter table shrink space a logged operation?

    Hello -
    I am running alter table xxxxxx shrink space. I have a few questions:
    1. Is this a logged operation? Oracle handles this interanally as insert/delete operations, but I am not seeing more arch logs being generated.
    2. If I stop in the middle of the shrink process, can Oracle resume where it left off?
    3. How can I monitor the progress of the shrink operation? I am not seeing the sid, serial# in v$session_longops.
    Any help is much appreciated!
    Thanks,
    mike

    I'm not sure that you will be able to "monitor" it.
    You could test using dbms_space to see if it shows any changes will the shrink is in progresss.
    One other way would be to watch V$TRANSACTION USED_UREC (which will reflect counts for rows and index entries) to see USED_UREC approaching the expected number of table+index entries being rebuilt.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Alter SHRINK SPACE in oracle 10g

    Hello,
    My table PRICE_T table gets deleted and inserted almost 50 million records everyday.
    Now it takes too much time to perform this operation because of TABLE fragmented.
    i can use "CREATE table as select” option to remove fragmentation from table.
    but i dont want to use this option.
    so i hv tried ALTER TABLE SHRINK SPACE as i m using ORACLE 10g
    alter table price_t enable row movement;
    alter table price_t shrink space
    alter table price_t disable row movement;
    and i have applied following query to check table gets remove free space but still having free space after applying ALTER SPACE COMMAND
    select table_name,round((blocks*8),2)||'kb' "size1",round((num_rows*avg_row_len/1024),2)||'kb' "size"
    from DBA_tables
    where table_name = 'PRICE_T';
    Tablespace in PRICE_T table fall into is SEGMENT SPACE MANAGEMENT AUTO
    please help me to remove fragmentation from table using SHRINK command.
    Thanks.

    Now it takes too much time to perform this operation because of TABLE fragmented.How do you define "fragmented"?
    Why do you believe that your table is fragmented?
    Why do you believe that the fragmentation is causing performance problems?
    select table_name,
           round((blocks*8),2)||'kb' "size1",
           round((num_rows*avg_row_len/1024),2)||'kb' "size"
      from DBA_tables
    where table_name = 'PRICE_T'; - What is the output of this query before and after you shrink the table?
    - Are your statistics up to date? NUM_ROWS, BLOCKS and AVG_ROW_LENGTH provide information to the optimizer-- they are estimates gathered when object statistics are gathered. They are not maintained by Oracle in real time and may be substantially out of date.
    - I don't see any attempt to account in this query for overhead like PCTFREE.
    - Is there a reason that you aren't using the DBMS_SPACE package? This query seems highly suspect.
    Justin

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

  • Alter Table Space Autoextend

    Hi,
    I got an Error like this
    "ORA-01630 max # extents (string) reached in temp segment in tablespace string
    Cause: A temporary segment tried to extend past MAXEXTENTS."
    Is it possible to alter table space to Auto Extend in Oracle 8i With out Shutting down the
    Database. What Exact Commands for this? Is this effect the performance of the database?
    Please reply
    With thanks Naseer

    user13098327 wrote:
    Hi,
    I got an Error like this
    "ORA-01630 max # extents (string) reached in temp segment in tablespace string
    Cause: A temporary segment tried to extend past MAXEXTENTS."
    Is it possible to alter table space to Auto Extend in Oracle 8i With out Shutting down the
    Database. What Exact Commands for this? Is this effect the performance of the database?
    Please reply
    With thanks NaseerThe error you hit and your request is something different:
    ORA-01630 - limitation of extents per object or per tablespace.
    Tablespace autoextend - May be you mean datafile autoextend option.
    Pls, specify.

  • ALTER TYPE MODIFY ATTRIBUTE cascade including table data

    Hi,
    does anybody know, why I get "ORA-00932: inconsistent datatypes: expected REF TYPE1_T got REF TYPE1_T"
    after ALTER TYPE MODIFY ATTRIBUTE cascade including table data when the altered type contains a nested table of type REFs.
    according to the documentation this should work? This works when the type contains a nested table of types!
    ORACLE Version: 9i EE 9.2.0.3.0 64 bit
    OS: HP-UX 11
    -- create type1
    CREATE OR REPLACE
    TYPE TYPE1_T AS OBJECT
    T1COL1 NUMBER,
    T1COL2 VARCHAR2(35),
    TYPE2REF REF TYPE2_T
    -- create coll of type1 refs
    CREATE OR REPLACE
    type TYPE1COLL_T IS TABLE OF REF TYPE1_T
    -- create type2
    CREATE OR REPLACE
    TYPE TYPE2_T AS OBJECT
    T2COL1 NUMBER,
    TYPE1COLL TYPE1COLL_T
    -- create table of type1_t
    CREATE TABLE TYPE1_OTB OF TYPE1_T
    -- create table of type2_t
    CREATE TABLE TYPE2_OTB OF TYPE2_T
    nested table type1coll store as type1coll_ntb
    -- populate type1_otb
    INSERT INTO type1_otb
    VALUES(1, 'ABCDEF',NULL);
    -- populate type2_otb
    INSERT INTO type2_otb
    VALUES(1,TYPE1COLL_T());
    select * from type1_otb;
    T1COL1 T1COL2
    TYPE2REF
    1 ABCDEF
    select * from type2_otb;
    T2COL1
    TYPE1COLL
    1
    TYPE1COLL_T()
    ALTER TYPE type1_t MODIFY ATTRIBUTE t1col2 varchar2(50) cascade including table data;
    Type altered.
    select * from type1_otb;
    T1COL1 T1COL2
    TYPE2REF
    1 ABCDEF
    select * from type2_otb;
    select * from type2_otb
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected REF TYPE1_T got REF TYPE1_T

    Hi John,
    I am also facing the same problem after executing the command
    SQL> alter type product_object modify attribute (NAME VARCHAR2(80)) cascade;
    with the following error
    ORA-00932: inconsistent datatypes: expected REF WOLFOBJECTS.EMPLOYEE_OBJECT got
    WOLFOBJECTS.EMPLOYEE_OBJECT
    Could you please suggest any alternate or workaround for this issue?
    Thanks
    Sara

  • Alter Table Problem/Hang

    I'm using oracle9i on windows 2000/NT.
    All the DDL Commands(alter table,drop table etc..) result in hanging of the session.
    On restarting the oracle instance the command starts working. But only for sometime. We reinstalled oracle for 2-3 time and on different servers. But the problem persists. What could be reason/solution for this.

    No, you cannot avoid the recompiles. An ALTER TABLE changes the structure of the table and all dependent objects have to be recompiled -- the dependent objects
    are set to status INVALID. The RDBMS does do an implicit
    compile when an INVALID View/Package/Procedure is invoked but, occassionally, with a long list of dependencies and cross-dependencies, it may fail to compile an object.
    Use DBA_DEPENDENCIES to identify dependencies.
    Hemant

  • Problem with alter table in execute immediate

    We have PL/SQL scripts which modify the data structure, add data etc to en existing database. These scripts basically ensure that the db is compatible with what the software expects.
    The reason for doing it in PL/SQL rather than SQL script is A) The scripts are launched using GUI so that they are more user friendly. sqlplus is launched as a background process which executes these scripts. All the scripts have EXIT FAILURE WHENEVER SQLERROR as first line to ensure that the control does not hang in the sqlplus background process.
    Going from one version to other, we have added a few tables to the database and also modified a few tables. since (i think) DDL is not allowed in PL/SQL block, we had to resort to putting them in EXECUTE IMMEDIATE enclosures.
    Now for the real question,
    If I create a table using EXECUTE IMMEDIATE clause, I can immediately have insert as a next statement to insert data in this table. but, if I alter the table and add a column to the existing table, I cannot immediately add data to that column, it throws an error saying 'invalid identifier'
    At code level, the following is allowed :
    EXECUTE IMMEDIATE 'CREATE TABLE SP_TEST_TABLE
                             ID     NUMBER,
                             NAME     Varchar2(40)
    INSERT INTO SP_TEST_TABLE(ID, NAME) Values(1, 'SP');
    but I get error for the following :
    EXECUTE IMMEDIATE 'ALTER TABLE SP_TEST_TWO ADD
                        ANOTHER_COLUMN     number
    UPDATE     SP_TEST_TWO SET          ANOTHER_COLUMN = 1;
    In this case, it says ANOTHER_COLUMN invalid identifier
    Does anybody know why?
    any workaround will be greatly appreciated.
    --SP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Friends,
    Thanks to all of you for your help. The spelling mistakes might have occurred becuase i changed the actual script to something 'short and complete' to show the problem.
    I could solve the problem by having more than one PL/SQL block within my file. something like :
    BEGIN
    --alter table statements here
    END;
    BEGIN
    --insert the values in column here.
    END;
    I am still not sure why the error is presented only on alter table statement and not for create table statement. Probably somebody with the knowledge of oracle internals will be able to throw more light on it. I am trying to get the naswers, if I get the answer, I'll surely post it here.
    Regards,
    --Saurabh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Alter  Table 's Tablespace

    Dear All ,
    I have 10g database on rehl5 .I move table's(T_TRANSACTION_TABLE) tablespace(USERS) to tablespace (IMAGES) .
    It completed successfully
    MY command is
    ALTER TABLE USERS MOVE TABLESPACE IMAGES
    and
    ALTER INDEX USERS REBUILD TABLESPACE IMAGES
    Problem is transaction_images table show using table space IMAGES but store data in USERS table space .
    I check this using em->administrator->schema->Table
    and i also check DBA_SEGMENT,DBA_EXTENTS both are show tablespace USERS
    Note :- 1) This table contain BLOB column for save image .
    2) I am also rebuild index also.
    Thanks in advance
    Shaikh Abdul Moyed

    A LOB (CLOB or BLOB) can be stored in a different tablespace than the rest of the table. Are you certain that you're looking at the tablespace for the table segment rather than the LOB segment?
    If you want to move the LOB segment to a different tablespace
    ALTER TABLE <<table name>>
      MOVE LOB( <<name of BLOB column>> )
      STORE AS( TABLESPACE <<new tablespace>> )Additionally, I'm a bit confused by the DDL you posted
    ALTER TABLE USERS MOVE TABLESPACE IMAGES
    ALTER INDEX USERS REBUILD TABLESPACE IMAGESYou use USERS as a table name and as an index name in these DDL statements. But then you later talk about the USERS tablespace. I'm guessing that you really put the table name (TRANSACTION_IMAGES) in the ALTER TABLE command and that you used the correct index name in your ALTER INDEX.
    Justin

  • 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 space of datafile

    Oracle 11.1.0.7:
    I need to give some space back to the storage. I am trying to figure out what process should I follow to shrink the datafiles and drop the datafiles.
    1. Should I first do shrink space on tablespace and then drop few datafiles?
    2. How do I know how much space can be shrunk?
    3. How do I know if after shrinking which datafiles are ready for drop?
    Is there any other better way?

    I"ve just gone through a very similar procedure.
    First i had to identify the high water mark in each datafile, and then shrink it back to that or just above that value.
    NOTE: It's best to do this when your DB is not in use, specifically growing or if it is some of the commands might fail saying that there is data beyond that size.
    Now most likely your data is spread across the datafiles in some sort of "optimal" way by oracle, so it's unlikely that you'll be able to get any "clean" datafiles that you can just drop.
    So what i did was to create a new tablespace big enough to hold the objects, MOVED the tables and REBUILT the indexes in the new TS.
    Now one option here is to just keep the new TS's and drop the old ones, if needed you can even rename your tablespace (10g and above)
    ALTER TABLESPACE old_ts RENAME TO new_ts;
    However, you must follow the rules when renaming a tablespace (also need to separetly rename the df if you want to keep your naming standard) :
    You cannot rename the SYSTEM or SYSAUX tablespaces.
    You cannot rename an offline tablespace.
    You cannot rename a tablespace that contains offline datafiles.
    Here we wanted to keep the file names locations so i ended up copying everything back into the originals, but before i did that , i could querried dba_segments to get the minimum size required, and I then I shrunk and dropped the datafiles in the original TS as appropriate.
    To get the hight water mark, i used this script :
    SELECT 'ALTER DATABASE DATAFILE ''' || FILE_NAME || ''' RESIZE ' || HWMM || ';' CL_DYN_SQL
    FROM (
    SELECT DF.FILE# FILE_ID, DF.NAME FILE_NAME, NVL(DFD.MAX_BLOCK_COUNT,1)*DF.BLOCK_SIZE HWM,
    DECODE(SIGN((1024)-(CEIL(NVL(DFD.MAX_BLOCK_COUNT,1)*DF.BLOCK_SIZE/(1024*1024)))),
              1,1024, CEIL(NVL(DFD.MAX_BLOCK_COUNT,1)*DF.BLOCK_SIZE/(1024*1024))) || 'M' HWMM,
              DF.BYTES
    FROM V$DATAFILE DF, V$TABLESPACE TS,
    SELECT FILE_ID, MAX(BLOCK_ID+BLOCKS-1) MAX_BLOCK_COUNT
              FROM DBA_EXTENTS DE
              WHERE DE.TABLESPACE_NAME IN ('TS_D', 'TS_I')
              GROUP BY FILE_ID
    ) DFD          
    WHERE DF.FILE# = DFD.FILE_ID (+)
    AND DF.TS# = TS.TS#
    AND TS.NAME IN ('TS_D', 'TS_I')
    WHERE HWM < BYTES
    ORDER BY 1;

  • Alter Table Add column not null default value

    I want to add two columns to a table with not null and default as 0 for both columns
    Can i write the whole in one statement or do i have to split statement
    I tried this, but didn't work
    alter table DWSODS01.DWT00301_ORD_DTL_OMS add (
    COMB_ORD_FLG NUMBER(5,0) default 0 not null,
    COMB_ORD_NO NUMBER(12,0)
    default 0 not null);
    How can i modify the code?

    user10390682 wrote:
    I tried this, but didn't workSince you are specifying default values, it should work (regardless if table DWSODS01.DWT00301_ORD_DTL_OMS is empty or not):
    SQL> select count(*) from emp1
      2  /
      COUNT(*)
            14
    SQL> alter table emp1 add (
      2  COMB_ORD_FLG NUMBER(5,0) default 0 not null,
      3  COMB_ORD_NO NUMBER(12,0)
      4  default 0 not null);
    Table altered.
    SQL> desc emp1
    Name                                      Null?    Type
    EMPNO                                              NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    COMM                                               NUMBER(7,2)
    DEPTNO                                             NUMBER(2)
    COMB_ORD_FLG                              NOT NULL NUMBER(5)
    COMB_ORD_NO                               NOT NULL NUMBER(12)
    SQL> What error are you getting?
    SY.

Maybe you are looking for