Database activation and deactivation in a high availability disaster recovery (HADR) environment
If a standard database is started by a client
connection, the database is shut down when the last client disconnects. If an HADR primary database
is started by a client connection, it is equivalent to starting the database by using the
ACTIVATE DATABASE command.
To shut down an HADR primary database that
was started by a client connection, you need to explicitly issue the DEACTIVATE
DATABASE command.
Database activation and deactivation in a high availability disaster recovery (HADR) environment
If a standard database is started by a client
connection, the database is shut down when the last client disconnects. If an HADR primary database
is started by a client connection, it is equivalent to starting the database by using the
ACTIVATE DATABASE command.
To shut down an HADR primary database that
was started by a client connection, you need to explicitly issue the DEACTIVATE
DATABASE command.
On a standard database in rollforward pending state, the ACTIVATE DATABASE and DEACTIVATE DATABASE commands are not applicable. You can only continue rollforward, stop rollforward, or use the START HADR command to start the database as an HADR standby database. Once a database is started as an HADR standby, you can use the ACTIVATE DATABASE and DEACTIVATE DATABASE commands to start and stop the database.
Activate a primary database using the following methods:
- client connection
- ACTIVATE DATABASE command
- Task assistant for the ACTIVATE DATABASE command in IBM® Data Studio
- START HADR command with the AS PRIMARY option
Deactivate a primary database using the following methods:
- DEACTIVATE DATABASE command Note: If you deactivate an HADR primary database that is in disconnected peer state using the DEACTIVATE DATABASE command or the sqle_deactivate_db API, the database will be in an inconsistent state. The database will require crash recovery upon restart and no offline backups can be taken of this database until it is restarted.
- Task assistant for the DEACTIVATE DATABASE command in IBM Data Studio
- db2stop command with the FORCE parameter
Activate a standby database using the following methods:
- ACTIVATE DATABASE command
- Task assistant for the ACTIVATE DATABASE command in IBM Data Studio
- START HADR command with the AS STANDBY option
Deactivate a standby database using the following methods:
- DEACTIVATE DATABASE command
- Task assistant for the DEACTIVATE DATABASE command in IBM Data Studio
- db2stop command with the FORCE parameter
Recommended order for shutting down an HADR pair
Warning: Although the STOP HADR command can be used
to stop HADR on the primary or the standby, or both, it should be used with caution. If you want to
stop the specified database but still want it to maintain its role as either an HADR primary or a
standby database, do not issue the STOP HADR command. If you issue the
STOP HADR command, the database becomes a standard database and might require
reinitialization in order to resume operations as an HADR database. Instead, issue the
DEACTIVATE DATABASE command.
If you only want to shut down the HADR operation, this is the recommended way of shutting down the HADR pair:
- Deactivate the primary database
- Stop Db2 on the primary database
- Deactivate the standby database
- Stop Db2 on the standby database