CREATECONTROLFILE修改DB_NAME一定不能使用REUSE

总结:最初的db_name是orcl,重建控制文件,想把db_name修改为orclK,如果重建控制文件使用REUSE,会提示ORA-01503: CREATE CONTROLFILE failed
ORA-01161: database name ORCL in file header does not match given name of ORCLK
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'




最初数据库的名字是orcl
sqlplus / as sysdba
SQL> show parameter db_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      orcl

SQL> alter database backup controlfile to trace as '/home/oracle/control';



/etc/oratab新增了数据库orclK的配置,具体配置如下
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y
orclK:/u01/app/oracle/product/11.2.0/dbhome_1:Y

cp initorcl.ora initorclK.ora
把initorclK.ora里面的*.db_name='orcl'修改为*.db_name='orclK'




实验1,使用REUSE
修改/home/oracle/control内容,使用默认的REUSE,把ORCL修改为ORCLK
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCLK" RESETLOGS  NOARCHIVELOG XXX

.oraenv
orclK
sqlplus / as sysdba
SQL> @/home/oracle/control
ORACLE instance started.
Total System Global Area 1272213504 bytes
Fixed Size                  1344680 bytes
Variable Size             352324440 bytes
Database Buffers          905969664 bytes
Redo Buffers               12574720 bytes
CREATE CONTROLFILE REUSE DATABASE "ORCLK" RESETLOGS  NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01161: database name ORCL in file header does not match given name of ORCLK
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'






实验2,使用SET
修改/home/oracle/control内容,把REUSE修改为SET,把ORCL修改为ORCLK
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "ORCLK" RESETLOGS  NOARCHIVELOG XXX

.oraenv
orclK
sqlplus / as sysdba
SQL> @/home/oracle/control.sql
ORACLE instance started.
Total System Global Area 1272213504 bytes
Fixed Size                  1344680 bytes
Variable Size             352324440 bytes
Database Buffers          905969664 bytes
Redo Buffers               12574720 bytes
Control file created.

SQL> alter database open resetlogs;
Database altered.

SQL> show parameter db_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      orclK



实验也发现/home/oracle/control里面的内容大小写敏感,大小写结果一样,比如ORCLK都是大写,但是实际db_name是orclK

分享文章:CREATECONTROLFILE修改DB_NAME一定不能使用REUSE
转载源于:http://myzitong.com/article/gjeddg.html