1. Standby로 switchover

A) Primary에 DGMGRL로 접속

DGMGRL로 primary DB에 접속
dgmgrl sys/oracle@ORCL
[oracle@orcl ~]$ dgmgrl sys/oracle@ORCL
DGMGRL for Linux: Release 18.0.0.0.0 - Production on Mon Sep 10 15:41:25 2018
Version 18.3.0.0.0

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

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

Primary에서 standby로 switchover하기 위해 DGMGRL로 paimary에 접속합니다.

B) Standby로 switchover

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

Switchover 명령어를 사용하여 standby로 데이터베이스를 switchover 합니다.

C) Switchover 결과 확인

Switchover 결과 확인
SHOW CONFIGURATION;
SHOW DATABASE orcl;
SHOW DATABASE orcl_stb;
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 77 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: 210.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE orcl_stb;

Database - orcl_stb

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

Database Status:
SUCCESS

Show 명령을 통해 DGMGRL에서 switchover 상태를 확인할 수 있습니다.

D) Switchover 후 데이터베이스 상태 확인

Primary DB와 Standby DB에서 수행
SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;
SQL> SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;

DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
------------------------------ -------------------- ---------------- --------------------
ORCL                           MOUNTED              PHYSICAL STANDBY NOT ALLOWED
SQL> SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;

DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
------------------------------ -------------------- ---------------- --------------------
ORCL_STB                       READ WRITE           PRIMARY          TO STANDBY

Primary와 standby 데이터베이스의 상태도 변경된 것을 v$database 뷰에서 확인할 수 있습니다.

2. Primary로 복원

A) Standby에 DGMGRL로 접속

DGMGRL로 standby DB에 접속
dgmgrl sys/oracle@ORCL_STB
[oracle@orcl ~]$ dgmgrl sys/oracle@ORCL_STB
DGMGRL for Linux: Release 18.0.0.0.0 - Production on Mon Sep 10 15:54:25 2018
Version 18.3.0.0.0

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

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

Standby에서 primary로 복원하기 위해 DGMGRL로 standby에 접속합니다.

B) Primary로 switchover

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"...
Connected to an idle instance.
ORACLE instance started.
Database mounted.
Connected to "ORCL_STB"
Switchover succeeded, new primary is "orcl"

Switchover 명령어를 사용하여 primary로 데이터베이스를 switchover 합니다.

C) 복원 결과 확인

복원 결과 확인
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 71 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: 386.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
SUCCESS

DGMGRL에서 Show 명령어로 복원된 결과를 확인할 수 있습니다.

D) 복원 후 데이터베이스 상태 확인

Primary DB와 Standby DB에서 수행
SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;
SQL> SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;

DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
------------------------------ -------------------- ---------------- --------------------
ORCL                           READ WRITE           PRIMARY          TO STANDBY
SQL> SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;

DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
------------------------------ -------------------- ---------------- --------------------
ORCL_STB                       MOUNTED              PHYSICAL STANDBY NOT ALLOWED

데이터베이스의 상태도 다시 원래대로 복원된 것을 v$database 뷰로 확인할 수 있습니다.

  • 레이블 없음