Login

Solution #583 - Dropping columns in Oracle

6/24/2013 (12 years ago)
Clarify
Any
Not yet rated.
7/2/2013 (12 years ago)
Unknown
Oracle

Exploring better ways to drop columns in Oracle, especially when dropping columns from large tables.

The basic syntax for dropping columns:
ALTER TABLE table_name DROP COLUMN column_name;

On large tables the process of physically removing a column can be very time and resource consuming. For this reason you may decide to logically delete it:
ALTER TABLE table_name SET UNUSED (column_name);

Once this is done the columns will no longer be visible to the user. If at a later date you have time to physically delete the columns this can be done using the following.

ALTER TABLE table_name DROP UNUSED COLUMNS;

On large tables you can reduce the amount of undo logs accumulated by using the CHECKPOINT option which forces a checkpoint after the specified number of rows have been processed.

ALTER TABLE table_name DROP UNUSED COLUMNS CHECKPOINT 250;
The DBA_UNUSED_COL_TABS view can be used to view the number of unused columns per table.

Resolution 12 years ago
Resolution 12 years ago

Keywords:

Oracle
schema
SchemaEditor
performance
ddcomp
SchemaManager

Resolution 12 years ago

Normally when a column is removed from the schema it is dropped from the database table it belonged to. On Oracle when the database table is very large dropping a column is a slow operation.

As of version 2.3.3, Dovetail SchemaEditor has a oracleDropColumnStrategy setting that is defined in the .SchemaEditor file.

This setting allows Oracle users to choose an alternative strategy SET UNUSED

When this optional setting is set to unused rather then dropping the column from the database table the column will be set as unused. Later the physical columns can be removed with a SQL operation.

Refer to the SchemaEditor documentation for more details:
https://support.dovetailsoftware.com/selfservice/products/show/SchemaEditor

You must be logged in to post a comment.

Login
  • SchemaEditor

    Application for modifying and extending a Clarify/Dovetail database schema

You must be logged in to post a comment.

Login