Pause capture during host maintenance¶
During regular maintenance of the source system, such as a nightly backup or a database reorganization, a Capture Agent that keeps reading the log may fail or get in the way. To pause it at the same time every day, set a daily maintenance window. A Db2 for i agent can also be paused and restarted on demand with IBM i commands, for example from the job that runs the backup.
For a one-off outage, just Stop the agent in the SQDR Control Center and Start/Restart it afterwards (see Stop).
A daily maintenance window (all source databases)¶
On the agent's Configuration tab, set sourceMaintenanceWindow to the time ranges when the
agent pauses: comma-separated HH[:mm]-HH[:mm], 24-hour time, in the time zone of the agent's Java process. A range
can cross midnight, for example 23:30-02:00. Empty (the default) never pauses.
What happens:
- When the window starts, the agent pauses within about 30 seconds: it stops reading the log, pruning and processing new publications, and stops writing to its log.
- When the window ends, the Launch Agent restarts the agent (a full stop and start, not a resume), and it continues reading the log where it left off.
- An invalid value is logged as SEVERE at startup (
Invalid Source Maintenance Window), and the agent then never pauses.
Don't confuse it with maintenanceWindow, which only limits when pruning runs (see
Control how staged changes are pruned).
Pausing on demand from IBM i (Db2 for i)¶
A Db2 for i Capture Agent also takes commands from the message queue CAQ in its schema on the source (usually
SQDR/CAQ; replace SQDR with the agent's schema if it's different). A user with authority to that queue can send
them, for example from the CL program that runs the backup.
At the start of the maintenance:
SNDMSG MSG(PAUSE) TOMSGQ(SQDR/CAQ) MSGTYPE(*INQ) RPYMSGQ(*LIBL/QSYSOPR)
At the end:
SNDMSG MSG(RESTART) TOMSGQ(SQDR/CAQ) MSGTYPE(*INQ) RPYMSGQ(*LIBL/QSYSOPR)
| Message | What the agent does |
|---|---|
PAUSE |
Pauses, as at the start of a maintenance window. |
RESTART |
Restarts through the Launch Agent, as at the end of a maintenance window. |
RESUME |
Resumes capture, pruning and publishing without restarting. |
STOP or END |
Stops the agent. |
- The agent creates
CAQwhen it starts. If the queue doesn't exist, the agent isn't running; a CL program should handle that case (for example withMONMSG). - The queue can exist while the agent isn't running, for example after the agent ended abnormally or lost its connection to the host.