6/24/2013 (12 years ago) | |
Clarify | |
Any | |
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.
The following links contain good information on this topic:
Basics:
http://www.oracle-base.com/articles/8i/dropping-columns.php
More details:
http://www.scribd.com/doc/16883365/Column-Drop-Oracle
Bunch of AskTom posts on this issue
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:623063677753
Keywords:
Oracle
schema
SchemaEditor
performance
ddcomp
SchemaManager
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