05021问题有效性解决方案(2)

经过思考,笔者提出了一种假说。如果Control File在Standby端是不允许进行修改,但是在Primary端允许修改的话。可否进行一次有准备的Switchover动作,让Standby端临时性变为可以修改的Control File。修改之后再Switchover就可以了。

实验过程如下,首先在主库上进行角色切换动作。

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE

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

READ WRITE          PRIMARY

SQL> alter database commit to switchover to standby with session shutdown;

Database altered.

SQL> quit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@vLIFE-URE-OT-DB-PRIMARY ~]$ ps -ef | grep pmon

oracle  30720 30659  0 10:40 pts/0    00:00:00 grep pmon

主库切换之后,自动停机。下面进行备库操作。

[oracle@vLIFE-URE-OT-DB-STANDBY ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 13 10:38:32 2016

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

SQL> conn / as sysdba

Connected.

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE

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

READ ONLY WITH APPLY PHYSICAL STANDBY

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

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

TO PRIMARY

SQL> alter database commit to switchover to primary with session shutdown;

Database altered.

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE

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

MOUNTED              PRIMARY

SQL> alter database open;

Database altered.

原来的主库(先备库)启动,进行Redo Apply过程。

[oracle@vLIFE-URE-OT-DB-PRIMARY ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 13 10:42:37 2016

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

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 2471931904 bytes

Fixed Size                  2255752 bytes

Variable Size            738198648 bytes

Database Buffers        1711276032 bytes

Redo Buffers              20201472 bytes

Database mounted.

SQL> alter database recover managed standby database using current logfile disconnect;

Database altered.

--日志传输正常。

SQL> select STATUS from v$archive_dest_status;

STATUS

---------

VALID

VALID

INACTIVE

修改原备库RMAN项目。

[oracle@vLIFE-URE-OT-DB-STANDBY trace]$ rman nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jan 13 10:48:47 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: VLIFE (DBID=4207470439)

using target database control file instead of recovery catalog

RMAN> show all;

RMAN configuration parameters for database with db_unique_name VLIFESB are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION ON;

RMAN> configure retention policy to recovery window of 15 days;

new RMAN configuration parameters:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 15 DAYS;

new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters for database with db_unique_name VLIFESB are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 15 DAYS;

CONFIGURE BACKUP OPTIMIZATION ON;

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

下面就可以使用相同的方法将原来的Primary和Standby关系切换回来。由于篇幅所限,不进行详细说明。操作后,修改的参数生效。

[oracle@vLIFE-URE-OT-DB-STANDBY trace]$ rman nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jan 13 11:11:18 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: VLIFE (DBID=4207470439)

using target database control file instead of recovery catalog

RMAN> show all;

RMAN configuration parameters for database with db_unique_name VLIFESB are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 15 DAYS;

CONFIGURE BACKUP OPTIMIZATION ON;

3、结论

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0eb1751808fbeaccbd42452370fdf3b4.html