ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rac库与单机physical standby 之间的相互switchover

rac库与单机physical standby 之间的相互switchover

原创 Linux操作系统 作者:zengzg 时间:2019-06-17 14:27:08 0 删除 编辑
rac库与单机physical standby 之间的相互switchover

参考杨版主的:http://yangtingkun.itpub.net/post/468/422816

主primary rac库: racdb(racdb1,racdb2)
单机physical standby库:standby

                                                   
一:主库进行switchover时只能有一个实例是open状态,先让主库racdb switchover to physical standby,再重启到mount:
SQL>  SELECT * FROM V$DATAGUARD_STATS;

no rows selected

SQL> select NAME ,DB_UNIQUE_NAME ,open_mode,DATABASE_ROLE,PROTECTION_MODE    from v$database;

NAME      DB_UNIQUE_NAME                 OPEN_MODE  DATABASE_ROLE      PROTECTION_MODE
--------- ------------------------------ ---------- ----------------   --------------------
RACDB     racdb                          READ WRITE PRIMARY            MAXIMUM PERFORMANCE


SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE

再做switchover时只能有一个实例处于open状态,在两个实例都处于open时执行switchover时会报错
SQL> 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-01105: mount is incompatible with mounts by other instances


在关闭实例racdb2后,在racdb1上进行switchover:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

Database altered.


SQL> shutdown immediate;
ORA-01507: database not mounted


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

Total System Global Area  171966464 bytes
Fixed Size                  1218340 bytes
Variable Size             130025692 bytes
Database Buffers           37748736 bytes
Redo Buffers                2973696 bytes
Database mounted.

SQL> recover managed standby database disconnect from session;
Media recovery complete.
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE


二:从库switchover to primary role,过程和单机的standby没有差别:
SQL> select NAME ,DB_UNIQUE_NAME ,open_mode,DATABASE_ROLE from v$database;

NAME      DB_UNIQUE_NAME                 OPEN_MODE  DATABASE_ROLE
--------- ------------------------------ ---------- ----------------
RACDB     racdb                          READ ONLY  PHYSICAL STANDBY

SQL>  recover managed standby database disconnect from session;
Media recovery complete.

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS
--------------------
TO PRIMARY

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

Database altered.

SQL>  ALTER DATABASE OPEN;  ---记得在单机可以直接打开的,这里不知道为什么????
ALTER DATABASE OPEN
*
ERROR at line 1:
ORA-01507: database not mounted

SQL> shutdown immediate;
ORA-01507: database not mounted


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

Total System Global Area  171966464 bytes
Fixed Size                  1218340 bytes
Variable Size              92276956 bytes
Database Buffers           75497472 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS
--------------------
TO STANDBY               
SQL> select NAME ,DB_UNIQUE_NAME ,open_mode,DATABASE_ROLE from v$database;

NAME                           DB_UNIQUE_NAME                 OPEN_MODE  DATABASE_ROLE
------------------------------ ------------------------------ ---------- ----------------
RACDB                          standby                        READ WRITE PRIMARY                 ---已经是主库了

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10834762/viewspace-488983/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-09

  • 博文量
    50
  • 访问量
    35729