DB2 Version 10.1 for Linux, UNIX, and Windows

START HADR command

Starts HADR operations for a database.

Authorization

One of the following authorities:

Required connection

Instance. The command establishes a database connection if one does not exist, and closes the database connection when the command completes.

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-START HADR ON--+-DATABASE-+--database-alias------------------>
                  '-DB-------'                   

>--+--------------------------------------+--------------------->
   '-USER--user-name--+-----------------+-'   
                      '-USING--password-'     

>--AS--+-PRIMARY--+----------+-+-------------------------------><
       |          '-BY FORCE-' |   
       '-STANDBY---------------'   

Command parameters

DATABASE database-alias
Identifies the database on which HADR operations are to start.
USER user-name
Identifies the user name under which the HADR operations are to be started.
USING password
The password used to authenticate user-name.
AS PRIMARY
Specifies that HADR primary operations are to be started on the database. database. If the primary database cannot connect to the HADR standby database within the time specified by the hadr_timeout database configuration parameter, the primary will not start.
BY FORCE
Specifies that the HADR primary database will not wait for the standby database to connect to it. After a start BY FORCE, the primary database will still accept valid connections from the standby database whenever the standby later becomes available. When BY FORCE is used, the database will perform crash recovery if necessary, regardless of the value of database configuration parameter autorestart. Other methods of starting a primary database (such as non-forced START HADR command, ACTIVATE DATABASE command, or client connection) will respect the autorestart setting.
Caution: Use the START HADR command with the AS PRIMARY BY FORCE option with caution. If the standby database has been changed to a primary and the original primary database is restarted by issuing the START HADR command with the AS PRIMARY BY FORCE option, both copies of your database will be operating independently as primaries. (This is sometimes referred to as split brain or dual primary.) In this case, each primary database can accept connections and perform transactions, and neither receives and replays the updates made by the other. As a result, the two copies of the database will become inconsistent with each other.
AS STANDBY
Specifies that HADR standby operations are to be started on the database. The standby database will attempt to connect to the HADR primary database until a connection is successfully established, or until the connection attempt is explicitly rejected by the primary. (The connection might be rejected by the primary database if an HADR configuration parameter is set incorrectly or if the database copies are inconsistent, both conditions for which continuing to retry the connection is not appropriate.)

Usage notes

The following table shows database behavior in various conditions:

Database status Behavior upon START HADR command with the AS PRIMARY option Behavior upon START HADR command with the AS STANDBY option
Inactive standard database Activated as HADR primary database. Database starts as an standby database if it is in rollforward-pending mode (which can be the result of a restore or a split mirror) or in rollforward in-progress mode. Otherwise, an error is returned.
Active standard database Database enters HADR primary role. Error message returned.
Inactive primary database Activated as HADR primary database. After a failover, this reintegrates the failed primary into the HADR pair as the new standby database. Some restrictions apply.
Active primary database Warning message issued. Error message returned.
Inactive standby database Error message returned. Starts the database as the standby database.
Active standby database Error message returned. Warning message issued.

When issuing the START HADR command, the corresponding error codes might be generated: SQL1767N, SQL1769N, or SQL1770N with a reason code of 98. The reason code indicates that there is no installed license for HADR on the server where the command was issued. To correct the problem, install a valid HADR license using the db2licm or install a version of the server that contains a valid HADR license as part of its distribution.