Lately I’ve been diving into the options of backing up SharePoint 2013. It’s a big and important topic, so today I’m going to show you how to backup your SharePoint 2013 farm configuration. I’ll also show you how to restore a SharePoint 2013 farm configuration and give you some use cases for when doing this is a good idea. All right, let’s dive in!
The farm configurationis all of the items that make a farm your farm. It’s stored completely as a database in SQL. It’s the first database created when you create your SharePoint 2013 farm, and whenever you add a server to (or remove one from) the farm, the farm configuration database keeps those changes. (For more info, check out “Create a SharePoint 2013 Farm Configuration with PowerShell.”) A farm configuration keeps all of the information about how your farm is set up, from the service applications running on the farm to the web applications running on it.
However, when you talk about backing up the farm configuration the one thing you’re specifically excluding from your backup is the content in your SharePoint farm. Backing up the farm configuration keeps the farm straight, but not a single document is going to be included in the backup.
The first-use case is for pilot, development, and test farms. In those farms, the content was put in with no intention of the farm being the actual repository of the information. If the content goes away, it’s not going to impact you because the documents still live on a file share or on your own hard drive. In those cases, you do not need to backup the farm content – you’re only worried about backing up the configuration.
Backing up the farm configuration is useful for doing a migration from one farm to another. For instance, in cases where you’re ready to move to a production SharePoint farm and you want the environment to be the same as it is in the test, but you will be starting over with new content.
You need some permissions on both the configuration database and on the server on which you’re running the SharePoint Command Shell.
You also need a directory on which to put the backup. This can be a network share or a local file, but the backup will finish faster if you use a local directory. Then you can transfer the file across the network after it’s done.
This is the most likely scenario. Occasionally, you want to connect to a different farm or to a restored configuration database that is no longer part of any farm, but most of the time this is what you want to do.
You can do this either through Central Administration or from the SharePoint PowerShell commands. I’ll go through both methods.
Notice that at the Backup and Restore Job Status page there is now an indicator that a backup job is running (see below). This may take a few seconds to kick off, so if you think it should be running and it isn’t, then count to ten and refresh the page.
Backing it up with PowerShell is even easier. Way fewer clicks.
Backup-SPFarm –ConfigurationOnly -Verbose –Directory “C:\Backups\ConfigOnly” –BackupMethod Full
Again, this is not what you’ll usually do, but if you have a configuration database that is no longer part of a farm of which you want to backup just the configuration, you have to use PowerShell. Central Administration will only work to backup the current farm configuration.
Luckily, the PowerShell command is not much more complicated. In its simplest form, it’s just the following:
Backup-SPConfigurationDatabase –DatabaseName “Restored_ConfigDatabase” –Directory “C:\Backups\OldFarmConfig”
There are some additional items you may need to know to make this happen. There is a parameter called DatabaseServer, but it uses the local host as the default. If you’re not running this from the SQL server then you need to provide that. Also, in the case that SQL credentials were used on the old database, then you can provide credentials using the DatabaseCredentials parameter.
Just like backing up the farm configuration, you can restore the farm configuration using either Central Administration or PowerShell
At the next screen, take the following actions:
Open the SharePoint Management Shell. Enter the following command at the prompt:
Restore-SPFarm –Directory “C:\backups\ConfigOnly” –RestoreMethod Overwrite –ConfigurationOnly –Force
Notes about the Restore-SPFarm parameters: There are two acceptable options for the RestoreMethod parameter:
This command will restore the most recent backup stored in that backup location. If you want to specify an older backup to restore, then you need to supply it as a GUID to the –BackupID parameter. You can get the GUIDs for the backups by running the Get-SPBackupHistory cmdlet.
This covers the basics of what you need to know to backup and restore your farm configuration. You should test this process first by incorporating it into a backup and recovery plan for your SharePoint infrastructure. Also, it’s good to know that backing up the farm configuration is not enough to save your content. So use this as a tool and as part of your overall strategy – but don’t think that you’ve done all you need to by just saving your farm configuration.
Tagged farm configuration