Stopping Db2 High Availability Disaster Recovery (HADR)

If you are using the Db2 High Availability Disaster Recovery (HADR) feature, stopping HADR operations to perform maintenance on the primary or standby databases might be necessary. Stop HADR operations only on the database that you are performing maintenance. To stop using HADR completely, stop HADR on both databases.

About this task

Warning: If you want to stop the specified database but you still want it to maintain its role as either an HADR primary or standby database, do not issue the STOP HADR command. If you issue the STOP HADR command the database will become a standard database and might require reinitialization in order to resume operations as an HADR database. Instead, issue the DEACTIVATE DATABASE command.
During upgrade to Db2 Version 11.1, the STOP HADR command can be issued on a Db2 Version 10.5 Fix Pack 7 or later database to change the database role to standard and to complete the upgrade process as a non-HADR database. To learn more, see Dealing with failures while upgrading Db2 servers in HADR environments (Version 10.5 Fix Pack 7 or later).

If for some reason the standby database is no longer required or there is an issue with the primary database the STOP HADR command can be issued on the standby database.

For an active standby database, an error message is returned. For a deactivated standby database, the HADR role is changed to STANDARD and the database is placed into rollforward pending. Issue the ROLLFOWARD DATABASE command with the STOP option to get the database out of rollforward pending state and then issue the UPGRADE DATABASE command to complete the upgrade process.
Note: If there is an issue with the standby database the STOP HADR command can be issued on the primary database. This changes the role to STANDARD and the UPGRADE DATABASE command can be issued to complete the upgrade process as a non-HADR database.

If you issue the STOP HADR command against a standard database, an error will be returned.

Procedure

To stop HADR operations on the primary or standby database:

  • From the CLP, issue the STOP HADR command on the database where you want to stop HADR operations.
    In the following example, HADR operations are stopped on database SOCKS:
    STOP HADR ON DATABASE SOCKS

    If you issue this command against an inactive primary database, the database switches to a standard database and remains offline.

    If you issue this command against an inactive standby database the database switches to a standard database, is placed in rollforward pending state, and remains offline.

    If you issue this command on an active primary database, logs stop being shipped to the standby database and all HADR engine dispatchable units (EDUs) are shut down on the primary database. The database switches to a standard database and remains online. Transaction processing can continue. You can issue the START HADR command with the AS PRIMARY option to switch the role of the database back to primary database.

    If you issue this command on an active standby database, an error message is returned, indicating that you must deactivate the standby database before attempting to convert it to a standard database.

  • From an application, call the db2HADRStop application programming interface (API).
  • From IBM® Data Studio, open the task assistant for the STOP HADR command.