Initiates a manual failover from base instances to failover instances.
sp_cluster logical, “failover”, lc_name, { cluster[, to_instance_list[, wait_option[, timeout[, @handle output ]]] | instance, from_instance_list, to_instance_list[, wait_option[, timeout[, @handle output ]]] }
lc_name – is the name of a logical cluster.
cluster – specifies the failover of the entire logical cluster.
to_instance_list – is a list of predefined failover instances. A value of NULL activates the first failover group.
wait_option – is how the time of the action is to be recorded. Values are:
wait – indicates that existing connections are given a specified amount of time (or an infinite amount of time if no timeout is given) to migrate or disconnect.
nowait – indicates that existing connections are migrated or disconnected immediately.
until – indicates that existing connections are given until a specific time of day to migrate or disconnect.
timeout – is a specific amount of time (when used with wait) or a specific time (when used with until). The format is "hh:mm:ss" according to a 24-hour clock. For example, timeout records 11:30 pm as 23:30:00.
@handle output – specifies that an action handle is to be retrieved for the failover.
instance – specifies that only selected instances in the logical cluster are to fail over.
from_instance_list – is a list of instances that are to be taken offline.
Example 1 Fails over the “SalesLC” logical cluster to the first group of predefined failover resources. The failover waits 2 minutes before terminating connections.
declare @out_handle varchar(15) execute sp_cluster logical, "failover", SalesLC, cluster, NULL, wait, "00:02:00", @handle = @out_handle output
Action '2' has been issued for the 'failover cluster' command.Logical Cluster Handle Action From To State InstancesWaiting ConnectionsRemaining WaitType StartTime Deadline CompleteTime --------------- ----------- -------------------------------- -------- -- ---------------- ---------------- -------------------- -------- -------------------------- -------------------------- -------------------------- SalesLC 2 failover cluster 2, 4 NULL complete 0 0 wait Nov 15 2007 3:23PM Nov 15 2007 3:25PM Nov 15 2007 3:23PM Remember to issue the `sp_cluster logical, action, <logical cluster name>, release, <handle>' command for any cancelled or completed actions.
Example 2 “SalesLC” is running on “ase1” and “ase2”. In this example, “ase1” fails over to “ase3”, and “SalesLC” continues to run on “ase2”. No wait option is specified, so it defaults to an indefinite wait.
sp_cluster logical, "failover", SalesLC, instance, ase1, ase3
Action '1' has been issued for the 'failover instance' command. Logical Cluster Handle Action From To State InstancesWaiting ConnectionsRemaining WaitType StartTime Deadline CompleteTime --------------- ----------- ---------------------------------- ---- -- ---------------- ---------------- -------------------- ---------------- -------------------------- -------------------------- -------------------------- SalesLC 1 failover instance 1 4 complete 0 0 infinite Nov 15 2007 3:06PM NULL Nov 15 2007 3:06PMRemember to issue the `sp_cluster logical, action, <logical cluster name>, release, <handle>' command for any cancelled or completed actions.