测试修改DBID手记

目标:将测试库的DBID改为 903834600
本文相关内容参考 http://space.zdnet.com.cn/html/80/289380-1685934.html

c>set oracle_sid=ibm
c>sqlplus /nolog
SQL>connect / as sysdba
Connected.
SQL>
SQL>@C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN/dbmsbkrs.sql

SQL> select dbid from v$database;

      DBID
----------
979095573


SQL> exec dbms_backup_restore.nidbegin('ibm','IBM','903834600','979095573',0,0,10);
(注意:上句的第二个 IBM (SID)必须大写,否则会出现600错误)

SQL> variable a number;
SQL> variable b number;
SQL> variable c number;
SQL> exec dbms_backup_restore.nidprocessdf(0,0,:a,:b,:c);

SQL> exec dbms_backup_restore.nidprocesscf(:a,:b);

SQL> exec dbms_backup_restore.nidend;

SQL> select dbid from v$database;

      DBID
----------
903834600

到此,eygle认为DBID修改已经成功,但是,当你重新startup数据库时,会报错误,如下过程

SQL> shutdown immediate
SQL> startup
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  2056864 bytes
Variable Size             180358496 bytes
Database Buffers          423624704 bytes
Redo Buffers                6328320 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> recover database using backup controlfile until cancel;
ORA-00279: change 606898 generated at 07/09/2009 16:56:55 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001
ORA-00280: change 606898 for thread 1 is in sequence #2


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto

ORA-00308: cannot open archived log
'C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 606898 generated at 07/09/2009 16:56:55 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001
ORA-00280: change 606898 for thread 1 is in sequence #2


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
F:\IBM\ONLINELOG\O1_MF_1_55CCYS98_.LOG

ORA-00309: log belongs to wrong database
ORA-00334: archived log: 'F:\IBM\ONLINELOG\O1_MF_3_55CCYVRW_.LOG'


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: 'F:\IBM\DATAFILE\O1_MF_SYSTEM_55CCSKSD_.DBF'

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 606898 generated at 07/09/2009 16:56:55 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001
ORA-00280: change 606898 for thread 1 is in sequence #2


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
F:\IBM\ONLINELOG\O1_MF_2_55CCYTJM_.LOG

ORA-00309: log belongs to wrong database
ORA-00334: archived log: 'F:\IBM\ONLINELOG\O1_MF_3_55CCYVRW_.LOG'


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: 'F:\IBM\DATAFILE\O1_MF_SYSTEM_55CCSKSD_.DBF'


SQL> recover database using backup controlfile until cancel;
ORA-00279: change 606898 generated at 07/09/2009 16:56:55 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001
ORA-00280: change 606898 for thread 1 is in sequence #2


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
F:\IBM\ONLINELOG\O1_MF_3_55CCYVRW_.LOG
ORA-00309: log belongs to wrong database
ORA-00334: archived log: 'F:\IBM\ONLINELOG\O1_MF_3_55CCYVRW_.LOG'


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: 'F:\IBM\DATAFILE\O1_MF_SYSTEM_55CCSKSD_.DBF'


SQL> alter system set undo_management='manual' scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  2056864 bytes
Variable Size             184552800 bytes
Database Buffers          419430400 bytes
Redo Buffers                6328320 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'F:\IBM\DATAFILE\O1_MF_SYSTEM_55CCSKSD_.DBF'


SQL> recover database using backup controlfile;
ORA-00279: change 606898 generated at 07/09/2009 16:56:55 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001
ORA-00280: change 606898 for thread 1 is in sequence #2


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: 'F:\IBM\DATAFILE\O1_MF_SYSTEM_55CCSKSD_.DBF'


SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  2056864 bytes
Variable Size             188747104 bytes
Database Buffers          415236096 bytes
Redo Buffers                6328320 bytes
Database mounted.
SQL> recover database using backup controlfile;
ORA-00279: change 606898 generated at 07/09/2009 16:56:55 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\DB_1\RDBMS\ARC00002_0691779161.001
ORA-00280: change 606898 for thread 1 is in sequence #2


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced


SQL> connect sys as sysdba
Enter password:
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  2056864 bytes
Variable Size             192941408 bytes
Database Buffers          411041792 bytes
Redo Buffers                6328320 bytes
Database mounted.
Database opened.
SQL>

将_allow_resetlogs_corruption"=true参数取消,undo_management 改为auto

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  2056864 bytes
Variable Size             197135712 bytes
Database Buffers          406847488 bytes
Redo Buffers                6328320 bytes
Database mounted.
Database opened.
SQL> select dbid from v$database;

      DBID
----------
 903834600

DBID修改完成


 

原文地址:https://www.cnblogs.com/kevinsun/p/1520055.html