onmode and d arguments: Set data-replication types (SQL administration API)
Use the onmode and d arguments with the admin() or task() function to change the mode of a server participating in high-availability data replication (HDR).
Syntax
Element | Description | Key Considerations |
---|---|---|
ha_alias | The high-availability alias of the primary or secondary database server. | ha_alias must correspond to the HA_ALIAS configuration parameter in the ONCONFIG file of the intended secondary database server. |
Usage
Use this function to set the High-Availability Data Replication type as standard, primary, or secondary. You can use the standard argument when the database server is in quiescent, online, or read-only mode.
The ha_alias argument of the other database server in the data-replication pair and the type of a database server (standard, primary, or secondary) is preserved after reinitialization of shared memory.
The standard argument drops the connection between database servers in a data replication pair (if one exists) and sets the database server type of the current database server to standard. This option does not change the mode or type of the other database server in the pair.
The primary and ha_alias arguments set the database server type to primary and attempt to connect with the database server that ha_alias specifies. If the connection is successful, data replication is turned on. The primary database server goes into online mode, and the secondary database server goes into read-only mode. If the connection is not successful, the database server comes to online mode, but data replication is not turned on.
The secondary and ha_alias arguments set the database server type to secondary and attempt to connect with the database server that ha_alias specifies. If the connection is successful, data replication is turned on. The primary database server goes online, and the secondary database server goes into read-only mode. If the connection is not successful, the database server comes to read-only mode, but data replication is not turned on.
This function is equivalent to the onmode -d command.
Example
The following example sets a server named ids_stores as an HDR primary server:EXECUTE FUNCTION task("onmode","d","primary","ids_stores");