버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

Standby로 switchover

Primary에 DGMGRL로 접속

코드 블럭
titleDGMGRL로 primary DB에 접속
linenumberstrue
dgmgrl sys/[sys 계정 암호]@[primary 네트워크 서비스명]
펼치기
서식 미적용
[oracle@orcl ~]$ export NLS_DATE_FORMAT="yyyy/mm/dd hh24:mi:ss"

[oracle@orcl ~]$ dgmgrl sys/oracle@ORCLoracle@SEOUL_PRIMARYSYN
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Feb 13 15:09:01 2024
Version 19.11.0.0.0

Copyright (c) 1982, 2019, 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로 접속합니다.

Standby로 switchover

코드 블럭
titleStandby로 switchover 수행
linenumberstrue
SWITCHOVER TO [standby 글로벌 DB명];
펼치기
서식 미적용
DGMGRL> SWITCHOVER TO orcl_stby;
Performing switchover NOW, please wait...
Operation requires a connection to database "orcl_stby"
Connecting ...
Connected to "orcl_stby"
Connected as SYSDBA.
New primary database "orcl_stby" is opening...
Operation requires start up of instance "orcl" on database "orcl"
Starting instance "orcl"...
Connected to an idle instance.
ORACLE instance started.
Connected to "orcl"
Database mounted.
Connected to "orcl"
Switchover succeeded, new primary is "orcl_stby"


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

Switchover 결과 확인

코드 블럭
titleSwitchover 결과 확인
linenumberstrue
SHOW CONFIGURATION;
SHOW DATABASE [primary 글로벌 DB명];
SHOW DATABASE [standby 글로벌 DB명];
펼치기
서식 미적용
DGMGRL> SHOW CONFIGURATION;

Configuration - dg_orcl

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

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 50 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: 3.02 MByte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE orcl_stby;

Database - orcl_stby

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

Database Status:
SUCCESS


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

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

코드 블럭
titlePrimary DB와 Standby DB에서 수행
linenumberstrue
SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;
펼치기
서식 미적용
SQL> set lines 200
SQL> col db_unique_name form a20
SQL> col open_mode form a20
SQL> col database_role form a20
SQL> col switchover_status form a20
SQL> SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;

DB_UNIQUE_NAME       OPEN_MODE            DATABASE_ROLE        SWITCHOVER_STATUS
-------------------- -------------------- -------------------- --------------------
orcl_stby            READ WRITE           PRIMARY              TO STANDBY
서식 미적용
SQL> set lines 200
SQL> col db_unique_name form a20
SQL> col open_mode form a20
SQL> col database_role form a20
SQL> col switchover_status form a20
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


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

Primary로 복원

Standby에 DGMGRL로 접속

코드 블럭
titleStandby에 DGMGRL로 접속
linenumberstrue
dgmgrl sys/[sys 계정 암호]@[standby 네트워크 서비스명]
펼치기
서식 미적용
[oracle@orcl ~]$ dgmgrl sys/oracle@ORCLoracle@BUSAN_STANDBYSYN
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Feb 13 15:27:12 2024
Version 19.11.0.0.0

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

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


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

Primary로 switchover

코드 블럭
titlePrimary로 switchover 수행
linenumberstrue
SWITCHOVER TO [primary 글로벌 DB명];
펼치기
서식 미적용
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_stby"
Starting instance "orcl"...
Connected to an idle instance.
ORACLE instance started.
Connected to "orcl_stby"
Database mounted.
Connected to "orcl_stby"
Switchover succeeded, new primary is "orcl"


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

복원 결과 확인

코드 블럭
title복원 결과 확인
linenumberstrue
SHOW CONFIGURATION;
SHOW DATABASE [primary 글로벌 DB명];
SHOW DATABASE [standby 글로벌 DB명];
펼치기
서식 미적용
DGMGRL> SHOW CONFIGURATION;

Configuration - dg_orcl

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

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 52 seconds ago)

DGMGRL> SHOW DATABASE orcl;

Database - orcl

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

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE orcl_stby;

Database - orcl_stby

  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: 3.91 MByte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

Database Status:
SUCCESS


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

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

코드 블럭
titlePrimary DB와 Standby DB에서 수행
linenumberstrue
SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;
펼치기
서식 미적용
SQL> set lines 200
SQL> col db_unique_name form a20
SQL> col open_mode form a20
SQL> col database_role form a20
SQL> col switchover_status form a20
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> set lines 200
SQL> col db_unique_name form a20
SQL> col open_mode form a20
SQL> col database_role form a20
SQL> col switchover_status form a20
SQL> SELECT db_unique_name, open_mode, database_role, switchover_status FROM v$database;

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


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