I often get called out to do SharePoint health checks – both environment and customisations. The people I’ve worked with know I’m an absolute nazi – if it’s not in the books then it should be pointed out. Although some tasks are individual to the case, I have a really long checklist that I always go through. One of the first items on that list is to backup everything I could. A responsible consultant should do so. I also like to be sure that there is a restore process in place, and that the client has tested it. I hate the feeling of going into a company knowing that their restore process is not good enough.
SharePoint 2010 has new feature that makes backing up SharePoint configuration settings much easier than what it was in 2007. Through Central Administration or Powershell you could “backup” the configuration of the farm without any content. In 2007 backing up the configuration database was supported, but restoring it was not. Only certain situations allowed it.
Central Administration
To backup your farm configuration, go to “Backup and Restore” in Central Administration, then click “Perform a backup”.
You will be taken to a screen which allows you to select the components to back up. Since we want the configuration, we must select the whole farm. Click “Next”.
The next screen is where it all gets interesting. In SP 2010 you get a new option, “Back up only configuration settings”. Select it, and specify a UNC file path where the timer service has rights to write to disk. Notice the required disk space and make sure you have enough. Don’t be worried if the backup is less than that, mine ended up 1MB.
Click “Start backup” and off you go. You can monitor the progress on the Timer Job Status page, or the Backup and Restore page:
Given that it is configuration only, it didn’t take long. Under 5 minutes.
Once complete, you could be enthusiastic and check out how SP backs things up. The folder will contain .BAK files, which are XML, and represent the objects and their properties as they lived within the configuration database.
The XML will be very familiar to developers.
Now, restoring is also interesting. You get the option to choose to restore to the “Same” server, or a new environment. If you select new, you get the option to input new names – databases, database servers, etc.
Go to “Backup and Restore” in Central Administration, then click “Restore from a backup”. Enter the folder where you placed your backup, and choose the latest one (there could be more than 1 backup in that folder).
Select the whole farm:
Notice the Restore Options on the same screen. “Same configuration” is for restoring to the same farm, “New configuration” is if you have different computer names, databases and other settings.
You can fire it off and monitor the progress:
And that’s pretty much it.
Powershell
To achieve the above with Powershell:
PS C:\Users\Administrator> Backup-SPConfigurationDatabase -Directory c:\spbackup -DatabaseServer devbox -DatabaseName SharePoint_Config -Verbose
Note, this will not get executed by the Timer service, so you will not find a timer job. You will, however, see the backup job in the Backup and Restore job status page. Also, Verbose is pretty nasty on the Powershell screen.
To restore from Powershell:
PS C:\Users\Administrator> Restore-SPFarm -Directory c:\spbackup -RestoreMethod Overwrite -ConfigurationOnly
The command will ask you to confirm.
Hope this helps!