8

I have one table named test which has 3 columns:

  1. Name
  2. id
  3. address

After some time I know one column is not in use. I want to drop one column, let's say id .

Oracle has one feature to identify a column as unused. What is differenc between drop column vs set unused column?

Adam Hawkes
  • 7,218
  • 30
  • 57

3 Answers3

9

When you drop a column it moves into recycle bin while when you mark a column unused it is like logically dropping it but physically preserving it.

Sometimes marking a column as unused and then using the alter table name drop unused column statement is useful because it allows the DBA to take away column access quickly and immediately. Later on, during a routine database maintenance weekend or after business hours, you can then remove the column with the alter table name drop unused column to reclaim the space.

On the other hand, marking the column unused won't free up any space and when there is an need to free up space and remove the columns that are not needed you would be better off dropping it.

JUG
  • 693
  • 9
  • 25
1

It's a matter of convenience, actually...

see here

setting to "unused" is just like dropping, but will allow you to defer the actual physical deletion to a later date.

p.marino
  • 6,244
  • 3
  • 25
  • 36
  • that's what happens with links...broken – iDevlop Jun 17 '22 at 12:24
  • I try to link only what I consider "durable" resources, when possible. Unfortunately looks like Oracle decided that their forum should become unavailable (at least publicly)... so here is the best I can do: https://stackoverflow.com/questions/129046/disable-and-later-enable-all-table-indexes-in-oracle – p.marino Jun 30 '22 at 09:44
1

This is a help to DBA's maintenance window not for your use in general. For developer it means DROP column. that's it, no recovery later point. instead if you are in 12 c then use INVISIBLE option.

Sachi
  • 11
  • 1