rp_switch

Description

Manually switches user connections to an alternate Adaptive Server.

NoteYou can also use the OpenSwitch Manager to switch connections between Adaptive Servers. See “Switching connections from Adaptive Server” for more information.

Syntax

rp_switch [pool_name], [src_server], [spid], [dst_server], [grace_period], [force]

Parameters

pool_name

All connections established through the pool_name you specify are switched to the server specified by dst_server. If you do not supply this parameter, or specify NULL, all pools are assumed.

src_server

All the connections that are currently established to this remote server (src_server) switch to the dst_server. If you do not supply this parameter, or specify NULL, all servers are assumed.

spid

The OpenSwitch spid to be switched to the remote server dst_server. If you do not supply this parameter, or specify NULL, all spids are assumed.

dst_server

The remote server to which all connections identified by pool_name, srv_server, and spid should be switched. If you do not supply this parameter, or specify NULL or “”, the connections are switched to the first available server as identified by their associated pool.

Use care when specifying this parameter. No verification is performed for dst_server. Passing an invalid value causes all incoming client connections to be lost.

grace_period

The maximum number of seconds to wait before forcefully switching busy connections. A value of 0 indicates that no grace period is to be enforced.

force

If passed with a value of 1, all connections are forcefully switched, even if they are currently busy (either actively in the middle of communicating with a remote server, or in the middle of an open transaction). If you do not supply a value, or specify NULL, the value defaults to 0.

Examples

Example 1

Causes OpenSwitch spid number 8 to be switched to the remote server SYB_SERV1. If the spid does not successfully switch in 60 seconds, its current query is canceled and the client receives a “deadlock” message, and the connection is then switched.

rp_switch NULL, NULL, 8, "SYB_SERV1", 60, 0

Example 2

Switches all connections established through POOL_A to SYB_SERV1 immediately. Any busy connections receive a “deadlock” message and the current query is canceled.

rp_switch "POOL_A", NULL, NULL, "SYB_SERV1", 0, 1

Example 3

Switches all connections to SYB_SERV1, established through POOL_A to SYB_SERV2, within 60 seconds.

rp_switch "POOL_A", "SYB_SERV1", NULL, "SYB_SERV2", 60, 
    0

Example 4

Switches all connections in POOL_A to the next available server (as defined by the mode of the pool) within 60 seconds.

rp_switch "POOL_A", NULL, NULL, NULL, 60, 0

Example 5

Switches all existing connections to OpenSwitch to the next available server within the pool associated with each connection. There is no limit on how long the switching process is to take.

rp_switch 

Usage


Messages

See also

rp_who