修改dbid后出现一系列问题
环境:OEL+Oracle11.2.0.3
问题描述:由于做备份恢复测试需要,根据http://www.zzzyk.com/database/201305/209268.html,更改了测试数据库的dbid,看似事情已然易做图结束,然后事实并非那么简单,更改dbid后出现了一系列的问题。
先是startup database时出现ORA-01589 ,接着resetlogs时又是ORA-01194等等,下面容在下慢慢道来:
更改完dbid后,查询dbid:
SQL> select dbid from v$database;
DBID
----------
1234567890
重新启动数据库,确保修改被确认,遭遇ORA-01589,
ORA-01589 must use resetlogs or nosetlogs option for database open
SQL>alter database open resetlogs;
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oradata/orcl2/system01.dbf'
SQL> recover database using backup controlfile until cancel;
ORA-01547:warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oradata/orcl2/system01.dbf'
(这边需要提示一下,由于更改了dbid,之前的备份集无法使用,所以rman无法利用之前的备份集恢复数据文件)
解决方面是尝试修改隐含参数_allow_resetlogs_corruption=true
先是shutdown immediate数据库,创建pfile,修改pfile,重建spfile,
OK!
SQL> create pfile from spfile;
File created.
修改initorcl2.ora,添加隐含参数_allow_resetlogs_corruption=true
通过pfile创建spfile:
SQL> create spfile from pfile;
File created.
启动数据库:
SQL> startup
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 331352476 bytes
Database Buffers 79691776 bytes
Redo Buffers 6103040 bytes
Database mounted.
Database opened.
OK!正常
SQL> select dbid from v$database;
DBID
----------
1234567890
由于更改了dbid导致之前的rman备份集无法使用,重新备份下数据库,包括逻辑备份:
逻辑备份数据库时又遭遇ORA-01187和ORA-01110
About to export the entire database ...
. exporting tablespace definitions
EXP-00008: ORACLE error 1187 encountered
ORA-01187: cannot read from file because it failed verification tests
ORA-01110: data file 202: '/oradata/orcl2/temp02.dbf'
EXP-00000: Export terminated unsuccessfully
检查temp临时表空间:
SQL> select file_name,tablespace_name from dba_temp_files;
select file_name,tablespace_name from dba_temp_files
*
ERROR at line 1:
ORA-01187: cannot read from file because it failed verification tests
ORA-01110: data file 201: '/oradata/orcl2/temp01.dbf'
我的解决方法是重建temp表空间:
SQL> alter database tempfile '/oradata/orcl2/temp01.dbf' drop;
Database altered.
SQL> alter database tempfile '/oradata/orcl2/temp02.dbf' drop;
Database altered.
SQL> select * from v$tempfile;
no rows selected
SQL> alter tablespace temp add tempfile '/oradata/orcl2/temp01.dbf' size 50m;
Tablespace altered.
select file_name,tablespace_name,status from dba_temp_files;
FILE_NAME TABLESPACE_NAME STATUS
------------------------- ------------------------------ -------
/oradata/orcl2/temp01.dbf TEMP ONLINE
重新发起逻辑备份;OK!正常了
但是这样的库还是极其不稳定,建议还是重建库吧,不建议在生产库上对dbid进行修改