日期:2014-05-16  浏览次数:20421 次

DG之物理Standby的switchover转换

DG之物理Standby的switchover转换

Primary:
ORCLPRE >select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE  有会话在连接
ORCLPRE >alter database commit to switchover to physical standby with session shutdown;
alter database commit to switchover to physical standby with session shutdown
*
ERROR at line 1:
ORA-16416: Switchover target is not synchronized with the primary
在Standby端启动REDO应用:
SQL> startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              62916852 bytes
Database Buffers          100663296 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> alter database recover managed standby database disconnect from session;

Database altered.
之后转到Primary:重新执行命令,将Primary转换为Standby
ORCLPRE >alter database commit to switchover to physical standby with session shutdown;

Database altered.
ORCLPRE >shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
ORCLPRE >startup mount
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              75499764 bytes
Database Buffers           88080384 bytes
Redo Buffers                2973696 bytes
Database mounted.
转到Standby:
SQL> conn sys/safe as sysdba
Connected.
SQL> set sqlprompt "ORCLPDG >"
ORCLPDG >select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY
ORCLPDG >alter database commit to switchover to primary; Standby转换为Primary

Database altered.

完成转换后打开数据库:
ORCLPDG >alter database open;
alter database open
*
ERROR at line 1:
ORA-01507: database not mounted


ORCLPDG >startup
ORA-01081: cannot start already-running ORACLE - shut it down first
ORCLPDG >shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
ORCLPDG >startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              62916852 bytes
Database Buffers          100663296 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
验证新的Primary:
ORCLPDG >show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name