Pages

Monday, July 16, 2012

Renaming Database Objects


To rename a table:
·         RENAME oldname TO newname;

To rename an index
·         ALTER INDEX oldname RENAME TO newname;

In Oracle 9.2 and above to rename a column
·         ALTER TABLE t1 RENAME COLUMN oldname TO newname;

In Oracle 9.2 and above to rename a constraint
·         ALTER TABLE t1 RENAME CONSTRAINT oldname TO newname;

In Oracle 10.1 and above to rename a tablespace
·         ALTER TABLESPACE  oldname RENAME TO newname;

1 comment: