Dropping Columns

Posted on


Home » Articles » 8i » Right here

Losing Columns

Oracle 8i presented the power to shed a column from a desk. Previous to this it was once essential to shed all of the desk and rebuild it. Now you’ll be able to mark a column as fresh (logical delete) or delete it utterly (bodily delete).

Logical Delete

On immense tables the method of bodily doing away with a column can also be very age and useful resource eating. Because of this you might
make a decision to logically delete it.

modify desk table_name all set fresh (column_name);
modify desk table_name all set fresh (column_name1, column_name2);

As soon as that is performed the columns will now not be perceptible to the consumer. If at a then day you might have age to bodily delete the
columns this can also be performed the usage of refer to.

modify desk table_name shed fresh columns;

On immense tables you’ll be able to shed the quantity of undo timbers accrued through the usage of the CHECKPOINT possibility which forces a checkpoint
later the required selection of rows had been processed.

modify desk table_name shed fresh columns checkpoint 250;

The DBA_UNUSED_COL_TABS view can also be worn to view the selection of fresh columns in keeping with desk.

Bodily Delete

To bodily shed a column you’ll be able to worth one among refer to syntaxes, relying on whether or not you need to shed a unmarried or
a couple of columns.

modify desk table_name shed column column_name;
modify desk table_name shed (column_name1, column_name2);

Losing a column from a desk will reason all fresh columns in that desk to be dropped on the similar age.

Concerns

Losing a column would possibly not lead to extra usable separate range within the stop. If the column is miniature, you are going to most effective get miniature chunks of range in each and every stop that might not be reusable. The one method this can be freed up for reuse is to rebuild/proceed the desk. It’s extra environment friendly to mark the column as unusable, later rebuild the desk. Through default a proceed isn’t a web-based operation.

modify desk table_name all set fresh (column_name);
modify desk table_name proceed;

In then database variations the proceed operation can also be performed on-line.

modify desk table_name all set fresh (column_name);
modify desk table_name proceed on-line;

Hope this is helping. Regards Tim…

Back to the Top.

Leave a Reply

Your email address will not be published. Required fields are marked *