CREATE CONTROLFILE修改DB_NAME一定不能使用REUSE

lusklusklusk發表於2018-06-22
總結:最初的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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2156498/,如需轉載,請註明出處,否則將追究法律責任。

相關文章