This document explains you steps for renaming an oracle database manually:
Check the name of our database.
SQL> select name from v$database;
NAME
---------
TEST
Create a trace file of the controlfile
SQL> alter database backup controlfile to trace;
Above command will create a trace file of controlfile in the user_dump_dest location
/oracle/admin/TEST/udump/TEST_ora_xxxx.trc
Note: Take a backup of the above trace file before you edit.
Shutdown the database we planned to rename.
SQL> shutdown immediate
Modify (TEST_ora_xxxx.trc) the created trace file:
1. Find the line reading # Set #2. RESETLOGS case
2. Remove all lines above this line.
3. Change the line containing the database name from
CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS NOARCHIVELOG
to
CREATE CONTROLFILE SET DATABASE "DEV" RESETLOGS NOARCHIVELOG
Note: In my case, the database is running in noarchive log mode.
to
CREATE CONTROLFILE SET DATABASE "DEV" RESETLOGS NOARCHIVELOG
Note: In my case, the database is running in noarchive log mode.
4. Remove the line “RECOVER DATABASE USING BACKUP CONTROLFILE”.
5. Remove lines starting with #.
After the modification it looks like this:
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "DEV” RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 512
MAXINSTANCES 1
MAXLOGHISTORY 13146
LOGFILE
GROUP 2 (
'/ database/oradata/TEST /redo02a.log',
' database/oradata/TEST /redo02b.log'
) SIZE 25M,
GROUP 3 (
' database/oradata/TEST /redo03a.log',
' database/oradata/TEST /redo03b.log'
) SIZE 25M,
GROUP 4 (
' database/oradata/TEST /redo04a.log',
' database/oradata/TEST /redo04b.log'
) SIZE 25M
-- STANDBY LOGFILE
DATAFILE
' /database/oradata/TEST /system.dbf01',
' /database/oradata/TEST /s_srs_data_07',
.
.
.
CHARACTER SET US7ASCII
;
Move the controlfiles away so that they can be re-created..
$ mv /database/oradata/TEST/control.ctl control.ctl.old
$ mv /database/oradata/TEST /control.ctl control.ctl.old
The database name must be change in the initDEV.ora:
db_name =DEV
instance_name=TEST
service_names= DEV
SQL>sqlplus / as sysdba
Run the modified control file trace.
SQL>@ TEST_ora_xxxx.trc (modified control file trace file name)
SQL> select name from v$database;
NAME
---------
DEV
No comments:
Post a Comment