Thursday, April 10, 2008

Move and Rename DB

1. Backup the control file of DB to trace.
alter database backup controlfile to trace

This will produce the following sql in user_dump_dest

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "OLDDB" NORESETLOGS

2. Shutdown the DB and move the datafiles to the new location. DataFiles can be renamed but control file trace must be edited to reflect the changes.
3. Change
CREATE CONTROLFILE REUSE DATABASE "OLDDB" NORESETLOGS
to
CREATE CONTROLFILE SET DATABASE "NEWDB" NORESETLOGS

4. Remove recover database and open database statments from the control file trace.
5. If any of the *dump directories are missing create them.
6. create a pfile to start the new DB
7. Start the new DB with
startup nomount;
@control_file_trace.sql