Automatic redirection with server groups
You can use the group option in the sqlhosts file to specify a server group to which applications connect instead of an individual database server. To make connection redirection automatic, add a database server definition for both the primary and secondary servers to the server group definition. By default, when a connection request is made to an HDR server group, the connection is routed to the primary server. If the primary server is unavailable, then the connection request is routed to the secondary server that gets promoted to the primary server after failover processing.
#dbservername nettype hostname servicename options
g_hdr group - - i=1
hdr_prim ontlitcp machine1pri port1 g=g_hdr
hdr_sec ontlitcp machine1sec port1 g=g_hdr
Applications
can use the following connectivity statements to support this method
of redirection:- CONNECT TO database@dbserver_group
- CONNECT TO @dbserver_group
If your applications contain code that tests if a connection has failed and issues a reconnect statement if necessary, redirection is handled automatically. The user has no responsibilities. If your applications do not include such code, users who are running clients must quit and restart all applications.