change db name by recreating control file

来源:互联网 发布:保温杯 知乎 编辑:程序博客网 时间:2024/05/18 02:23

1.Use SQL "alter database backup controlfile to trace" to backup the controlfile-created script.
2.shutdown database
3.backup all datafile/controlfile/redofile to a new place in order to prevent the option from mistake.
4.Delete the old controlfile,open tracefile created in step 1 ,update the scripts,I met the 2 errors as the following:

---------------OldName:PROD, New DB Name: TEST ------------------

ERROR 1.CREATE CONTROLFILE reuse DATABASE "TEST" NORESETLOGS  NOARCHIVELOG==>error
ERROR 2.CREATE CONTROLFILE set DATABASE "TEST" NORESETLOGS  NOARCHIVELOG ==>error
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;

Right One is:

CREATE CONTROLFILE set DATABASE "TEST" RESETLOGS  NOARCHIVELOG /*Attention point 1*/
RECOVER DATABASE USING BACKUP CONTROLFILE  /*Attention point 2*/
# Database can now be opened zeroing the online logs./*Attention point 3*/
ALTER DATABASE OPEN RESETLOGS;/*Attention point 4*/

Following is the detail:

SQL> RECOVER DATABASE
ORA
-00283: recovery session canceled due to errors
ORA
-01610: recovery using the BACKUP CONTROLFILE option must be done


SQL
> RECOVER DATABASE using backup controlfile until cancel;
ORA
-00279: change 9747475574288 generated at 12/14/2007 00:19:43 needed for
thread 
1
ORA
-00289: suggestion : /home/oracle/9.2.0/dbs/arch/arch_1_2.arc
ORA
-00280: change 9747475574288 for thread 1 is in sequence #2


Specify 
log: {<RET>=suggested | filename | AUTO | CANCEL}
/disk1/oradata/prod/log01b.dbf
Log applied.
Media recovery complete.
SQL
> alter database open resetlogs; 

Database Altered;

5.You can restart use the PLSQL"show parameter db_name" to confirm the actions.

 

原创粉丝点击