High Availability Guide : Administering and configuring HotStandby : Administering HotStandby with ADMIN COMMANDs (HotStandby API) : Checking HotStandby status
  
Checking HotStandby status
You can request information about the HotStandby status from both the Primary and Secondary servers.
Procedure
To check status, issue the following command in the Primary or Secondary server:
ADMIN COMMAND 'hotstandby status option';
where option can be one of the following:
Option
Description
catchup
Indicates whether the server is doing catchup. Catchup occurs after the Primary server connects to the Secondary. During catchup, the Primary sends accumulated transaction logs so that the Secondary can apply the changes. Possible values are: “ACTIVE” and “NOT ACTIVE”.
connect
Shows whether the last attempt to connect the servers was successful.
copy
Shows whether the last attempt to copy/netcopy was successful.
switch
Shows whether the last attempt to switch the server into PRIMARY ACTIVE or SECONDARY ACTIVE state was successful.
Example
ADMIN COMMAND 'hotstandby status catchup';
See also
Displaying switch status information
Displaying connect status information
Displaying connection information
Displaying role start time
Administering HotStandby with ADMIN COMMANDs (HotStandby API)
Displaying switch status information
You can use the ADMIN COMMAND 'hotstandby status switch' command to verify whether a state switch occurred between two HotStandby servers.
About this task
To check HotStandby switch status information:
Procedure
Issue the following command in the Primary or Secondary server:
ADMIN COMMAND 'hotstandby status switch';
When no prior switch has occurred between the two servers, the following message is displayed: NO SERVER SWITCH OCCURRED BEFORE.
When the switch process is still active, the following message is displayed: ACTIVE.
When the most recent prior switch process has completed successfully, the following message is displayed: SUCCESS.
When the most recent attempt to switch has failed, the following message is displayed: ERROR number, where number identifies the type of error that occurred during the switch.
See also
Checking HotStandby status
Displaying connect status information
You can query connect status information between the Primary and Secondary servers. This capability is equivalent to the SQL function HOTSTANDBY_CONNECTSTATUS, which you can use in the application code.
Procedure
To check connect status, issue the following command in the Primary or Secondary server:
ADMIN COMMAND 'hotstandby status connect';
The possible return values are:
Error code
Text
Description
0
CONNECTED
Connect active. Returned from both the Primary and Secondary server.
14007
CONNECTING
Primary server is connecting to the Secondary server. Returned from both the Primary and Secondary servers.
14008
CATCHUP
Primary server is connected to the Secondary server, but the transaction log is not yet fully copied. Returned from both the Primary and Secondary server.
14010
DISCONNECTING
The servers are in the process of disconnecting.
14537
BROKEN
Connection is broken. Returned from both the Primary and Secondary servers.
See also
Checking HotStandby status
Displaying connection information
You can query the connection information that the HotStandby server uses to connect to the other server by using the ADMIN COMMAND 'hotstandby cominfo' command.
Procedure
To display connection information, issue the following command in the Primary or
Secondary server:
ADMIN COMMAND 'hotstandby cominfo';
The command returns the connection information that is defined with the HotStandby.Connect parameter.
See also
Checking HotStandby status
Displaying role start time
Sometimes it is important to know when the server entered the current role of Primary or Secondary.
You can retrieve information about the start time of the Primary or Secondary role by using the ADMIN COMMAND 'info' command with the options primarystarttime and secondarystarttime.
For example:
admin command 'info primarystarttime';
       RC TEXT
       -- ----
       0 2005-06-09 14:22:18
admin command 'info secondarystarttime';
       RC TEXT
       -- ----
       0 2005-06-09 18:24:44
The reported time is the time the server role became Primary or Secondary. The STANDALONE state is considered to be a state of the Primary role.
The primary start time is set when the following transitions occur:
SECONDARY ALONE => PRIMARY ALONE
SECONDARY ALONE => STANDALONE
SECONDARY ACTIVE => PRIMARY ACTIVE
The secondary start time is set when the following transitions occur:
The server is started in the SECONDARY ALONE state
OFFLINE (started with -x backupserver) => SECONDARY ALONE
PRIMARY ALONE => SECONDARY ALONE
STANDALONE => SECONDARY ALONE
PRIMARY ACTIVE => SECONDARY ACTIVE
If the current role contradicts the query, the query returns an empty string. For example, if the role is SECONDARY and the command info primarystarttime is issued, it returns an empty string.
See also
Checking HotStandby status