Failover

Failover 수행

DGMGRL로 Standby DB 접속

dgmgrl sys/oracle@orcl_stb
[oracle@orcl ~]$ dgmgrl sys/oracle@orcl_stb
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed Aug 29 16:19:22 2018

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

Welcome to DGMGRL, type "help" for information.
Connected to "ORCL_STB"
Connected as SYSDBA.
DGMGRL> 

 

Standby로 failover 수행

FAILOVER TO orcl_stb;
DGMGRL> FAILOVER TO orcl_stb;
Performing failover NOW, please wait...
Failover succeeded, new primary is "orcl_stb"

 

Failover 결과 확인

SHOW CONFIGURATION;
SHOW DATABASE orcl_stb;
SHOW DATABASE orcl;
DGMGRL> SHOW CONFIGURATION;

Configuration - dg_orcl

  Protection Mode: MaxPerformance
  Members:
  orcl_stb - Primary database
    orcl     - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 6 seconds ago)

DGMGRL> SHOW DATABASE orcl_stb;

Database - orcl_stb

  Role:               PRIMARY
  Intended State:     TRANSPORT-ON
  Instance(s):
    orcl

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE orcl;

Database - orcl

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
ORA-16661: the standby database needs to be reinstated

 

Primary 데이터베이스 reinstate하기

Reinstate 수행

REINSTATE DATABASE orcl;
DGMGRL> REINSTATE DATABASE orcl;
Reinstating database "orcl", please wait...
Operation requires shut down of instance "orcl" on database "orcl"
Shutting down instance "orcl"...
Connected to "ORCL"
ORACLE instance shut down.
Operation requires start up of instance "orcl" on database "orcl"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Connected to "ORCL"
Continuing to reinstate database "orcl" ...
Reinstatement of database "orcl" succeeded

 

Reinstate 결과 확인

SHOW CONFIGURATION;
SHOW DATABASE orcl;
DGMGRL> SHOW CONFIGURATION;

Configuration - dg_orcl

  Protection Mode: MaxPerformance
  Members:
  orcl_stb - Primary database
    orcl     - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 6 seconds ago)

DGMGRL> SHOW DATABASE orcl;

Database - orcl

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 1 second ago)
  Apply Lag:          0 seconds (computed 1 second ago)
  Average Apply Rate: 295.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
SUCCESS

 

Primary로 복원

Primary로 switchover

SWITCHOVER TO orcl;
DGMGRL> SWITCHOVER TO orcl;
Performing switchover NOW, please wait...
Operation requires a connection to database "orcl"
Connecting ...
Connected to "ORCL"
Connected as SYSDBA.
New primary database "orcl" is opening...
Operation requires start up of instance "orcl" on database "orcl_stb"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Connected to "ORCL_STB"
Switchover succeeded, new primary is "orcl"

 

Switchover 결과 확인

SHOW CONFIGURATION;
SHOW DATABASE orcl;
SHOW DATABASE orcl_stb;
DGMGRL> SHOW CONFIGURATION;

Configuration - dg_orcl

  Protection Mode: MaxPerformance
  Members:
  orcl     - Primary database
    orcl_stb - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 49 seconds ago)

DGMGRL> SHOW DATABASE orcl;

Database - orcl

  Role:               PRIMARY
  Intended State:     TRANSPORT-ON
  Instance(s):
    orcl

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE orcl_stb;

Database - orcl_stb

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 15.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
SUCCESS