Dropping Unused column

Hi All,
I am working on version 11.2.0.3.0 ( windows server 2008 ).
While dropping unused column i am getting below error
SQL> create table er (ab varchar2(50), aa varchar2(50)) compress;
SQL> alter table er set unused column ab;
Table altered.
SQL>
SQL>
SQL>
SQL>
SQL> alter table er drop unused columns;
alter table er drop unused columns
ERROR at line 1:
ORA-39726: unsupported add/drop column operation on compressed tables

i can't do such things for these number of tablesThat is the funniest thing I've heard in a while. If you can "alter table xxx drop unused columns," why can't you do what is suggested.
And no, it's not a bug.
And no, there is not "another way around"

Similar Messages

  • Drop unused column in compressed table

    Good day for all.
    I have partitioned compressed table under 10.2.0.4 database. I need to remove column, and did it according metalink note 429898.1, but then i execute command alter table .... drop unused columns, i got error ORA-39726 (unsupported add/drop column operation for compreseed table), so it mean that proposed workaround don't works now.
    Does anyone have new workaround for this problem?

    alter table MY_TABLE set unused(MY_FNG_COLUMN);
    -- success
    alter table MY_TABLE drop unused columns;
    -- error

  • DROP UNUSED COLUMN

    Dear Guru’s
    I have a situation where I need to drop specific columns which are set to unused!
    Say, I have 3 unused columns in a table – and now I want to drop only one unused column from that.
    SQL> alter table scott.emptest set unused (ENAME);
    Table altered.
    SQL> alter table scott.emptest set unused (COMM);
    Table altered.
    Once I set some columns un-used, now I want to drop only one un-used Column “ENAME”
    SQL> alter table scott.emptest drop column ENAME;
    alter table scott.emptest drop column ENAME
    ERROR at line 1:
    ORA-00904: "ENAME": invalid identifier
    which in turn throws this error!
    Help appreciated!
    Thanks in advanced
    Ravi Prakash

    SCOTT@demo102> create table tbl_25 as select * from emp
    SCOTT@demo102> /
    Table created.
    SCOTT@demo102> desc tbl_25
    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)
    SCOTT@demo102> alter table tbl_25 set unused (deptno)
    SCOTT@demo102> /
    Table altered.
    SCOTT@demo102> alter table tbl_25 set unused (comm);
    Table altered.
    SCOTT@demo102> desc tbl_25
    Name                                      Null?    Type
    EMPNO                                              NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    SCOTT@demo102> select * from all_unused_col_tabs where table_name ='TBL_25';
    OWNER                          TABLE_NAME                          COUNT
    SCOTT                          TBL_25                                  2
    SCOTT@demo102> alter table tbl_25 drop unused column;
    Table altered.
    SCOTT@demo102> select * from all_unused_col_tabs where table_name ='TBL_25';
    no rows selected
    SCOTT@demo102> Nicolas.
    Add queries on all_unused_col_tabs.
    Message was edited by:
    N. Gasparotto

  • Dropping unused columns from database table

    I have an existing table called TUSER. I have mapped some fields, but not
    all fields, as some are inserted by other applications and for reporting
    purposes.
    I am using JDK 1.3.1_02, Windows 2000, SQL Server 2000 database, Kodo
    JDOEE 2.2.6 and JBoss 3.0.0.
    When I refresh the datastore it drops all columns that are not mapped
    (note that these colums can contain null values):
    [java] [ connection: 2961925; statement: 2766626; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER ADD Job_Title_ID VARCHAR(255)
    [java] [ connection: 2961925; statement: 1582473; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MAILUSERID
    [java] [ connection: 2961925; statement: 5237832; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PHONENUMBERS
    [java] [ connection: 2961925; statement: 2191491; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMPLOYEENO
    [java] [ connection: 2961925; statement: 894443; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MDATE
    [java] [ connection: 2961925; statement: 531758; time: Thu Jul 04
    15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN STATUSCHANGETIME
    [java] [ connection: 2961925; statement: 5899013; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN FINISHDATE
    [java] [ connection: 2961925; statement: 8146001; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDMBOARD
    [java] [ connection: 2961925; statement: 7756310; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN DEL_FLG
    [java] [ connection: 2961925; statement: 6817858; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_CD
    [java] [ connection: 2961925; statement: 7754670; time: Thu Jul 04
    15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDREQUESTER
    [java] [ connection: 2961925; statement: 7332084; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MSG_SERVER
    [java] [ connection: 2961925; statement: 1691809; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN AUTORUN
    [java] [ connection: 2961925; statement: 5253969; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN REG_DATE
    [java] [ connection: 2961925; statement: 4977422; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_LST
    [java] [ connection: 2961925; statement: 4343712; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN ALLOWREPL
    [java] [ connection: 2961925; statement: 7104150; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMAIL
    [java] [ connection: 2961925; statement: 4395840; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MANAGERSTATUS
    [java] [ connection: 2961925; statement: 2417379; time: Thu Jul 04
    15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MD5_DIGEST
    [java] [ connection: 2961925; statement: 2865120; time: Thu Jul 04
    15:33:25 JST 2002 ] ALTER TABLE TUSER DROP COLUMN SMTPADDRESS
    15:33:25 JST 2002 ] INSERT INTO JDO_SCHEMA_METADATAX(CLASSNAMEX) VALUES
    ('com.gulfnet.g
    roupcast.data.User')
    Is this meant to happen? I am guessing not. Is there a way to tell the
    schematool to not remove existing columns?
    Thanks in advance.
    Kam

    You can in fact tell the schematool not to drop columns it doesn't know about. When you run the schematool, use the "add" action rather than "refresh". Then it will only add columns, never drop them. See the documentation for details:
    http://www.solarmetric.com/Software/Documentation/2.2.5/manual.html#schema_manipulation

  • Cannot drop a column

    Hi,
    I am having a problem with dropping a column from a table. I am using 10g (10.2.0.1.0). Whenever I try to drop a column I got this error:
    ORA-39726: unsupported add/drop column operation on compressed tables
    Then I tried to drop it in a way that first make it unused and then drop it but this time I got the following erro: while unused operation was successful
    ORA-12996: cannot drop system-generated virtual column
    Well I restored this database from RMAN backups of my production system. One thing more that is, when I created a new table then from that table I can drop or add any column from/to it.
    Any help........
    Arshad.

    Well I have already tried this. As I explained in my first email that unused worked fine but as soon as I try to drop the unused column I got this error:
    ORA-12996: cannot drop system-generated virtual column
    Arshad.

  • Dropping a column

    We are planning to drop a column from a production large table with more than 150 million rows.
    It is causing an exclusive lock on the table for more than 2 hrs. Is there any way we can reduce the time period for the lock on the table.
    We tried setting the column unused and then dropping it but it also causing the lock on the table for hrs.
    Is there any way we can drop the column without causing exclusive lock on the same or we can shorten this time.

    I see you can have two approaches and you can choose which best suites you.
    1) DBMS_REDEFINITION
    2) Using triggers to capture DML statements along with CTAS.
    First approach is an easier approach but is time consuming.
    I do not think so you can have downtime for DML operations during dropping of the column.
    Regards
    Anurag

  • How to recover the unused column

    According to the spec, 'set unused' does not actually remove the target columns and the column data remains in the table's rows. but if a column was marked as unused, there are no any access to the column. then why the clause is released?is it better than drop column?if the unused columns exist still,why there are no clause to restore it?

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:2913496610745#2914947431112

  • ORA-12983: cannot drop all columns in a table

    Hi,
    I am creating a table with two columns.
    I have modified a column as unused using ALTER statement.
    After that i have tried to drop the another column by using ALTER statement.
    But it throws an error ORA-12983: cannot drop all columns in a table.
    is it not possible to achieve this via ALTER statement?
    thanks

    is there any other way to find the name of the columns which have been marked as unused?Don't think so, and you would not be able to do much about. You won't be able to reference it, you won't be able to un-unuse it, and you would even be able to add a new column having same name.
    Why are you using SET UNUSED in the first place?
    Regards
    Peter
    Quoting myself:
    You won't be able to reference itMaybe not good enough:
    SQL> select column_name, data_type, segment_column_id
      from user_tab_cols
    where table_name = 'T';
    COLUMN_NAME                    DATA_TYPE   SEGMENT_COLUMN_ID
    SYS_C00001_11051618:28:14$     NUMBER                      1
    B                              NUMBER                      2
    SYS_C00003_11051618:28:14$     NUMBER                      3
    3 rows selected.
    select "SYS_C00003_11051618:28:14$" from t
    Error at line 1
    ORA-00904: "SYS_C00003_11051618:28:14$": invalid identifier
    SQL> alter table t drop column "SYS_C00001_11051618:28:14$";
    Table altered.
    SQL> select column_name, data_type, segment_column_id
      from user_tab_cols
    where table_name = 'T';
    COLUMN_NAME                    DATA_TYPE   SEGMENT_COLUMN_ID
    B                              NUMBER                      
    1 row selected.
    Note: Both columns "disappeared"  Thanks MichaelS
    Edited by: Peter on May 16, 2011 9:29 AM

  • Drop unused fields

    Hi
    I am using around 130 tables in Oracle, now i want to update all the table and want to drop fields from the table which are not used and having blank record.
    going to each table and giving command everytime and identifiying a blank field is time taking job, is there any shortcut for this ???
    sanjay

    I won't suggest writing a automated script to identify columns not being used and dropping them without even doing a impact-analysis! A better approach would be:
    1) Identify columns not being used (say the ones where all rows have null values)
    2) Do impact-analysis to short-list the columns that maybe dropped
    3) On a table-to-table basis, write scripts to drop the column or mark it as unused, or write create table statements if mutiple columns of the same table need to be dropped. As suggested by Eric above.
    Now for step (1), if all the tables of your schema are analyzed, you may use the following script to identify columns that has null value for all the rows:
    select *
    from   user_tab_columns
    where  num_distinct = 0
    and    low_value    is null
    and    high_value   is null
    and    num_nulls    > 0      -- this is to ignore tables with no rows!
    and    avg_col_len  = 0
    order  by table_name, column_id
              NOTE: Please be aware that I have not tested the above script on a full live-schema. I have tested it with a test schema having 4 tables, all tables having three number columns (col1, col2 and col3) and a test data of 10,000 rows each:
    1. Table 1: col3 having null value for all rows.
    2. Table 2: col3 having not-null value for all rows.
    3. Table 3: col3 having not-null value in only 1 row.
    4. Table 4: Table with no rows.

  • Drag-drop data column sorting

    Hey guys,
    Does any one know how to achieve drag-drop data column
    sorting? I tried, but could not find an efficient way to do this.
    It would be an awesome spry feature if possible, but if someone
    else knows how to do this already it would help.
    Thanks,
    Timothy D Farrar

    Hey guys,
    We aim to be as compatible as possible with the other
    frameworks but sometimes problem may exists. We need to see the
    crashing pages to be able to determine the causes for the JS error
    message and where the incompatibilities are located and either fix
    the problems or help you to change your pages to work.
    In this situation I suspect the issue appears because the
    spry region is generated after the drag and drop code from the
    script.aculo.us is instantiated and we destroy the initial elements
    to which this widget is binded. In this situation the solution is
    to instantiate the drag and drop after the region generate its
    content by using the region observers. You'll have to put the drag
    and into a separated function and register the code so the region
    will call it automatically onPostUpdate.
    We include in our documentation more details about the
    Region
    observer notifications. Please search the dedicated chapter
    inside this doc: "Region observer notifications"
    Regards,
    Cristian MARIN

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

  • Set unused column

    Sir
    i am new to database.I am doing an oracle course on 051.My oracle faculty is saying
    Set unused column option will hide the column for-ever.user can't retrieve it again.
    what i believe if a statement is hiding a column there must be some option to regain it.
    Is there any option of to make an unused column to reusable again?

    Hi,
    i am new to database.
    Is there any option of to make an unused column to reusable again?Since you're new:
    Try to find your answers in the Oracle documentation as well, as it explains clearly how 'Oracle things' work, with examples and you can do quick searches on keywords of your interest.
    Example: http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2329
    You should bookmark: http://tahiti.oracle.com and start reading the concepts and fundamentals when you've got some spare time.
    assuming you're on 10g

  • How to drop a column

    Hi OTNeites,
    How does one drop a column in Oracle 7.2 or Oracle 8.0
    Thanks in advance.

    Something like this.
    create new_table as select col1, col2, col3
    from old_table
    drop old_table
    rename new_table to old table
    The trick is to select all the columns except the one you want to drop when creating the new table.
    In this case you lost all indexes, constraints ...
    You should create script for recriate all objects in DB
    that will be drop with DROP OLD_TABLE command.

  • How to drop unused schema

    How to drop unused schema
    give ur suggestion
    Thanks

    Robert Geier wrote:
    If you are sure it is unused, export the schema to disk (using exp, expdp), then drop it.
    drop user xxx cascade;
    If you are not sure, then you may want to audit to confirm it is not used, and maybe lock the schema for a month before you drop it.Of course locking the schema (actually, locking the user account that owns the schema) doesn't prevent the objects in the schema from being used, it just prevents the owner of the schema from connecting. In a lot (should I say "most"?) systems, the application schemas are owned by "users" that are already locked, because there is never any intent for that user account to actually connect. So trying to determine if a schema is used by locking the owning account and seeing who screams is not going prove much of anything.

  • Dropping a column's default value

    How to drop a column's default value?
    The following commands fails:
    ALTER TABLE t1 ALTER COLUMN c1 DROP DEFAULT.
    ALTER TABLE t1 MODIFY c1 DROP DEFAULT.
    Thanks in advance.

    SQL> ALTER TABLE IDENTIFICADORES_DOMINIOS_RANGO MODIFY TIPO_DATO DEFAULT NULL;
    Table altered
    SQL> DESC IDENTIFICADORES_DOMINIOS_RANGO
    Name                 Type         Nullable Default Comments                                  
    CODIGO_IDENTIFICADOR NUMBER(7)                                                               
    DESCRIPCION          VARCHAR2(50)                                                            
    TIPO                 VARCHAR2(1)                                                             
    TIPO_DATO            VARCHAR2(1)           NULL    Tipo de dato que contiene el Dominio-RangoI would like drop DEFAULT value; now, it's marked like NULL. It's not the same... is it?

Maybe you are looking for