Sunday, December 28, 2008

Steps to re-name the database

The follwing are the steps to re-name the Database....

1. First of all take the database to the "Mount" stage.
-->Alter database close;

2. Trace the control file.
The Trace file will be created in the "udump" directory.
-->Alter database backup controlfile to trace;
Note:-Trace the control file in "Mount" stage only.

3. Now shutdown the database gracefully and exit from sql.
-->shutdown immediate.
-->exit

4. Go to "udump" directory and pick the lastest trace file created.
-->You can use the following command to get the latest trace file in linux.
Issue this command in the "udump" directory.
-->ls -lrt

5. Open the lastest trace file.
-->vi latest_trace_file.trc
Note: In this trace file there will be two scripts.
1st one is used create the control file(which i have told i the previous post)
2nd one is used to rename the database(while i'm telling in this post)

6. Remove everything in the trace file except the 2nd script.
In the 2nd script change "REUSE" to "SET" and database name which will be in the starting of the script.
For Example:-
Create controlfile "SET" database "ORCLXYZ"

7. Save the trace file.

8. Copy the trace file to the home directory.
-->cp ~/rename.sql

9. Change the name of the database in the paramater file.

10. Remove the old control file.

11. Connect to datbase as sysdba.
-->sqlplus / as sysdba

12. Start the database to "nomont" stage.
-->startup nomont

13. Run the script file that we have created from the trace file.
-->@rename.sql

14. Now open the database with resetlogs option.
-->Alter database open resetlogs;

15. Now check the name of the database to confirm.
-->select name from v$database;

Hope it helps....

No comments: