DB2 Version 9.7 for Linux, UNIX, and Windows

Replay-only window on the active standby database

When an HADR active standby database is replaying DDL log records or maintenance operations, the standby enters the replay-only window. When the standby is in the replay-only window, existing connections to the standby are terminated and new connections to the standby are blocked (SQL1776N Reason Code 4). New connections are allowed on the standby after the replay of all active DDL or maintenance operations has completed.

The only user connections that can remain active on a standby in the replay-only window are connections that are executing DEACTIVATE DATABASE or TAKEOVER commands. When applications are forced off at the outset of the replay-only window, an error is returned (SQL1224N). Depending on the number of readers connected to the active standby, there may be a slight delay before the DDL log records or maintenance operations are replayed on the standby.

There are a number of DDL statements and maintenance operations that, when run on the HADR primary, will trigger a replay-only window on the standby. The following lists are not exhaustive.

DDL statements
Maintenance operations
Other operation or actions

Monitoring the replay-only window

To monitor a replay-only window on an active standby, use the db2pd command with the -hadr option. In the example, below the three pertinent elements are:
  • ReplayOnlyWindowStatus, which indicates whether DDL or maintenance-operation replay is in progress on the standby. Normally, the value is "Inactive", but when the replay-only window is active, the value is "Active".
  • ReplayWindowStartTime, which indicates the time at which the current replay-only window (if there is one) became active.
  • MaintenanceTxCount or DDLTxCount, which indicates the total number of existing uncommitted DDL or maintenance transactions executed so far in the current replay-only window (if there is one).
db2pd -db hadrdb -hadr
Database Partition 0 -- Database HADRDB -- Active -- Up 0 days 00:00:06

HADR Information:
Role    State		SyncMode HeartBeatsMissed   LogGapRunAvg (bytes)
Standby Peer		Nearsync 0                  0                   

ConnectStatus ConnectTime                           Timeout   
Connected     Sat Jun 15 03:09:35 2008           120       

ReplayOnlyWindowStatus       ReplayOnlyWindowStartTime           MaintenanceTxCount
Active                       Sun Jun 16 08:09:35 2008            5                       

LocalHost		LocalService      
skua     		52601             

RemoteHost		RemoteService		RemoteInstance    
gull      		52600        		vinci             

PrimaryFile  PrimaryPg  PrimaryLSN        
S0000000.LOG 1          0x000000000137126F

StandByFile  StandByPg  StandByLSN        
S0000000.LOG 0          0x000000000137092E

Recommendations for minimizing the impact of the replay-only window

Because replay operations on an HADR standby take priority over readers, frequent read-only windows can be disruptive to readers connected to or attempting to connect to the standby. To avoid or minimize this impact, consider the following recommendations:
  • Run DDL and maintenance operations during a scheduled maintenance window, preferably at off-peak hours.
  • Run DDL operations collectively rather than in multiple groups.
  • Run REORG or RUNSTATS only on the required tables instead of all tables.
  • Terminate applications on the active standby using the FORCE APPLICATION command with the ALL option before running the DDL or maintenance operations on the primary. Monitor the replay-only window to determine when it is inactive, and redeploy the applications on the standby.