千家信息网

[ORACLE DATAGUARD] switchover的过程

发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,1.检查主库的状态:SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;SWITCHOVER_STATUS--------------------TO STAN
千家信息网最后更新 2025年01月20日[ORACLE DATAGUARD] switchover的过程

1.检查主库的状态:

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;


SWITCHOVER_STATUS

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

TO STANDBY


2.将主库设置为standby role

alter database commit to switchover to physical standby;

shutdown immediate;

startup mount;

3.将standby转为primary

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


NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE

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

ORCL sty MOUNTED PHYSICAL STANDBY


SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;


SWITCHOVER_STATUS

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

TO PRIMARY



alter database commit to switchover to primary;

alter database open;

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


NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE

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

ORCL sty READ WRITE PRIMARY

4.原来的primary库上执行:

alter database recover managed standby database disconnect from session;

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


NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE

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

ORCL pri MOUNTED PHYSICAL STANDBY


0