August 18, 2014 at 9:10 am
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!
August 18, 2014 at 9:18 am
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
August 18, 2014 at 10:17 am
John: Thanks for your input!
August 19, 2014 at 3:55 am
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: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.
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
August 20, 2014 at 5:48 am
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" 😉
August 20, 2014 at 7:56 am
Thanks Perry!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply