测试修改DBID手记

本文详细介绍如何在Oracle数据库中更改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/archive/2009/07/09/1520055.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值