SQL Server Clustering Management inside the command line

By:   |   Comments (6)   |   Related: > Clustering


Problem

Experienced SQL DBA's know their way around Failover Cluster Manager fairly well. The graphical tool is a great, but what kind of management tasks can I do when my Failover Cluster Manager freezes or something prevents me from starting the program?  In this tip we cover a few of the command line options for getting cluster status as well as for failing over.

Solution

There are numerous commands you can run to manage a SQL Cluster from the command line. Below I'll show you a few of these that include status checks and how to failover.

How to View SQL Clusters

This can be run from your workstation to view all SQL Clusters on the network you are connected to.

cluster /list

Cluster List

View Status of Nodes

You can run this to view the status of all nodes in the cluster.

cluster node 
--or 
cluster node /status

Cluster Node

View Status of Cluster Groups

You can run this to view the status for all cluster resource groups.

cluster group 
--or 
cluster group /status

Cluster Group

View Status of Cluster Networks

You can run this to view the cluster networks status.

cluster network 
--or 
cluster network /status

Cluster Network

View Properties of All Network Interface Devices

You can run this to view the status for all network interface devices.

cluster netinterface 
--or 
cluster netinterface /status

Cluster Netinterface

View Status of Cluster Resources

You can run this to get a listing of all available cluster resources.

cluster resource 
--or 
cluster resource /status

Cluster Resource

Failover Service to a New Node

You can run this to initiate a failover.

cluster group "groupname" /move:nodeName

Failover

In the figure above you can see where "SQL Server (ECS)" was moved to "TSTPSSQLCL04".

Next Steps
  • This tip only showed a few of the commands you can run against a SQL Server Cluster. To find more command you can run this command "cluster /?"
  • To view more tips about SQL Server Clustering check out the MSSQLTips library


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Brady Upton Brady Upton is a Database Administrator and SharePoint superstar in Nashville, TN.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article




Monday, June 1, 2015 - 4:22:18 PM - Steven K. Mariner Back To Top (37350)

Thanks!  Just paved the way to resolve about twenty outstanding items on my task list with this information.

 


Monday, June 16, 2014 - 9:35:08 AM - Cameron Francey Back To Top (32262)

This is fine for Windows Server 2008 R2 and earlier, but the cluster.exe command line tool has been removed so now would be a great time to learn the equivelents in PowerShell.  If you plan to move to Windows Server 2012 this is a must.

a few examples below to whet ones appetite:  there's lots of great blogs and posts on using PowerShell on the net with examples for most things you need.  There's a good chance someone will have already done what your trying so dont re-invent the wheel.

open powershell (run as administrator)

get-cluster

get-clusterresource

get-clusternode

get-clustergroup

stop-clusterresource -name <reource name>

move-clustergroup -name <role name to move> -node <destination node name>

 

this example moves all the resources on one node to the other, from testserver02 to testserver01

Get-ClusterNode testserver02 | Get-ClusterGroup | Move-ClusterGroup -node testserver01

 
 

 

 


Tuesday, April 22, 2014 - 2:34:26 PM - Julia Back To Top (30477)

What permissions are required on the server in order to execute all those commands? Let's say we - DBAs-  removed from local admin group on the cluster hosts - can we be in Users with Remote connections allowed or we need more permissions? Cannot find anything online.


Wednesday, April 16, 2014 - 2:20:18 AM - ravi Back To Top (30077)

Excellent Explanation


Tuesday, October 29, 2013 - 5:08:15 AM - srinivasu varma alluri Back To Top (27308)

i want to stop cluster sql services from command prompt.Please share the command


Monday, June 18, 2012 - 9:15:35 AM - Toots Back To Top (18084)

I cannot get these command to work on Windows 7 or Windows 2008.

C:\Windows\System32>cluster /list
'cluster' is not recognized as an internal or external command,
operable program or batch file.















get free sql tips
agree to terms