Building a Highly Available Witness Tier: Distributed Observers and Quorum at Scale
An automated database failover mechanism is only as dependable as its witness tier; if the observer process lacks independent failure domains and self-healing supervision, automated disaster recovery becomes an operational liability.
TL;DR
- Problem: Running a single Oracle Data Guard Observer on a shared bastion host or inside the primary database region creates a silent single point of failure that blocks automated failover (
ORA-16819).- Answer: Package the full Oracle Database Client (
dgmgrl) in a non-root container and run Master and Backup observers as a multi-AZ KubernetesStatefulSetin an independent third region.- Watch out: Instant Client does not ship
dgmgrl,FastStartFailoverThresholdhas a 6-second floor (30-second default), andReadWriteOncepersistent volumes can lockfsfo.datduring pod rescheduling.
Situation
Oracle Data Guard provides disaster recovery by shipping redo continuously from a Primary database to one or more Physical Standby databases. When platforms enable Fast-Start Failover (FSFO) in MaxAvailability or MaxPerformance mode, the Data Guard Broker relies on an external daemon—the Data Guard Observer—to monitor primary health and trigger automatic promotion without waiting for an on-call engineer.
To prevent split-brain writes where both Primary and Standby accept transactions simultaneously, Data Guard Broker requires mutual agreement between the Master Observer and the Standby database. A failover proceeds only when the Master Observer loses contact with the Primary for longer than FastStartFailoverThreshold and the Standby confirms it is synchronized and ready to assume the primary role.
In many environments, the observer starts as an ad-hoc dgmgrl command inside a screen or tmux session on a shared administration host. That pattern works during initial testing, but it leaves automated recovery dependent on an unmanaged process running on a single virtual machine.
The Problem
Relying on a single unmanaged observer process introduces three operational constraints that break automated failover when a real outage hits.
First, silent single-host failure (ORA-16819). When an observer runs as an unsupervised process on one bastion VM, a kernel panic, OOM kill, or routine OS patch terminates dgmgrl. Because Data Guard continues shipping redo normally without an observer, application traffic does not notice the loss. The Broker raises ORA-16819: fast-start failover observer not started in SHOW CONFIGURATION, and if the Primary subsequently crashes, the Standby cannot promote itself automatically. Recovery stalls until an operator diagnoses the topology, confirms the Primary is genuinely down rather than partitioned, and runs a manual failover.
Second, correlated regional failure. Placing the observer in the same VPC, availability domain, or data center as the Primary or Standby violates three-site isolation. If a power or network outage cuts off the Primary site while the observer sits in that same site, both the Primary and the observer vanish together. The remote Standby sees no witness and refuses to fail over. Even if the Primary host itself is healthy, a shared top-of-rack switch or subnet ACL change can sever both the Primary and a colocated observer from the Standby at the exact same moment.
Third, threshold tuning versus WAN jitter and half-open sockets. Oracle Data Guard Broker enforces a minimum FastStartFailoverThreshold of 6 seconds and a default of 30 seconds. Setting the threshold near the 6-second floor across a cross-region WAN exposes the database to false-positive failovers during transient packet loss or BGP reconvergence. Conversely, if TCP connections between the observer and Primary hang in a half-open state during a silent hardware freeze, detection can stall unless Oracle Net SQLNET.RECV_TIMEOUT and OS TCP keepalives are tuned below FastStartFailoverThreshold. In MaxPerformance mode, FastStartFailoverLagLimit (minimum 5 seconds, default 30 seconds; ignored and defaulted to 0 in MaxAvailability) adds a second constraint: if standby apply lag exceeds the configured bound when the Primary fails, the observer blocks failover rather than violating the RPO target.
How do you design and orchestrate a witness tier that survives host and availability-zone failures, stays isolated from both database sites, and avoids false-positive failovers?
Options Considered
Platform teams typically evaluate four ways to host the Data Guard Observer before settling on a multi-region witness architecture.
| Option | What It Gets Right | Where It Breaks | Decision |
|---|---|---|---|
Bastion screen / tmux | Zero extra infrastructure; quick to launch during setup. | Dies silently on host reboot; no health checks, log shipping, or backup witness. | Rejected |
Single VM + systemd | Restarts dgmgrl automatically if the local process crashes. | Single VM remains a single point of failure during hypervisor or OS patching. | Rejected |
| Observer on Standby host | Survives a Primary site blackout without a third site. | Breaks three-site quorum; a Standby-only partition cannot distinguish Primary death from a link cut. | Rejected |
Multi-AZ Kubernetes StatefulSet in Site 3 | Independent failure domain, automated pod recovery, Master + Backup handoff, mTLS wallets. | Requires a third region/cluster and cross-region port 1521/2484 connectivity. | Chosen |
Running systemd on a single VM fixes process crashes but does not survive host maintenance, kernel upgrades, or availability-zone loss; while the VM is rebooting, the configuration sits unobserved with ORA-16819. Hosting the observer on the Standby server removes the need for a third site, but it collapses the witness into the Standby’s failure domain: if Site 2 loses WAN connectivity to Site 1, the Standby and colocated observer both lose sight of the Primary at once, creating the exact split-brain risk three-site quorum is meant to prevent. Only a dedicated third-site Kubernetes cluster running multiple observers across separate availability zones eliminates single-host and single-site blind spots without storing any database data in the witness tier.
Evaluating the network cost of the chosen architecture is equally straightforward. An observer exchanges lightweight Broker heartbeat messages over Oracle Net (port 1521 or 2484 for TCPS/mTLS) with the Primary and Standby DMON processes; it never receives redo streams or table blocks. Cross-region bandwidth consumption is negligible compared to redo transport, which means placing the witness tier in a third cloud region adds minimal network spend while buying true regional fault independence.
The Distributed Kubernetes Observer Quorum Architecture
Beginning with Oracle Database 12c Release 2 and continuing through 19c and 23ai, Data Guard Broker supports Multiple Observers. In Oracle 19c, a Broker configuration supports up to three registered observers: one Master Observer and up to two Backup Observers. In Oracle 23ai, that limit increases to four observers (one Master and up to three Backups).
Multiple observers do not vote as a multi-observer consensus quorum. Only the single Master Observer actively monitors the Primary and coordinates failover with the Standby. Backup observers stay connected in hot standby; if the Master Observer disconnects or its host fails, the Data Guard Broker (DMON) automatically promotes a healthy Backup Observer to Master. Administrators can control preference order using PreferredObserverHosts or force an immediate role change during planned cluster maintenance with SET MASTEROBSERVER TO <observer_name>.
Using a Kubernetes StatefulSet gives each observer pod a deterministic identity (billing-db-observer-0, billing-db-observer-1) via metadata.name. That deterministic naming keeps SHOW OBSERVER ALL and PreferredObserverHosts stable across pod restarts and image upgrades, unlike a Deployment whose random pod suffixes churn every time a replica is replaced.
Partition Behavior Across Three Sites
Separating Primary (Site 1), Standby (Site 2), and the Witness Tier (Site 3) produces deterministic outcomes under every single-site or link partition:
| Partition Scenario | Mutual Visibility | Broker Decision | Operational Result |
|---|---|---|---|
| Primary isolated (Site 1 outage) | Standby <—> Master Observer | Master + Standby agree Primary is unreachable past FastStartFailoverThreshold. | Standby promotes to Primary automatically. |
| Standby isolated (Site 2 outage) | Primary <—> Master Observer | Primary remains reachable by Master Observer. | Primary stays read/write; FSFO suspends until Standby resyncs. |
| Witness isolated (Site 3 WAN cut) | Primary <—> Standby healthy | Primary loses observer heartbeats and logs ORA-16819. | Primary stays read/write; automatic failover disabled safely. |
| Inter-site cut (Site 1 <—> Site 2) | Observer reaches both sites | Master Observer sees Primary is alive. | No failover; prevents split-brain writes. |
1. Container Image Using Full Oracle Database Client
A common build mistake is packaging Oracle Instant Client. Standard Instant Client packages (instantclient-basic and instantclient-tools) do not include the dgmgrl binary. The witness container must install the full Oracle Database Client (Administrator or Runtime installation) so dgmgrl and Oracle Wallet tools (mkstore / orapki) are present. Run the container as an unprivileged user and mount Oracle Wallets read-only from Kubernetes Secrets.
FROM oraclelinux:8-slim
RUN microdnf install -y oracle-database-preinstall-19c unzip && microdnf clean all
# Install Oracle Database 19c Administrator Client silently into /opt/oracle/client
# (Standard Instant Client does not ship the dgmgrl binary)
ENV ORACLE_HOME=/opt/oracle/client \
PATH=/opt/oracle/client/bin:$PATH \
TNS_ADMIN=/etc/oracle/wallets
USER oracle
COPY --chown=oracle:oinstall entrypoint.sh /home/oracle/entrypoint.sh
RUN chmod +x /home/oracle/entrypoint.sh
ENTRYPOINT ["/home/oracle/entrypoint.sh"]
2. Observer Lifecycle Wrapper
The entrypoint script uses exec so dgmgrl receives container signals directly, writes its runtime state file (fsfo.dat) to local ephemeral storage, and streams diagnostic logs to /dev/stdout for cluster log aggregation.
#!/bin/bash
set -euo pipefail
OBSERVER_NAME="${OBSERVER_NAME:-$(hostname)}"
CONNECT_ALIAS="${DATABASE_TNS_ALIAS:-BILLING_BROKER}"
STATE_DIR="/var/run/fsfo"
mkdir -p "${STATE_DIR}"
cleanup() {
dgmgrl -silent /@"${CONNECT_ALIAS}" "STOP OBSERVER ${OBSERVER_NAME};" || true
exit 0
}
trap cleanup SIGTERM SIGINT
exec dgmgrl /@"${CONNECT_ALIAS}" <<EOF
START OBSERVER "${OBSERVER_NAME}" FILE IS "${STATE_DIR}/fsfo_${OBSERVER_NAME}.dat" LOGFILE IS "/dev/stdout";
EOF
3. Multi-AZ Kubernetes StatefulSet
Deploy two or three replicas in Site 3 with podAntiAffinity on topology.kubernetes.io/zone so the Master and Backup observers never land on the same availability zone or worker node. Store fsfo.dat in an emptyDir volume rather than a ReadWriteOnce cloud block volume (such as EBS); if a pod reschedules after a node crash, a slow cloud volume detach leaves the new pod stuck waiting to acquire a lock on fsfo.dat.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: billing-db-observer
namespace: database-observers
spec:
serviceName: billing-observer
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: fsfo-observer
template:
metadata:
labels:
app.kubernetes.io/name: fsfo-observer
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app.kubernetes.io/name: fsfo-observer
topologyKey: "topology.kubernetes.io/zone"
containers:
- name: observer
image: internal-registry.example.com/database/fsfo-observer:19.23
env:
- name: DATABASE_TNS_ALIAS
value: "BILLING_BROKER"
- name: OBSERVER_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: tns-config
mountPath: /etc/oracle/wallets
readOnly: true
- name: state-storage
mountPath: /var/run/fsfo
livenessProbe:
exec:
command: ["/bin/sh", "-c", "pgrep -x dgmgrl >/dev/null"]
periodSeconds: 10
volumes:
- name: tns-config
secret:
secretName: billing-db-wallet-secret
defaultMode: 0400
- name: state-storage
emptyDir: {}
4. Broker Configuration in DGMGRL
Configure FastStartFailoverThreshold to match WAN stability (30 seconds is the default; 6 seconds is the hard floor). In MaxAvailability, synchronous redo transport already enforces zero data loss, so FastStartFailoverLagLimit is ignored and defaults to 0. Note that Corrupted Controlfile and other core health conditions are enabled by default when FSFO is activated, and can be verified with SHOW FAST_START FAILOVER.
CONNECT /@BILLING_PRIMARY AS SYSDG;
EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 30;
-- PreferredObserverHosts is a per-database property (set on each member that can hold the primary role)
EDIT DATABASE billing_primary SET PROPERTY PreferredObserverHosts = 'billing-db-observer-0,billing-db-observer-1';
EDIT DATABASE billing_standby SET PROPERTY PreferredObserverHosts = 'billing-db-observer-0,billing-db-observer-1';
ENABLE FAST_START FAILOVER;
SHOW CONFIGURATION;
SHOW OBSERVER ALL;
SHOW FAST_START FAILOVER;
How It Rolls Out
Rolling out a distributed witness tier to an existing Data Guard pair happens in four gated stages so an observer misconfiguration cannot trigger an unexpected failover during deployment.
- Stage 1 — Build Image and mTLS Wallet: Package the full Oracle Database Client 19c image, provision an auto-rotating Oracle Wallet (mTLS) or
SYSDGwallet secret in Kubernetes, and verifydgmgrl /@BILLING_BROKERconnects from a test pod in Site 3 without interactive prompts. Validatesqlnet.oraincludesSQLNET.RECV_TIMEOUTso stalled TCP connections fail fast rather than hanging pastFastStartFailoverThreshold. - Stage 2 — Deploy Multi-AZ StatefulSet: Apply the
StatefulSetin Site 3 withreplicas: 2(or3in 19c,4in 23ai) and pod anti-affinity. ConfirmSHOW OBSERVER ALLlists one Master Observer and the expected Backup Observers across distinct zones before enabling FSFO. Checkkubectl get pods -o wideto verify no two observer pods share a worker node or availability zone. - Stage 3 — Enable FSFO with Conservative Thresholds: Set
FastStartFailoverThreshold = 30(or higher for noisy WAN links) and runENABLE FAST_START FAILOVER. Gate onSHOW CONFIGURATIONreturningSUCCESSwith zeroORA-16819warnings, and confirmSHOW FAST_START FAILOVERdisplays the expected protection mode, threshold, and health conditions. - Stage 4 — Run Handoff and Isolation Drills: Terminate the Master Observer pod (
kubectl delete pod billing-db-observer-0) and verify the Broker promotesbilling-db-observer-1to Master without interrupting database writes. Next, testSET MASTEROBSERVER TO billing-db-observer-0once the pod recovers to verify deterministic failback. Finally, schedule a controlled Primary isolation drill in staging. Rollback at any stage isDISABLE FAST_START FAILOVER;, which immediately halts automatic promotion while leaving redo transport intact.
In Practice
The behavior above follows directly from Oracle Data Guard Broker’s documented architecture in 19c and 23ai:
- Master/Backup promotion without consensus voting: Oracle Data Guard Broker registers up to 3 observers in 19c (1 Master, 2 Backup) and up to 4 observers in 23ai. Only the Master Observer drives failover; backups exist purely for observer high availability so a single witness crash does not leave the configuration unobserved.
- Observer state isolation: Because
fsfo.datonly tracks observer runtime metadata for the localdgmgrlprocess, using pod-localemptyDirstorage avoids cloud block-volume attach races when Kubernetes reschedules a failed observer pod onto another node. - Protection mode coupling: In
MaxAvailability, synchronous redo transport prevents applied lag under normal health, whereas inMaxPerformance,FastStartFailoverLagLimit(minimum 5 seconds, default 30 seconds) acts as an explicit RPO guardrail that blocks failover if the Standby falls too far behind. QueryingV$DATAGUARD_STATS(apply lagandtransport lag) lets platform teams alert before standby lag crossesFastStartFailoverLagLimitand silently disables automatic recovery. - Health-condition triggers beyond network loss: When FSFO is enabled in Oracle 19c, core Primary health conditions such as
Corrupted Controlfileare enabled by default. Even if the Primary host and network remain reachable, the Master Observer can trigger failover whenDMONreports a fatal internal database fault, which makes isolating the witness tier from Primary storage and host failures essential.
Where It Breaks
Even a multi-AZ witness tier introduces operational failure modes across storage locking, asymmetric firewalls, credential rotation, and DNS caching.
| Condition | Breaks How | Detect | Mitigate |
|---|---|---|---|
| Witness colocated in Site 1 | Site 1 outage kills Primary and all observers simultaneously; Standby cannot fail over. | Cloud region/VPC audit of observer nodes vs Primary DB. | Enforce CI policy placing the witness cluster in an independent third region. |
FastStartFailoverThreshold set near 6s on WAN | Transient cross-region packet loss triggers unnecessary failover and connection churn. | Frequent observer reconnect warnings in drc*.log. | Keep FastStartFailoverThreshold at 30s or higher over WAN links. |
ReadWriteOnce PVC for fsfo.dat | Node crash leaves volume attached; rescheduled pod enters CrashLoopBackOff. | Pod stuck in ContainerCreating or Multi-Attach events. | Use ephemeral emptyDir storage per observer pod. |
Static SYS/SYSDG password expires | Master and Backup observers fail authentication together; FSFO drops to unobserved. | ORA-16819 in Broker status and auth errors in stdout. | Authenticate observers via mTLS Oracle Wallets rotated via External Secrets. |
| Asymmetric firewall drop on port 1521 | Observer cannot reach Primary, attempts failover; Standby rejects because Primary transport is live. | ORA-16819 or repeated failed failover attempts in Broker log. | Monitor Broker status continuously and alert on any ORA-16819 warning. |
Apply lag exceeds FastStartFailoverLagLimit | Primary crashes during batch load; observer blocks failover in MaxPerformance to cap data loss. | V$DATAGUARD_STATS apply lag approaching FastStartFailoverLagLimit. | Alert on apply lag before it hits the limit; throttle unindexed batch loads. |
Key Takeaways
- An Oracle Data Guard Observer running in
screenor on a single VM turns automated failover into a silent single point of failure (ORA-16819). - Standard Oracle Instant Client does not include
dgmgrl; witness container images must package the full Oracle Database Client. - Multiple observers (up to 3 in 19c, up to 4 in 23ai) provide Master/Backup redundancy, not multi-observer voting—only the Master Observer and Standby decide failover.
- Use
emptyDirrather thanReadWriteOncepersistent volumes forfsfo.datso Kubernetes pod rescheduling never stalls on cloud storage detach locks. - Keep
FastStartFailoverThresholdat or above the 30-second default across WAN links (6 seconds is the hard floor) and alignFastStartFailoverLagLimit(minimum 5 seconds) when runningMaxPerformance.
What to Do Next
- Problem: Single-host or colocated Data Guard Observers silently drop out of protection (
ORA-16819) or fail alongside the Primary site during regional outages. - Solution: Containerize the full Oracle Database Client (
dgmgrl) with mTLS Oracle Wallets and deploy Master and Backup observers as a multi-AZ KubernetesStatefulSetin a third independent region. - Proof: Run
SHOW OBSERVER ALLandSHOW CONFIGURATIONafter killing the Master Observer pod; confirm a Backup Observer assumes the Master role andORA-16819does not persist. - Action: Audit every Data Guard configuration this week with
SHOW OBSERVER ALLand relocate any single-host or Site-1-colocated observers into a dedicated multi-AZ witness cluster.