Database Backup / Restoration

Vahe Voskanian -

This process requires knowledge of SharePoint powershell and SQL server management studio. You will need to run t-sql commands on specific database. This can be easily done easily with the help of a SharePoint Administrator and DBA.

Backup Settings DB

Please back up prime settings database used in destination farm before you do below steps

Get Farm Ids

  • Login to source farm WFE as farm administrator
  • Run SharePoint 2010 Management shell as administrator
  • Run following script and copy farm id value. We will call it SourceFarmId

$f = Get-SPFarm

See below image for reference.



  • Also find SourceSiteId and SourceWebId by typing following command as per below image:


  • Login to destination farm WFE as farm administrator
  • Run SharePoint 2010 Management Shell as administrator
  • Run the same powershell script as above and copy the farm id value. We will call it DestinationFarmId, DestinationSiteId and DestinationWebId
  • Next get webId by typing following commands

Fix SQL entries

  • Connect to sql server of destination farm using sql server management studio with appropriate credentials.
  • Open new query window and select prime settings database as current database.
  • Now copy and paste following script into the new query window
  • Paste SourceFarmId value beween ‘’ in line 2 below
  • Paste DestinationFarmId value between ‘’ in line 4 below
  • Execute the query.

declare @sourceFarmId  varchar(max)

set @sourceFarmId = ''

declare @disasterFarmId varchar(max)

set @disasterFarmId = ''


update UserSettings

set SettingID = REPLACE(SettingID,@sourceFarmId , @disasterFarmId)

where SettingID like '%'+@sourceFarmId+'%'


Please see following image for reference.



  • Repeat the process of to replace sourceSiteId and sourceWebId with destinationSiteId and detinationWebId.

Also update this in WebId field of the same table by applying following sql commands
declare @sourceSiteId nvarchar(100),

              @destinationSiteId nvarchar(100),

              @sourceWebId nvarchar(100),

              @destinationWebId nvarchar(100)


update UserSettings


       webId = @DestinationSiteId

where webId = @sourceSiteId


update UserSettings


       webId = @destinationWebId

where webId = @sourceWebId





  • After applying the above fix, all of your source farm settings should start working in your destination farm.
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk