Santosh Chaurasia
Santosh Chaurasia

Reputation: 113

Oracle drop column and unused column

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?

Upvotes: 8

Views: 10798

Answers (3)

Sachi
Sachi

Reputation: 11

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.

Upvotes: 1

p.marino
p.marino

Reputation: 6252

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.

Upvotes: 1

JUG
JUG

Reputation: 703

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.

Upvotes: 9

Related Questions