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 START HADR 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
- START HADR command with the AS PRIMARY option
- Task assistant for the ACTIVATE
DATABASE or START HADR command in IBM® Data Studio
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.
- db2stop command with the FORCE option
- Task assistant for the DEACTIVATE
DATABASE or db2stop command in IBM Data Studio
Activate a standby database using the following methods:
- ACTIVATE DATABASE command
- START HADR command with the AS STANDBY option
- Task assistant for the ACTIVATE
DATABASE or START HADR command in IBM Data Studio
Deactivate a standby database using the following methods:
- DEACTIVATE DATABASE command
- db2stop command with the FORCE option
- Task assistant for the DEACTIVATE
DATABASE or db2stop command in IBM Data Studio
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 re-initialization 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