[개발 환경]
- Oracle 19C Enterprise Edition
- Oracle VirtualBox
- MobatXterm
10. Oracle 데이터가드 구현하기
[개발 환경]Oracle 19C Enterprise EditionOracle VirtualBoxMobatXterm Oracle 데이터가드의 중요성Oracle 데이터가드(Data Guard)는 기업의 핵심 자산인 데이터를 보호하고, 어떤 상황에서도 서비스 연속성을 유지하
skn100.tistory.com
해당 글과 연관됩니다.
SQL 방식 vs DGMGRL 방식 비교
| 구분 | SQL방식 | DGMGRL방식 |
| 복잡도 | 수동으로 여러 단계 수행 | 단일 명령어로 자동 수행 |
| 시간 | 느림(수동 작업) | 빠름(자동화) |
| 에러 처리 | 수동 확인/처리 | validate 등으로 사전 검증 + 자동 처리 |
| 추천 용도 | 학습/이해 | 운영/실무 |
본 글에서는 DGMGRL 방식을 통한 방법을 진행합니다.
0) DGMGRL이란?
Data Guard Broker의 명령줄 인터페이스(CLI)입니다.
- Switchover/Failover를 단일 명령으로 자동 처리
- SQL 방식처럼 여러 단계/파라미터를 수동으로 변경하지 않아도 됨
사전 준비 listener.ora 수정(정적 서비스 등록)
기존 파일 백업 후 수정합니다.
$ net
$ cp listener.ora listener.ora.20260401
1. 양쪽 DB에서 DG Broker 활성화
-- PROD에서
[oracle@localhost ~]$ sys
SYS @ PROD > alter system set dg_broker_start=true scope=both;
SYS @ PROD > show parameter dg_broker_start;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
dg_broker_start boolean
TRUE
-- SBDB에서
[oracle@localhost ~]$ sys
SYS @ SBDB > alter system set dg_broker_start=true scope=both;
SYS @ SBDB > show parameter dg_broker_start;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
dg_broker_start boolean
TRUE
2. DGMGRL에서 Configuration 생성
[oracle@localhost ~]$ dgmgrl
DGMGRL> connect sys/oracle@PROD
Connected to "PROD"
Connected as SYSDBA.
-- Primary 등록
DGMGRL> create configuration dg_config as
primary database is PROD
connect identifier is PROD;
-- Standby 추가
DGMGRL> add database SBDB as
connect identifier is SBDB
maintained as physical;
-- Configuration 활성화
DGMGRL> enable configuration;
3단계) Configuration 상태 확인
DGMGRL> show configuration;
Configuration - dg_config
Protection Mode: MaxPerformance
Members:
prod - Primary database
sbdb - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
SUCCESS (status updated 12 seconds ago)
DGMGRL> show database PROD;
Database - prod
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
PROD
Database Status:
SUCCESS
DGMGRL> show database SBDB;
Database - sbdb
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: 131.00 KByte/s
Real Time Query: OFF
Instance(s):
SBDB
Database Status:
SUCCESS
DGMGRL>
4단계) Switchover 가능 여부 검증
DGMGRL> validate database PROD;
DGMGRL> validate database SBDB;
5단계) Switchover 수행 (PROD → SBDB를 Primary로)
DGMGRL> switchover to SBDB;
- DGMGRL이 양쪽 DB 재시작, 복구 모드 전환, 필요한 설정 변경을 자동 처리합니다.
6단계) 전환 후 상태 확인
DGMGRL> show configuration;
DGMGRL> show database SBDB;
DGMGRL> show database PROD;
7단계) SQL*Plus로 역할 재확인
-- SBDB (새 Primary)
select open_mode, database_role from v$database;
-- PROD (새 Standby)
select open_mode, database_role from v$database;
select process, status from v$managed_standby;
8단계) DML 테스트 및 동기화 확인
-- SBDB (새 Primary)에서
connect scott/tiger
update emp set sal = 0;
commit;
connect / as sysdba
alter system switch logfile;
-- PROD (새 Standby)에서 확인(Read Only)
alter database recover managed standby database cancel;
alter database open read only;
connect scott/tiger
select ename, sal from emp;
-- 확인 후 복구 모드로 복원
connect / as sysdba
shutdown immediate
startup mount
alter database recover managed standby database disconnect;
'Oracle > Oracle 설치' 카테고리의 다른 글
| RAC 설치 1단계 (vm 환경구성) (1) | 2026.04.15 |
|---|---|
| RAC 질문과 답변 (0) | 2026.04.15 |
| 9. Oracle 19C dbca로 삭제하기 (0) | 2026.03.26 |
| 8. Oracle 19C에 데이터베이스 생성 (FILE SYSTEM) (0) | 2026.03.26 |
| 7. Oracle Linux 환경에 19c 설치하기 (0) | 2026.03.23 |