Drop column in a big table.

Hi all,
I need to drop a column in a table (Oracle Version is 9iR2). This table contains approximately 2 000 000 000 records, each record is about 41 bytes length.
The column I need to drop represents un varchar(10), i.e. about 25% of a line size.
Because this operation is going to be very long, I would like to ask for the best way to proceed :
- should I previously set all values to null before the drop ?
- should I drop indexes on the table (there are 5 bitmap indexes but none on the column to drop).
- should I set some specific values to TEMP_TBS or UNDO_TBS before I proceed ?
- are there any other tips to know to achieve this goal ?
Thanks to all in advance.
Gael

user1368644 wrote:
Hi all,
I need to drop a column in a table (Oracle Version is 9iR2). This table contains approximately 2 000 000 000 records, each record is about 41 bytes length.
The column I need to drop represents un varchar(10), i.e. about 25% of a line size.
Because this operation is going to be very long, I would like to ask for the best way to proceed :
- should I previously set all values to null before the drop ?I can't see any reason to do that
- should I drop indexes on the table (there are 5 bitmap indexes but none on the column to drop).this should not be necessary if the indexes do not contain the column to be dropped
- should I set some specific values to TEMP_TBS or UNDO_TBS before I proceed ?Not sure.
- are there any other tips to know to achieve this goal ? There are actually a couple of ways do do this. You can drop the column in place, or cheat by copying the old table to a new one withouth the column. The sheer size of your table probably makes the second method impractical, not to mention having to recreate indexes, triggers, etc.

Similar Messages

  • Drop column from compressed partitioned table

    Hi,
    DB version is 11.2.02.
    We have table which is range partitioned and sub-partitioned by list.
    Table is also compressed.
    When I try to drop a column, I get error.
    CREATE TABLE DWH_REP.P_RATING (
      id_source$                 NUMBER(38,0)  NULL,
      time_insert$               DATE          ,
      time_update$               DATE          ,
      FLG_CURRENT$               NUMBER(38,0)  ,
      FLG_CHANGED$               NUMBER(38,0)  ,
      id_audit$                  NUMBER(38,0)  ,
      ID_DATE_PSTING             NUMBER(38,0)  ,
      partner_rating_id          VARCHAR2(256) ,
      partner_id                 VARCHAR2(256) ,
      id_partner                 NUMBER(38,0)  , 
      rating_system_id           VARCHAR2(256) ,
      rating_id                  VARCHAR2(256) ,
      date_rating                DATE          ,
      date_follow_up             DATE          ,
      risk_team_id               VARCHAR2(256) ,
      risk_team_descr            VARCHAR2(256) ,
      risk_team_changed_id       VARCHAR2(256) ,
      risk_team_changed_descr    VARCHAR2(256) ,
      date_risk_team_changed     DATE          ,
      assignment_id              VARCHAR2(256) ,
      date_assignment            DATE          ,
      date_assignment_confirmed  DATE          ,
      date_assignment_expiration DATE          ,
      flg_exception              VARCHAR2(256) ,
      exception_id               VARCHAR2(256) ,
      date_exception             DATE         
    -- TABLESPACE DWH_REP_DATA
    PARTITION BY RANGE (FLG_CURRENT$, ID_DATE_PSTING)
       SUBPARTITION BY LIST (ID_SOURCE$)
       (PARTITION P_RATING_2010               
           VALUES LESS THAN (0, 20110101)
           SUBPARTITION P_RATING_2010_UCS VALUES  (10) TABLESPACE DWH_O_2010_TBS,
           SUBPARTITION P_RATING_2010_UCM VALUES (11) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_ORBI30 VALUES  (30) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_ORBI31 VALUES  (31) TABLESPACE DWH_O_2010_TBS,
           SUBPARTITION P_RATING_2010_CETELEM VALUES  (40) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_MILES VALUES  (60) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_BHI VALUES  (80) TABLESPACE DWH_O_2010_TBS,
           SUBPARTITION P_RATING_2010_DF VALUES  (DEFAULT) TABLESPACE DWH_O_2010_TBS),   
         PARTITION P_RATING_2011            
           VALUES LESS THAN (0, 20120101)
           SUBPARTITION P_RATING_2011_UCS VALUES (10) TABLESPACE DWH_O_2011_TBS,
           SUBPARTITION P_RATING_2011_UCM VALUES (11) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_ORBI30 VALUES (30) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_ORBI31 VALUES (31) TABLESPACE DWH_O_2011_TBS,
           SUBPARTITION P_RATING_2011_CETELEM VALUES (40) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_MILES VALUES (60) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_BHI VALUES (80) TABLESPACE DWH_O_2011_TBS,
           SUBPARTITION P_RATING_2011_DF VALUES (DEFAULT) TABLESPACE DWH_O_2011_TBS),
        PARTITION P_RATING_current           
           VALUES LESS THAN (maxvalue, maxvalue)
           SUBPARTITION P_RATING_CUR_UCS VALUES (10) TABLESPACE DWH_O_CRT_UCS_TBS,
           SUBPARTITION P_RATING_CUR_UCM VALUES (11) TABLESPACE DWH_O_CRT_UPM_TBS,
    --     SUBPARTITION P_RATING_CUR_ORBI30 VALUES (30) TABLESPACE DWH_O_CRT_ORBI30_TBS,
    --     SUBPARTITION P_RATING_CUR_ORBI31 VALUES (31) TABLESPACE DWH_O_CRT_ORBI31_TBS,
           SUBPARTITION P_RATING_CUR_CETELEM VALUES (40) TABLESPACE DWH_O_CRT_CETELEM_TBS,
    --     SUBPARTITION P_RATING_CUR_MILES VALUES (60) TABLESPACE DWH_O_CRT_MILES_TBS,
    --     SUBPARTITION P_RATING_CUR_BHI VALUES (80) TABLESPACE DWH_O_CRT_BHI_TBS,
           SUBPARTITION P_RATING_CUR_DF VALUES (DEFAULT) TABLESPACE DWH_O_CRT_DF_TBS))
    ENABLE ROW MOVEMENT
    NOLOGGING
    COMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    ALTER TABLE DWH_REP.P_RATING DROP COLUMN ID_PARTNER;
    ORA-39726: unsupported add/drop column operation on compressed tables

    littleboy wrote:
    Hi,
    DB version is 11.2.02.
    We have table which is range partitioned and sub-partitioned by list.
    Table is also compressed.
    When I try to drop a column, I get error.
    CREATE TABLE DWH_REP.P_RATING (
    id_source$                 NUMBER(38,0)  NULL,
    time_insert$               DATE          ,
    time_update$               DATE          ,
    FLG_CURRENT$               NUMBER(38,0)  ,
    FLG_CHANGED$               NUMBER(38,0)  ,
    id_audit$                  NUMBER(38,0)  ,
    ID_DATE_PSTING             NUMBER(38,0)  ,
    partner_rating_id          VARCHAR2(256) ,
    partner_id                 VARCHAR2(256) ,
    id_partner                 NUMBER(38,0)  , 
    rating_system_id           VARCHAR2(256) ,
    rating_id                  VARCHAR2(256) ,
    date_rating                DATE          ,
    date_follow_up             DATE          ,
    risk_team_id               VARCHAR2(256) ,
    risk_team_descr            VARCHAR2(256) ,
    risk_team_changed_id       VARCHAR2(256) ,
    risk_team_changed_descr    VARCHAR2(256) ,
    date_risk_team_changed     DATE          ,
    assignment_id              VARCHAR2(256) ,
    date_assignment            DATE          ,
    date_assignment_confirmed  DATE          ,
    date_assignment_expiration DATE          ,
    flg_exception              VARCHAR2(256) ,
    exception_id               VARCHAR2(256) ,
    date_exception             DATE         
    -- TABLESPACE DWH_REP_DATA
    PARTITION BY RANGE (FLG_CURRENT$, ID_DATE_PSTING)
    SUBPARTITION BY LIST (ID_SOURCE$)
    (PARTITION P_RATING_2010               
    VALUES LESS THAN (0, 20110101)
    SUBPARTITION P_RATING_2010_UCS VALUES  (10) TABLESPACE DWH_O_2010_TBS,
    SUBPARTITION P_RATING_2010_UCM VALUES (11) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_ORBI30 VALUES  (30) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_ORBI31 VALUES  (31) TABLESPACE DWH_O_2010_TBS,
    SUBPARTITION P_RATING_2010_CETELEM VALUES  (40) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_MILES VALUES  (60) TABLESPACE DWH_O_2010_TBS,
    --     SUBPARTITION P_RATING_2010_BHI VALUES  (80) TABLESPACE DWH_O_2010_TBS,
    SUBPARTITION P_RATING_2010_DF VALUES  (DEFAULT) TABLESPACE DWH_O_2010_TBS),   
    PARTITION P_RATING_2011            
    VALUES LESS THAN (0, 20120101)
    SUBPARTITION P_RATING_2011_UCS VALUES (10) TABLESPACE DWH_O_2011_TBS,
    SUBPARTITION P_RATING_2011_UCM VALUES (11) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_ORBI30 VALUES (30) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_ORBI31 VALUES (31) TABLESPACE DWH_O_2011_TBS,
    SUBPARTITION P_RATING_2011_CETELEM VALUES (40) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_MILES VALUES (60) TABLESPACE DWH_O_2011_TBS,
    --     SUBPARTITION P_RATING_2011_BHI VALUES (80) TABLESPACE DWH_O_2011_TBS,
    SUBPARTITION P_RATING_2011_DF VALUES (DEFAULT) TABLESPACE DWH_O_2011_TBS),
    PARTITION P_RATING_current           
    VALUES LESS THAN (maxvalue, maxvalue)
    SUBPARTITION P_RATING_CUR_UCS VALUES (10) TABLESPACE DWH_O_CRT_UCS_TBS,
    SUBPARTITION P_RATING_CUR_UCM VALUES (11) TABLESPACE DWH_O_CRT_UPM_TBS,
    --     SUBPARTITION P_RATING_CUR_ORBI30 VALUES (30) TABLESPACE DWH_O_CRT_ORBI30_TBS,
    --     SUBPARTITION P_RATING_CUR_ORBI31 VALUES (31) TABLESPACE DWH_O_CRT_ORBI31_TBS,
    SUBPARTITION P_RATING_CUR_CETELEM VALUES (40) TABLESPACE DWH_O_CRT_CETELEM_TBS,
    --     SUBPARTITION P_RATING_CUR_MILES VALUES (60) TABLESPACE DWH_O_CRT_MILES_TBS,
    --     SUBPARTITION P_RATING_CUR_BHI VALUES (80) TABLESPACE DWH_O_CRT_BHI_TBS,
    SUBPARTITION P_RATING_CUR_DF VALUES (DEFAULT) TABLESPACE DWH_O_CRT_DF_TBS))
    ENABLE ROW MOVEMENT
    NOLOGGING
    COMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    ALTER TABLE DWH_REP.P_RATING DROP COLUMN ID_PARTNER;
    ORA-39726: unsupported add/drop column operation on compressed tables
    can you checkwith following?
    SQL>alter table t set unused column x;
    SQL>alter table t drop unused columns;Tom explains it ->http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:69076630635645

  • Drag and drop column header in a table

    Hi all,
    I need to drag the Column header in a table dynamically. When I drag the column
    out of the table, The table should be rearranged accordingly
    NOTE: The output is displayed in the form of XML(XSL).
    Pls help me solve the problem .
    Thanks in advance,
    Ganesh

    You can implement DropTargetListener, DragSourceListener, DragGestureListener like the following:
    public class MyTree extends JTree
                implements DropTargetListener, DragSourceListener, DragGestureListener {
        public void dragEnter (DropTargetDragEvent event) {
            event.acceptDrag (DnDConstants.ACTION_MOVE);
        public void dragExit (DropTargetEvent event) {
            //System.out.println( "dragExit");
        public void dragOver (DropTargetDragEvent event) {
        public void drop (DropTargetDropEvent event) {
            // place your code for action after drop
        public void dropActionChanged ( DropTargetDragEvent event ) {
        public void dragGestureRecognized( DragGestureEvent event) {
        public void dragDropEnd (DragSourceDropEvent event) {  
        public void dragEnter (DragSourceDragEvent event) {
            //System.out.println( " dragEnter");
        public void dragExit (DragSourceEvent event) {
            //System.out.println( "dragExit");
        public void dragOver (DragSourceDragEvent event) {
            //System.out.println( "dragExit");
        public void dropActionChanged ( DragSourceDragEvent event) {
            //System.out.println( "dropActionChanged");
    }Hope this can help.

  • Find duplication values from multiple columns in a big table

    Hi All,
    I am working on a 11gR2 database in linux. i want to display record that have duplicate values in 2 columns.
    1. Table Structure :-
    CREATE TABLE A
    ID NUMBER(10),
    F_NAME VARCHAR2(100 BYTE),
    L_NAME VARCHAR2(100 BYTE)
    2. Sample Data:-
    Insert into A
    (ID, F_NAME, L_NAME) Values (1,'TONY' ,'SUMIT');
    Insert into A
    (ID, F_NAME, L_NAME) Values (2,'SUMIT' ,'KEITH');
    Insert into A
    (ID, F_NAME, L_NAME) Values (3,'NORA','SMITH');
    Insert into A
    (ID, F_NAME, L_NAME) Values (4,'APRIL','TONY');
    Insert into A
    (ID, F_NAME, L_NAME) Values (5,'ROSS','TAM');
    ID F_NAME L_NAME
    1 TONY SUMIT
    2 SUMIT KEITH
    3 NORA SMITH
    4 APRIL TONY
    5 ROSS TAM
    4. My requirement is i need display IDs that it's F_NAME or L_NAME has duplication in F_NAME or L_NAME columns.
    The result should be
    ID
    1 reason: F_NAME (TONY) equals to L_NAME of record 4, L_NAME (SUMIT) equals to F_NAME of record 2
    2 reason: F_NAME (SUMIT) equals to L_NAME of record 1
    4 reason: L_NAME (TONY) equals to F_NAME of record 1
    record 3, 5 aren't in the result because there is no duplication in F_NAME or L_NAME columns for NORA,SMITH, ROSS, TAM
    The table contains 10 million records, i really need to consider the performance.
    kindly suggest me the solution

    Note: Forum members please suggest better approach to this -- below.. convert into SQL :)
    I know I will be opposed by many people in this forum for posting such in-efficient solution.
    But trying to learn along with you.. its an interesting problem which must deal with all rows vs all rows to get all combinations.
    But I am still thinking how to write it in SQL, probably will learn from this post after we receive some good SQL solution for the code what I am currently doing now.
    step 1: created a table B similar to table A and added a column reason
    CREATE TABLE B
      ID      NUMBER(10),
      F_NAME  VARCHAR2(100 BYTE),
      L_NAME  VARCHAR2(100 BYTE),
      REASON  VARCHAR2(1000 BYTE)  --- ADDED THIS
    )Definetely inefficient :(
    BEGIN
       FOR rec_outer IN (SELECT * FROM A) LOOP
          FOR rec_inner IN (SELECT * FROM A) LOOP
             IF (rec_outer.f_name = rec_inner.l_name) THEN
                UPDATE B
                   SET reason =
                             rec_outer.id
                          || ' reason: F_NAME ('
                          || rec_outer.f_name
                          || ') equals to L_NAME of record '
                          || rec_inner.id
                 WHERE b.id = rec_outer.id;
             END IF;
          END LOOP;
          FOR rec_inner IN (SELECT * FROM A) LOOP
             IF (rec_outer.l_name = rec_inner.f_name) THEN
                UPDATE B
                   SET reason =
                          reason
                          || CASE
                                WHEN reason IS NULL THEN
                                   rec_outer.id || ' reason: '
                                ELSE
                             END
                          || 'L_NAME ('
                          || rec_inner.f_name
                          || ') equals to F_NAME of record '
                          || rec_inner.id
                 WHERE b.id = rec_outer.id;
             END IF;
          END LOOP;
       END LOOP;
       COMMIT;
    EXCEPTION
       WHEN OTHERS THEN
          rollback;
          RAISE;
    END;OUTPUT:
    ID     F_NAME     L_NAME     REASON
    1     TONY     SUMIT     1 reason: F_NAME (TONY) equals to L_NAME of record 4,L_NAME (SUMIT) equals to F_NAME of record 2
    2     SUMIT     KEITH     2 reason: F_NAME (SUMIT) equals to L_NAME of record 1
    3     NORA     SMITH     
    4     APRIL     TONY     4 reason: L_NAME (TONY) equals to F_NAME of record 1
    5     ROSS     TAM     Cheers,
    Manik.
    Edited : Added rollback

  • Adding a new column to a big table is very slow

    All,
    I am trying to add a column to a table with defaul value as 0. The table has about 15M rows. The alter table statement is extermely slow.
    I am using 11.1.0.7 on windows.
    Thanks in advance

    Please be careful when using this new 11g feature that can add columns to tables without updating each row. If you use a default value on a new not null column, update triggers that reference that column's :new value could have problems. There is a bug that has been around for at least 3 years that Oracle claims is "not a bug" that could cause problems in your triggers.
    The issue is that triggers will still see null for the :new.column value even though it has a not null default. Even though you can select from the table and the results will show the default value, which it pulls from the data dictionary, the trigger cannot handle it. It appears to pull the value from the data block, not the data dictionary. So if it has never been updated, those two values will be out of synch. The fix, shown below, it to update each row.
    For example, in 11.2.0.2:
    1. Create a new table, insert one row, and add a new column (not null, with default value):
    create table t (c1 number, c2 number);
    insert into t values (1,1);
    alter table t add (c3 number default 0 not null);Select from it and everything looks fine. The value for C3 is 0, my default. Perfect.
    SQL> select * from t;
            C1         C2         C3
             1          1          0My new column C3 looks fine. Even though that row was never updated, my query pulled the default value of 0 from the data dictionary. Great!
    But now add a simple trigger:
    create or replace trigger t_bur_tr
    before update on t for each row
    begin
      :new.c3 := :new.c3;
    end;
    /I am updating C1, one of my original columns. The trigger looks at the new value of C3 anyway, but because I am not updating it, it should equal its existing value. But this is what I get:
    SQL> update t set c1 = 9999 where c1 = 1;
    update t set c1 = 9999 where c1 = 1
    ORA-01407: cannot update ("AMARTIN"."T"."C3") to NULL
    SQL> The workaround is to update every row. (Defeating the purpose of the cool new 11g feature that can supposedly add columns without updating each row.)
    SQL> update t set c3 = c3;
    1 row updated
    SQL> commit;
    Commit complete
    SQL> select * from t;
            C1         C2         C3
             1          1          0
    SQL> update t set c1 = 9999 where c1 = 1;
    1 row updated
    SQL> select * from t;
            C1         C2         C3
          9999          1          0 Now it works as expected.
    Just a heads-up on this unexpected feature. Not a bug? Sure looks like one to me.
    Edit: Appears to be fixed in 11.2.0.3

  • Sizing columns in a big table

    Hello,
    This is something that is really driving me up the wall, if
    you create a table with say 12 columns and you want the first 4 to
    be say 100 pixels and rest to be 35. If you select the first 4 and
    set them too 100 pixels then select the rest and set them to 35
    what happens is the first 4
    shrink and the very last column
    expands but if you clikc in it Dreamweaver lies to you and
    tells you it is the size you wanted
    even though it is visibly too large why does this happen?
    Is there a way to lock the first 4 then have the table resize
    to the
    right as it should do expanding the table width if
    necessary? I am doing a site for a lighting manufacturer and they
    have a lot of data tables and it really is making me quite angry
    that I cannot get the column sizes to stop auto resizing everytime
    I try to make a fwe columns the same size, why does it auto resize
    all the columns???

    Your whole approach to tables is flawed.
    What is the width of the outer table?
    What is the contents of the cells?
    > why does it auto
    > resize <b>all<b> the columns???
    Because that's how HTML tables behave. They continuously
    adjust to fit
    their contents, no matter what your dimensions are.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "MrFrisky330" <[email protected]> wrote in
    message
    news:e5mb78$j1v$[email protected]..
    > Hello,
    >
    > This is something that is really driving me up the wall,
    if you create a
    > table
    > with say 12 columns and you want the first 4 to be say
    100 pixels and rest
    > to
    > be 35. If you select the first 4 and set them too 100
    pixels then select
    > the
    > rest and set them to 35 what happens is the first 4
    <i>shrink</i> and the
    > very
    > last column <i>expands<i> but if you clikc
    in it Dreamweaver lies to you
    > and
    > tells you it is the size you wanted <b>even though
    it is visibly too
    > large<b>
    > why does this happen?
    >
    > Is there a way to lock the first 4 then have the table
    resize to the
    > <b>right<b> as it should do expanding the
    table width if necessary? I am
    > doing
    > a site for a lighting manufacturer and they have a lot
    of data tables and
    > it
    > really is making me quite angry that I cannot get the
    column sizes to stop
    > auto
    > resizing everytime I try to make a fwe columns the same
    size, why does it
    > auto
    > resize <b>all<b> the columns???
    >
    >

  • I am getting this error message for one of the columns in my big table:

    FOR XML could not serialize the data for node 'NAME' because it contains a character (0x001A) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.

    The message is fairly clear: it is simply the case that some characters are not permitted in XML.
    Character 0x001A is 26 decimal and this is a control character and if you have this in a column called NAME there is something spooky with your data, and there is reason to investigate this:
    SELECT * FROM tbl WHERE charindex(NAME COLLATE Latin1_General_BIN2, char(26)) > 0
    If you don't care, you can wrap the troublesome column replace:
    replace(NAME NAME COLLATE Latin1_General_BIN2, char(26), '?')
    The binary collation is required since char(26) is typically an undefined character in a Unicode non-binary collation and unexpected things happens.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Drop column from compressed table

    NLSRTL
    11.2.0.3.0
    Production
    Oracle Database 11g Enterprise Edition
    11.2.0.3.0
    64bit Production
    PL/SQL
    11.2.0.3.0
    Production
    TNS for Linux:
    11.2.0.3.0
    Production
    Hello,
    I read about how to drop column from a compressed table - first set it unused and then drop the unused columns. However, in the example below on the database I ran it, it does not work. Please, can you tell me WHEN this approach does not work. What it is dependent on - parameters or something else. Why I cannot drop the unused columns?
    And the example along with the errors:
    create table tcompressed compress as select * from all_users;
    > table TCOMPRESSED created.
    alter table tcompressed add x number;
    > table TCOMPRESSED altered.
    alter table tcompressed drop column x;
    >
    Error report:
    SQL Error: ORA-39726: unsupported add/drop column operation on compressed tables
    39726. 00000 -  "unsupported add/drop column operation on compressed tables"
    *Cause:    An unsupported add/drop column operation for compressed table
               was attemped.
    *Action:   When adding a column, do not specify a default value.
               DROP column is only supported in the form of SET UNUSED column
               (meta-data drop column).
    alter table tcompressed set unused column x;
    > table TCOMPRESSED altered.
    alter table tcompressed drop unused columns;
    >
    Error report:
    SQL Error: ORA-39726: unsupported add/drop column operation on compressed tables
    39726. 00000 -  "unsupported add/drop column operation on compressed tables"
    *Cause:    An unsupported add/drop column operation for compressed table
               was attemped.
    *Action:   When adding a column, do not specify a default value.
               DROP column is only supported in the form of SET UNUSED column
               (meta-data drop column).
    As you can see even after altering the table by setting the column X as unused I still cannot drop it by using DROP UNUSED COLUMNS.
    Thank you.

    check this link it might help. At the end it has also mentioned of a bug check the same.
    http://sharpcomments.com/2008/10/ora-39726-unsupported-adddrop-column-operation-on-compressed-tables.html

  • Alter table tablename drop column col

    I tried to drop a column from a table created by sys user. Being a sys user I am unable to drop the column. Please explain.
    SQL> alter table test move tablespace users;
    Table altered.
    SQL> alter table test drop column two;
    alter table test drop column two
    ERROR at line 1:
    ORA-12988: cannot drop column from table owned by SYS
    Here two is the column name.
    Regards
    Vijay Kumar

    Hello Gasparotto
    It is amazing to me. Being a sys user I created a table and then I tried to alter the table by dropping a column but it is giving me error as I have already stated. Please explain over this issue.
    Regards
    Vijay Kumar

  • Cannot drop column from table owned by SYS

    Hello everybody,
    How can I drop a column of table which is owned by sys? thanks!
    Result as follows:
    SQL> ALTER TABLE HELLO_TB DROP COLUMN NUM;
    ALTER TABLE HELLO_TB DROP COLUMN NUM
    ERROR at line 1:
    ORA-12988: cannot drop column from table owned by SYS
    newbie v

    You can not 'change' the ownership.
    You can, however, 'move' or 'clone' most objects by exporting and importing. As follows:
    I create a table under SYS (shudder).
    I then export it
    - using userid SYS in this case,
    - under normal circumstances I'd either use a DBA account or the owner's userid
    - since I want a table, I use the TABLES option - a list is comma separated and in quotes
    I then import it using a 'userid' switch - fromuser & touser options
    - in this case from SYS to HR
    Finally, I verify it was transported.
    Actual console session in Linux follows:
    pop2@fuzzy:~> sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 10 19:58:01 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> create table test1 ( x1 number );
    Table created.
    SQL> insert into test1 values (2);
    1 row created.
    SQL> select * from test1;
            X1
             2
    SQL> Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    pop2@fuzzy:~> exp file=exp.dmp tables='TEST1'
    Export: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:07 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Username: sys/????? as sysdba
    Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                          TEST1          1 rows exported
    Export terminated successfully without warnings.
    pop2@fuzzy:~> imp file=exp.dmp fromuser=sys touser=hr
    Import: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:44 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Username: sys/????? as sysdba
    Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Export file created by EXPORT:V10.02.01 via conventional path
    import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
    . importing SYS's objects into HR
    . . importing table                        "TEST1"          1 rows imported
    Import terminated successfully without warnings.
    pop2@fuzzy:~> sqlplus hr/hr
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:57 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> select * from test1;
            X1
             2
    SQL>The export/import pair are incredibly powerful - and few people understand them well. If you are interested in digging into their capability, check out their chapters in the Utilities manual (under the Books tab) at http://www.oracle.com/pls/db102/portal.portal_db?selected=1

  • Dropping a column in composite xmltype table with virtual column

    Hello,
    i found some interesting behavior. I have a table with xmltype column and a virtual column. If i drop a column, which has an index smaller than the index for the xmltype column, than the virtual column reference for xmltype column is not changed.
    select * from v$version;
    drop table t_xml purge;
    create table t_xml( c1 number,
                        c2 number,
                        cxml xmltype,
                        c3 number,
                        xmlflag number as (nvl2(cxml,1,0)));
    select * from t_xml;
    alter table t_xml drop column c2;                    
    select * from t_xml; The 2nd select will result in error:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> alter table t_xml drop column c2;                    
    Tabelle wurde geändert.
    SQL>
    SQL> select * from t_xml;
    select * from t_xml
    FEHLER in Zeile 1:
    ORA-00904: "SYS_NC00004$": ungültiger BezeichnerNow the virtual column xmlflag references still the old hidden column for cxml (SYS_NC00004$). It not references the new hidden column, which is now SYS_NC00003$.
    I think, it is a bug! Can someone inform oracle? I have no access to metalink.

    Hi,
    Please try this code:
    loop at int_inv into wa_inv.
        lv_count = lv_count + 1.
        AT END OF posnr.   <------- The field you want to sum..
          gs_total-posnr      = wa_inv-posnr.
          gs_total-cov_total  = lv_count.
          APPEND gs_total TO gt_total.
          CLEAR : gs_total,
                  lv_count,
                  wa_inv.
        ENDAT.
      ENDLOOP.

  • SAPSR3DB   XMII_TRANSACTION table LOG column is very big

    Hi,
    We have a problem about MII server.
    SAPSR3DB   XMII_TRANSACTION table LOG column is very big data in it.
    How can it be decrease the size of data in this column?
    Regards.

    In 12.1 its XMII Administration Menu (Menu.jsp) --> System Management --> DefaultTransactionPersistance.
    In production I recommend setting this to 'ONERROR'
    There is also the TransactionPersistenceLifetime which determines how long entries will stay in the log table.
    We set this to 8 hours.

  • Shutdown hangs after drop column

    Hi,
    We were trying to drop column on a very big table, after that we cancelled that operation, and given shutdown immediate command.
    Now shutdown is taking too much time, going on from last 9 hours.....
    We want to start the database, what can be the best possible solution.
    Shutdown abort and startup will help ?
    Thanks
    Dilipkumar Patel.

    We were trying to drop column on a very big table, after that we cancelled that operation, and given shutdown immediate command.I guess SMON was doing rollback the transaction when you cancelled the operation. Since it was a big table, it was taking lot of time.
    Can you check the alter log is there any error or info msg in it?
    I am afraid if you give shutdown abort, may cause serious issues.
    Before you execute 'shutdown abort', make sure you have good backup, in case of recovery.
    Jaffar

  • Drop Down List in a table - different options for each row

    How can i have a drop down list in a table with different options for each row?
    My requirement is this.. I want to display, say employee dtails in a table, and one column is employee hobbies, whcih can have multiple values and each employee may have a different list of hobbies. So how can we populate the drop down for each row, with different options?

    Hey. Uh, this probably isn't the answer you were looking for, but it sounds like you've got a problem with your database design there. Generally speaking, your tables shouldn't have multi-valued fields, in the relational model anyway (sql). Instead, you should look at adding a separate table like EMPLOYEE_HOBBIES. Then you have a foreign key using the employees primary key as the foreign key in the employee_hobbies table, see what I mean? I might have misunderstood your explanation though, I'm not sure.
    Alternatively, you could just have hobbies as a big freeform varchar field, and don't bother to make people separate their hobbies into different fields (you'd have to abandon the drop-down listbox idea in this case). If there's no really important reason to make the distinction, then it's probably easier just to not do it.

  • Very Big Table (36 Indexes, 1000000 Records)

    Hi
    I have a very big table (76 columns, 1000000 records), these 76 columns include 36 foreign key columns , each FK has an index on the table, and only one of these FK columns has a value at the same time while all other FK have NULL value. All these FK columns are of type NUMBER(20,0).
    I am facing performance problem which I want to resolve taking in consideration that this table is used with DML (Insert,Update,Delete) along with Query (Select) operations, all these operations and queries are done daily. I want to improve this table performance , and I am facing these scenarios:
    1- Replace all these 36 FK columns with 2 columns (ID, TABLE_NAME) (ID for master table ID value, and TABLE_NAME for master table name) and create only one index on these 2 columns.
    2- partition the table using its YEAR column, keep all FK columns but drop all indexes on these columns.
    3- partition the table using its YEAR column, and drop all FK columns, create (ID,TABLE_NAME) columns, and create index on (TABLE_NAME,YEAR) columns.
    Which way has more efficiency?
    Do I have to take "master-detail" relations in mind when building Forms on this table?
    Are there any other suggestions?
    I am using Oracle 8.1.7 database.
    Please Help.

    Hi everybody
    I would like to thank you for your cooperation and I will try to answer your questions, but please note that I am a developer in the first place and I am new to oracle database administration, so please forgive me if I did any mistakes.
    Q: Have you gathered statistics on the tables in your database?
    A: No I did not. And if I must do it, must I do it for all database tables or only for this big table?
    Q:Actually tracing the session with 10046 level 8 will give some clear idea on where your query is waiting.
    A: Actually I do not know what you mean by "10046 level 8".
    Q: what OS and what kind of server (hardware) are you using
    A: I am using Windows2000 Server operating system, my server has 2 Intel XEON 500MHz + 2.5GB RAM + 4 * 36GB Hard Disks(on RAID 5 controller).
    Q: how many concurrent user do you have an how many transactions per hour
    A: I have 40 concurrent users, and an average 100 transaction per hour, but the peak can goes to 1000 transaction per hour.
    Q: How fast should your queries be executed
    A: I want the queries be executed in about 10 to 15 seconds, or else every body here will complain. Please note that because of this table is highly used, there is a very good chance to 2 or more transaction to exist at the same time, one of them perform query, and the other perform DML operation. Some of these queries are used in reports, and it can be long query(ex. retrieve the summary of 50000 records).
    Q:please show use the explain plan of these queries
    A: If I understand your question, you ask me to show you the explain plan of those queries, well, first, I do not know how , an second, I think it is a big question because I can not collect all kind of queries that have been written on this table (some of them exist in server packages, and the others performed by Forms or Reports).

Maybe you are looking for