With Oracle Active Data Guard, standbys may lag behind the primary database. A global service allows you to choose the acceptable lag tolerance for a given application. GDS routes requests to a standby database whose lag is below the limit. If the lag exceeds the lag limit, the service is relocated to another available standby database that lags below the threshold. New requests are routed to a standby database that satisfies the lag limit. If no standbys meet the threshold, the workload is routed to the primary database. When the lag is resolved or comes within the limit, GDS automatically brings up the service. 

With Oracle GoldenGate replication, when the lag exceeds the lag threshold defined for a service, that service is stopped on that database. The service is restarted if the lag comes back within the threshold. After the service has been stopped, the global service manager automatically performs failover processing. Any new connections to this service are directed elsewhere than the lagged database. So, if there are two databases in the pool, and the service is preferred_all with lag=10 initially, the service runs on both databases, and the connections are load-balanced. If the second database goes past the lag threshold, the service is stopped there, and any new connections are directed only to the first database. If the lag comes back within the threshold, the service is restarted, load balancing continues, and new connections can use the second database. If no replicas meet the threshold, the workload is routed to the primary database.

The diagram shows SALES GDS Pool in two different deployments setups:

Deployment 1: Replication Lag Aware Routing for Active-Active Oracle GoldenGate

GDSCTL>add service -service reporting_srvc -gdspool sales -preferred_all -lag 180

Specify replication lag limit for a service in seconds. In a single-replica setup, read-only (RO) workloads are served at the replica as long as the replication lag remains within the configured threshold. If the lag exceeds the threshold, the workload is failed over to the primary. In a multi-replica configuration, RO workloads are redirected to another replica within the acceptable replication lag limit. If no replicas meet the threshold, the workload is routed to the primary database.

Deployment 2: Replication Lag Aware Routing for Active-Passive Oracle Data Guard Standby

GDSCTL>add service -service reporting_srvc -gdspool sales -preferred_all -role PHYSICAL_STANDBY -lag 180

Specify replication lag limit for a service in seconds. In a single-standby configuration, RO workloads are served at the standby as long as the replication lag remains within the allowed threshold. If the threshold is exceeded, the workload is redirected to the primary. In a multi-standby setup, the workload is transitioned to another standby within the acceptable replication lag limit. If no standbys meet the threshold, the workload is routed to the primary database.

 

Example TNS Entry in Client A and Client B tnsnames.ora:

order_entry_srvc =

(DESCRIPTION=(CONNECT_TIMEOUT=90)(RETRY_COUNT=30)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=3)

 (FAILOVER=ON)

  (ADDRESS_LIST=

    (LOAD_BALANCE=ON)         

    (ADDRESS=(PROTOCOL=TCP)(HOST=GSM-EAST)(PORT=1522))

    (ADDRESS=(PROTOCOL=TCP)(HOST= GSM-EAST2)(PORT= 1522))

    (ADDRESS=(PROTOCOL = TCP)(HOST=GSM-EAST3)(PORT=1522))

)

  (ADDRESS_LIST=

    (LOAD_BALANCE=ON)    

    (ADDRESS=(PROTOCOL=TCP)(HOST=GSM-WEST)(PORT=1522))

    (ADDRESS=(PROTOCOL=TCP)(HOST= GSM-WEST2)(PORT= 1522))

    (ADDRESS=(PROTOCOL = TCP)(HOST=GSM-WEST3)(PORT=1522))

 )

 (CONNECT_DATA=

   (SERVICE_NAME=order_entry_srvc.sales.oradbcloud) (REGION=EAST)

)

Example TNS Entry in Client C and Client D tnsnames.ora:

reporting_srvc =

(DESCRIPTION=(CONNECT_TIMEOUT=90)(RETRY_COUNT=30)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=3)

 (FAILOVER=ON)

  (ADDRESS_LIST=

    (LOAD_BALANCE=ON)         

    (ADDRESS=(PROTOCOL=TCP)(HOST=GSM-EAST)(PORT=1522))

    (ADDRESS=(PROTOCOL=TCP)(HOST= GSM-EAST2)(PORT= 1522))

    (ADDRESS=(PROTOCOL = TCP)(HOST=GSM-EAST3)(PORT=1522))

)

  (ADDRESS_LIST=

    (LOAD_BALANCE=ON)    

    (ADDRESS=(PROTOCOL=TCP)(HOST=GSM-WEST)(PORT=1522))

    (ADDRESS=(PROTOCOL=TCP)(HOST= GSM-WEST2)(PORT= 1522))

    (ADDRESS=(PROTOCOL = TCP)(HOST=GSM-WEST3)(PORT=1522))

 )

 (CONNECT_DATA=

   (SERVICE_NAME=reporting_srvc.sales.oradbcloud) (REGION=WEST)

)