Friday, May 27, 2011

Setting Failover Partners for Sharepoint 2010

So one of the best things about Sharepoint 2010 over MOSS is that it allows for you to configure failover partners vs having to do a workaround held together with shoelaces and gum.  Many can be set via Central Administration, as seen below for many Application Services, the Content DB's, Config DB's etc.
However there are many to which you cannot and requires powershell.  If you're like me, and you have never used powershell before, this is a little intimidating at first "having" to use it.  I knew stsadm inside and out but never had a need to use PowerShell... well I've come to love this little gem ;)  It's handy and simple, so don't fear.

I've seen several variations of the commands but below is the only tried and true way I was able to get ALL the db's set with failovers.  I have found some commands work for some and not others, some can be set in CA  etc.  Since the following works for ALL db's I try to simplify my life and use only that one :)

First Open SharePoint Management Shell.  ***Note you must be logged into PS as the Farm Account to set the failovers, a farm admin does not have sufficient rights to do this.***
To find out your databases on the farm use (this will also give you the GUID to the DB that you need later)
to see which are configured for failover use
get-spdatabase | select name, failoverserver 

$db = get-spdatabase 9835a946-272f-4e9d-b85b-0dcd79297e21 <-- this is your GUID from get-spdatabase)
$db <-- this is to verify you have the right DB
$db.AddFailoverServiceInstance("SQL02") <-- insert your failover SQL server in the ("")

I then usually run get-spdatabase | select name, failoverserver  just to verify it has been set.

TechNet gives you a good listing on which DB's can be mirrored and failover and which cannot found here

1 comment: