본문 바로가기
🗄️ DB_이야기/# 🛢️ Oracle

[Oracle] Data Guard 점검 & 운영 명령어 정리

by gwon_s 2026. 1. 20.

Oracle Data Guard 운영 중
상태 점검 / Apply 제어 / Broker 관리 / Redo 흐름 확인
장애 대응과 운영 안정성의 핵심

 

실무에서 자주 사용하는 명령어들을 목적별로 정리해보았습니다.


1️⃣ Data Guard 기본 상태 점검

📌 Primary / Standby 상태 확인 (DGMGRL)

show database dgpri;
show database dgstby;
  • Role (Primary / Physical Standby)
  • Transport / Apply 상태
  • Error 발생 여부 확인

 

📌 Standby Open 상태 확인 (SQL)

select open_mode, database_role from v$database;
  • Physical Standby 정상 상태
    • READ ONLY WITH APPLY
    • MOUNTED

2️⃣ Apply 상태 점검 (MRP)

📌 Apply 상태 확인

select process, status, thread#, sequence#
from v$managed_standby;
  • MRP0 프로세스 존재 → Apply ON 
  • MRP 미존재 → Apply OFF

 

📌 Apply 지 상태 확인

select name, value from v$dataguard_stats;
  • Transport Lag 0초 → 전송 정상
  • Apply Lag 0초 전송 정상

3️⃣ Apply ON / OFF 제어

⚠️ Broker 사용 중이면 DGMGRL 사용 권장
SQL 명령과 혼용하면 Broker 상태 불일치 발생 가능

🔹 Apply OFF (DGMGRL)

edit database dgstby set state=apply-off;

 

🔹 Apply OFF (SQL)

alter database recover managed standby database cancel;

 

 

🔹 Apply ON (DGMGRL)

edit database dgstby set state=apply-on;

 

🔹 Apply ON (SQL)

alter database recover managed standby database
using current logfile disconnect;

4️⃣ Broker 상태 점검

📌 Broker 기동 여부 확인 (SQL)

show parameter dg_broker_start;
  • VALUE = TRUE → 정상

📌 Broker 구성 상태 확인 (DGMGRL)

show configuration;
  • Protection Mode
  • 전체 DB 상태
  • Error 유무 확인

5️⃣ Data Guard Broker 구성 절차

① Broker 활성화 (Primary / Standby 공통)

alter system set dg_broker_start=true scope=both;

 

 

② Broker 구성 생성 (Primary)

create configuration dg_config
as primary database is <PRI_UNIQUE_NAME>
connect identifier is <PRI_TNSNAME>;

 

 

③ Standby 등록 (Primary)

add database <STBY_UNIQUE_NAME>
as connect identifier is <STBY_TNSNAME>
maintained as physical;

 

 

④ Standby Enable / Disable

enable database <STBY_UNIQUE_NAME>;
disable database <STBY_UNIQUE_NAME>;

 

 

⑤ Broker 구성 제거

disable configuration;
remove configuration;

 


6️⃣ Redo / Apply Lag 확인

select name, value
from v$dataguard_stats
where name in ('transport lag', 'apply lag');
  • 실시간 동기화 여부 판단
  • 장애 시 지연 원인 분석 기준

7️⃣ Redo 로그 흐름 점검 (중요)

📌 Primary Archive 상태

select sequence#, archived, applied
from v$archived_log;
  • applied = NO → Standby 미반영

 

📌 Standby Redo Log (SRL) 상태

select group#, thread#, sequence#, bytes/1024/1024 as mb, status
from v$standby_log
order by group#;
  • SRL 부족 시 Apply 지연 / Switchover 실패

 

📌 Primary / Standby Redo 적용 비교

-- Primary
select thread#, sequence#, status from v$log;

-- Standby
select thread#, sequence#, applied
from v$archived_log
where applied='YES';

 

📌 Standby에서 누락된 Redo 강제 적용

alter database recover managed standby database
using current logfile disconnect;

8️⃣ Archive Destination 상태 확인

select dest_id, status, destination
from v$archive_dest;
  • Transport ERROR 여부
  • 네트워크 / 경로 문제 점검