修改 oracle dbid,一次修改dbid的过程

[oracle@db2 rmantest]$

[oracle@db2 rmantest]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Mar 9 13:58:09 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

SQL> set linesize 1000

SQL> set pagesize 1000

SQL> select dbid from v$database;

DBID

----------

1122370651

SQL> show parameter dbname;

SQL> show parameter db_name;

NAME                                 TYPE                              VALUE

------------------------------------ --------------------------------- ------------------------------

db_name                              string                            test1

SQL> exec dbms_backup_restore.nidbegin('test1','TEST1','2043040012','1122370651',0,0,10);

-------------注意:第二个TEST1必须大写,两个dbid前面的为修改后的,后面的为修改之前的。

PL/SQL procedure successfully completed.

SQL> select dbid from v$database;

DBID

----------

1122370651

SQL> variable a number;

SQL> variable b number

SQL> variable c number;

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

PL/SQL procedure successfully completed.

SQL> print a;

A

----------

0

SQL> print b

B

----------

1

SQL> print c

C

----------

1

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

PL/SQL procedure successfully completed.

SQL> print a

A

----------

1

SQL> print b

B

----------

1

SQL> print c

C

----------

1

SQL> exec dbms_backup_restore.nidend;

PL/SQL procedure successfully completed.

SQL> select dbid from v$database;

DBID

----------

2043040012

SQL>

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[oracle@db2 rmantest]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Mar 9 14:33:49 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

SQL> select dbid from v$database;

DBID

----------

2043040012

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[oracle@db2 rmantest]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Mar 9 14:34:04 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: test1 (DBID=2043040012)

RMAN> exit

Recovery Manager complete.

修改完成之后,需要重启库,重启过程中,需要更改undo_management、和_allow_resetlogs_corruption参数进行启动,否则无法启动,启动之后在把两个参数改回原来。但是要注意_allow_resetlogs_corruption这个参数为oracle的一个隐含参数,在做数据库恢复时候不要轻易使用!切记!

[oracle@db2 rmantest]$

[oracle@db2 rmantest]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Mar 9 14:34:18 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

SQL> shutdown immediate;

ORA-03113: end-of-file on communication channel

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[oracle@db2 rmantest]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Mar 9 14:34:47 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size                  2096632 bytes

Variable Size             385876488 bytes

Database Buffers         1207959552 bytes

Redo Buffers               14680064 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 399661 generated at 03/09/2011 11:39:41 needed for thread 1

ORA-00289: suggestion : /home/oracle/test1/arch/1_2_745328287.dbf

ORA-00280: change 399661 for thread 1 is in sequence #2

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log '/home/oracle/test1/arch/1_2_745328287.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

ORA-00308: cannot open archived log '/home/oracle/test1/arch/1_2_745328287.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

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: '/home/oracle/test1/test1/system01.dbf'

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 399661 generated at 03/09/2011 11:39:41 needed for thread 1

ORA-00289: suggestion : /home/oracle/test1/arch/1_2_745328287.dbf

ORA-00280: change 399661 for thread 1 is in sequence #2

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log '/home/oracle/test1/arch/1_2_745328287.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

ORA-00308: cannot open archived log '/home/oracle/test1/arch/1_2_745328287.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

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: '/home/oracle/test1/test1/system01.dbf'

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 399661 generated at 03/09/2011 11:39:41 needed for thread 1

ORA-00289: suggestion : /home/oracle/test1/arch/1_2_745328287.dbf

ORA-00280: change 399661 for thread 1 is in sequence #2

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log '/home/oracle/test1/arch/1_2_745328287.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

ORA-00308: cannot open archived log '/home/oracle/test1/arch/1_2_745328287.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

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: '/home/oracle/test1/test1/system01.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 1610612736 bytes

Fixed Size                  2096632 bytes

Variable Size             385876488 bytes

Database Buffers         1207959552 bytes

Redo Buffers               14680064 bytes

Database mounted.

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: '/home/oracle/test1/test1/system01.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 1610612736 bytes

Fixed Size                  2096632 bytes

Variable Size             385876488 bytes

Database Buffers         1207959552 bytes

Redo Buffers               14680064 bytes

Database mounted.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01092: ORACLE instance terminated. Disconnection forced

SQL> conn sys as sysdba;

Enter password:

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size                  2096632 bytes

Variable Size             385876488 bytes

Database Buffers         1207959552 bytes

Redo Buffers               14680064 bytes

Database mounted.

Database opened.

SQL> show parameter _allow_resetlogs_corruption

NAME                                 TYPE

------------------------------------ ---------------------------------

VALUE

------------------------------

_allow_resetlogs_corruption          boolean

TRUE

SQL> show parameter undo_management

NAME                                 TYPE

------------------------------------ ---------------------------------

VALUE

------------------------------

undo_management                      string

MANUAL

SQL>

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

System altered.

SQL> alter system unset "_allow_resetlogs_corruption" scope=spfile;

alter system unset "_allow_resetlogs_corruption" scope=spfile

*

ERROR at line 1:

ORA-02065: illegal option for ALTER SYSTEM

SQL> alter system unset "_allow_resetlogs_corruption"= scope=spfile;

alter system unset "_allow_resetlogs_corruption"= scope=spfile

*

ERROR at line 1:

ORA-02065: illegal option for ALTER SYSTEM

SQL>

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

alter system set "_allow_resetlogs_corruption"='' scope=spfile

*

ERROR at line 1:

ORA-00922: missing or invalid option

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

alter system set "_allow_resetlogs_corruption" scope=spfile

*

ERROR at line 1:

ORA-00927: missing equal sign

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

System altered.

SQL> show parameter _allow_resetlogs_corruption

NAME                                 TYPE

------------------------------------ ---------------------------------

VALUE

------------------------------

_allow_resetlogs_corruption          boolean

TRUE

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 1610612736 bytes

Fixed Size                  2096632 bytes

Variable Size             385876488 bytes

Database Buffers         1207959552 bytes

Redo Buffers               14680064 bytes

Database mounted.

Database opened.

SQL> select dbid from v$database;

DBID

----------

2043040012

SQL>

SQL>

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[oracle@db2 rmantest]$

[oracle@db2 rmantest]$

[oracle@db2 rmantest]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Mar 9 14:57:04 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: test1 (DBID=2043040012)

RMAN> catalog start with '/home/oracle/rmantest';

using target database control file instead of recovery catalog

searching for all files that match the pattern /home/oracle/rmantest

List of Files Unknown to the Database

=====================================

File Name: /home/oracle/rmantest/edoas2_TEST_1_20110309

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /home/oracle/rmantest/edoas2_TEST_1_20110309

RMAN> list backup;

List of Backup Sets

===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ -------------------

1       Full    50.93M     DISK        00:00:00     2011-03-09 13:49:56

BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20110309T134956

Piece Name: /home/oracle/rmantest/edoas2_TEST_1_20110309

List of Datafiles in backup set 1

File LV Type Ckp SCN    Ckp Time            Name

---- -- ---- ---------- ------------------- ----

6       Full 734152     2011-03-09 13:49:56

RMAN> exit

Recovery Manager complete.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值