Few days back, I was working on one of the UAT environments so as to drop columns from 2 tables which were already set to unused as per request from one of my application team.


Note: For identifying unused columns for any table, you need to query dba_tab_cols view as follows. If count is greater than zero then table has unused columns in it. This columns will not be visible in view dba_tab_columns.

select count(0) from dba_tab_cols where table_name=<table_name> and column_name like ‘SYS%$’;


Both the tables were compressed one & as per Oracle’s documentation, Compressed tables do not support drop columns.

So if I need drop these unused columns then , I will need to follow simple approach of uncompessing tables first, then dropping unused columns followed by compressing it back.

This approach worked well for first table. 🙂


SQL> select count(0) from dba_tab_cols where table_name='LPP_TMP' and column_name like 'SYS%$';
COUNT(0)
----------
 2
SQL> ALTER TABLE TEST1.LPP_TMP DROP UNUSED COLUMNS;
Table altered.
SQL> select count(0) from dba_tab_cols where table_name='LPP_TMP' and column_name like 'SYS%$';
COUNT(0)
----------
 2
SQL> ALTER TABLE TEST1.LPP_TMP nocompress;
Table altered.
SQL> ALTER TABLE TEST1.LPP_TMP DROP UNUSED COLUMNS;
Table altered.
SQL> select count(0) from dba_tab_cols where table_name='LPP_TMP' and column_name like 'SYS%$';
COUNT(0)
----------
 0
SQL> ALTER TABLE TEST1.LPP_TMP compress;
Table altered.

Though it worked well for first table, it gave me ORA-39726: unsupported add/drop column operation on compressed tables while applying same strategy on second table. 😦


SQL> ALTER TABLE TEST1.LPPF_TMP nocompress;
Table altered.
SQL> ALTER TABLE TEST1.LPPF_TMP DROP UNUSED COLUMNS;
ALTER TABLE TEST1.LPPF_TMP DROP UNUSED COLUMNS
*
ERROR at line 1:
ORA-39726: unsupported add/drop column operation on compressed tables

After searching on metalink I found note: ORA-39726: Clarification on error when Drop Unused Column does not help (Doc ID 1574318.1), which indicates to use “table move” or “table redefinition” to make the table completely uncompressed, but still you cannot drop the column.

I still tried workaround of moving table first before uncompressing it & it worked for me 🙂


SQL> select count(0) from dba_tab_cols where table_name='LPPF_TMP' and column_name like 'SYS%$';
COUNT(0)
----------
 2
SQL> ALTER TABLE TEST1.LPPF_TMP move;
Table altered.
SQL> ALTER TABLE TEST1.LPPF_TMP nocompress;
Table altered.
SQL> ALTER TABLE TEST1.LPPF_TMP DROP UNUSED COLUMNS;
Table altered.
SQL> select count(0) from dba_tab_cols where table_name='LPPF_TMP' and column_name like 'SYS%$';
COUNT(0)
----------
 0
SQL> ALTER TABLE TEST1.LPPF_TMP compress;
Table altered.

Hope so u will find this post very useful 🙂

Cheers

Regards,

Adityanath

Advertisements

16 responses to “ORA-39726: unsupported add/drop column operation on compressed tables”

  1. Raspberry Ketones Avatar
    Raspberry Ketones

    Good writing. Cheers

    1. Adityanath Dewoolkar Avatar

      Hello There,

      Thanks for visiting and appreciate your feedback.:-)

      Regards,
      Adi

  2. Miguelina Zody Avatar
    Miguelina Zody

    But wanna comment that you have a very nice site, I like the style and design it actually stands out.

  3. Stephine Greenwell Avatar
    Stephine Greenwell

    very interesting details you have observed, appreciate it for putting up.

  4. blog Avatar
    blog

    What’s up everyone, it’s my first pay a quick visit at this website, and article is actually fruitful in favor of me, keep
    up posting these types of articles.

  5. Katie Broody Avatar
    Katie Broody

    Wow, superb weblog format! How lengthy have you ever been blogging for? you make blogging look easy. The full look of your web site is magnificent, let alone the content!

  6. Nicholle Duchesne Avatar
    Nicholle Duchesne

    I’m more than happy to discover this site. I want to to thank you for your time for this particularly wonderful read!! I definitely really liked every bit of it and i also have you saved as a favorite to look at new stuff on your site.

  7. Odessa Avatar
    Odessa

    If some one wants to be updated with most recent technologies
    after that he must be visit this site and be up to date all the time.

  8.  Avatar
    Anonymous

    I think other site proprietors should take this site as an model, very clean and wonderful user friendly style and design, as well as the content. You’re an expert in this topic!

  9. Cameron Formichelli Avatar
    Cameron Formichelli

    I’m often to running a blog and i really recognize your content. The article has actually peaks my interest. I am going to bookmark your web site and maintain checking for new information.

  10. Anh Avatar
    Anh

    What’s up, after reading this amazing post i am as well cheerful to share my experience here with colleagues.

  11. Tyree Bernick Avatar
    Tyree Bernick

    Greetings from California! I’m bored to tears at work so I decided to check out your blog on my iphone during lunch break. I love the knowledge you provide here and can’t wait to take a look when I get home. I’m amazed at how quick your blog loaded on my cell phone .. I’m not even using WIFI, just 3G .. Anyways, amazing site!

  12. Hugo Lugar Avatar
    Hugo Lugar

    Nice blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple adjustements would really make my blog shine. Please let me know where you got your design. Thanks

  13. Vivian Sesay Avatar
    Vivian Sesay

    Hello! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a outstanding job!

  14. Calvin Avatar
    Calvin

    What’s Going down i’m new to this, I stumbled upon this I’ve found It absolutely useful and it has helped me
    out loads. I am hoping to contribute & aid other users like its helped me.
    Good job.

  15. Romeo Volper Avatar
    Romeo Volper

    Howdy! Do you use Twitter? I’d like to follow you if that would be ok. I’m definitely enjoying your blog and look forward to new updates.

Leave a comment

Advertisements
Blog Stats

567,870 hits

Advertisements
Advertisements