SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Automate SQL server restart in a clustered environment


Automate SQL server restart in a clustered environment

Author
Message
SQL!$@w$0ME
SQL!$@w$0ME
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2520 Visits: 1258
All,

I need to automate SQL server restart(daily due to performance issue- outside sql) in a clustered environment. What is the best way to accomplish this. If anyone can provide code/commands that would be great!
Environment:

Windows server 2008
Sql 2005 - 2 node (active/passive)

Many thanks in advance!
John Mitchell-245523
John Mitchell-245523
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35846 Visits: 16699
I recommend you investigate the reasons behind your performance issue before implementing this workaround. If you must do it, you can control the cluster from a command line - see this. I'm sure there are equivalent PowerShell commands as well, if you prefer that.

John
SQL!$@w$0ME
SQL!$@w$0ME
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2520 Visits: 1258
John: Thanks for your input!
EdVassie
EdVassie
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14601 Visits: 3904
If you really need to restart your SQL Server clustered instance, you need to use the cluster commands to put the SQL cluster group offline, then put it back online.

If you just stop SQL Server using a NET STOP command you may cause a failover to happen.

But John has good advice - you should find out why you think you need to restart SQL Server. The problem can almost certainly be solved without the need to restart SQL Server.

Original author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005. 14 Mar 2017: now over 40,000 downloads.Disclaimer: All information provided is a personal opinion that may not match reality.Quote: When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist. - Archbishop Hélder Câmara
Perry Whittle
Perry Whittle
SSC Guru
SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)

Group: General Forum Members
Points: 56371 Visits: 17729
John Mitchell-245523 (8/18/2014)
I recommend you investigate the reasons behind your performance issue before implementing this workaround. If you must do it, you can control the cluster from a command line - see this. I'm sure there are equivalent PowerShell commands as well, if you prefer that.

John

Since this is Windows 2008, the cluster.exe documentation is useless. The Powershell commands are

To import the Failovercluster Powershell module
import-module failoverclusters



List cluster groups
get-clustergroup


Stop a cluster group
stop-clustergroup "groupname"



Start a cluster group
start-clustergroup "groupname"



Rather than stopping the whole group just stop the SQL Server resource (takes the agent down too)
Get the resources using
get-clusterresource | ?{$_.resourcetype -match "SQL Server"}



Stop the sql server resource using
stop-clusterresource "sql server resource name"



Start SQL server resource by starting the agent first
start-clusterresource "sql agent resource name"



-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
SQL!$@w$0ME
SQL!$@w$0ME
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2520 Visits: 1258
Thanks Perry!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search