There are times when you don’t want to restore all of the data in your SharePoint farm, but you need to backup and restore one of your service applications. Whether you’re backing up a service application before a lot of changes are made, or whether you’re setting up a development environment and want to duplicate the data held in the Managed Metadata service, you can use either PowerShell or Central Administration to perform granular backups of just a single service application.
Service Application Backup Options
You can backup service applications using either PowerShell or Central Administration. In general, PowerShell is a little harder initially because you have to get the whole path for the item to be backed up first. But once you have the full path of the service application, it’s actually easier to use PowerShell to bypass multiple pages of settings.
Central Administration is easy to use, and if you’re not completely comfortable with PowerShell, it’s there for you. However, you should at least get familiar with the PowerShell way of doing things.
Backup SharePoint 2013 Service Applications with PowerShell
Backing up a service application in SharePoint 2013 with PowerShell is basically two parts: finding the path of the service application, and then backing it up with the Backup-SPFarm cmdlet and the –item parameter.
Finding the path of a service application in SharePoint 2013
Open the SharePoint Administration Shell and enter: Backup-SPFarm -ShowTree
This will display the entire hierarchy if items that can be backed up using the Backup-SPFarm cmdlet.
Choose the service application that you want to backup, take note of the name exactly as displayed in the tree.
Now that you have the name of the service application, the easiest way to get the path is to feed the name back into the Backup-SPFarm command. If there is ambiguity, then you will be given a list of the paths that match your Service Application Name. If there was no proxy and there is only one item with that name, then it will prompt you for a directory to save your backup and you’re off and running.
Now you have the full path that you can either put into the clipboard, save as a variable, or type into the Backup-SPFarm cmdlet.
Backup a Service Application in SharePoint with PowerShell
Use the Backup-SPFarm cmdlet again, now with the full path. You need to specify to which directory to save, and whether to backup a full or a differential copy.
You can backup a service application into the same directory multiple times. This is helpful because later I’ll show you how you can identify a backup history for a given directory, and you can see when the last full and differential backups were taken.
Use this PowerShell cmdlet to backup a Service Application. In this case I’m using the SecureStoreService.
Backup-SPFarm –Item “Farm\Shared Services\Shared Service Applications\SecureStoreService” –Directory “C:\Backups\Services\SecureStoreService” –BackupMethod Full
Backup a Service Application in SharePoint with Central Administration
While it’s easier to identify the necessary steps, the Central Administration path takes more steps to complete. Still, you can very easily backup the same Service Applications in nearly the same way.
Open Central Administration. Select Backup and Restore. Then click Perform a Backup. Click Next. On the next page, find and expand the “Shared Service Applications” heading. Once expanded, check the box next to “SecureStoreService.” Click Next.
On the backup options page, enter a path where you’ll save the backup. Choose backup type (full or differential) and click Start Backup.
Restore Service Applications in SharePoint 2013
Just like backing up, you can choose your weapon to restore service application backups. Either PowerShell or Central Administration can serve your needs.
Restore a Service Application with PowerShell
By using the Restore-SPFarm command, you can get your service applications back from your saved backup copy.
Restore-SPFarm –Directory “C:\Backups\Services\SecureStoreService” –BackupMethod Overwrite
This makes an assumption that you want to use the most recent backup stored in that location. If you want to use an older backup, you need to specify the backup ID, which you can get from the Get-SPBackupHistory cmdlet.
The Get-SPBackupHistory is really easy to use. You just need to tell it which directory to look in with the –directory parameter, and you’ll get a list of all of the backups and restores that have taken place and relevant information like the ID, and whether it was a full or differential backup.
Restore a Service Application with Central Administration
In Central Administration, select Backup and Restore, and then choose Restore from a backup.
On the Perform a Restore page, enter in the directory of the backup location. A list of backups for that location are displayed. Choose the backup that you want to restore. Click Next.
On the Choose Farm Resources to restore, a full tree view of the farm is shown again, even though you’re only restoring a subsection of the farm. Expand the Shared Service Applications node and select the service application that you’re restoring. Click Next.
A Note about Restoring
Some of the service applications have specifics that they are looking for. The specifics will be slightly different if you are trying to make a new service application, or restoring an existing one.
If you’re restoring a service application, you should use the “overwrite” type of restore, and if you’re creating a new copy of the service application you should use the “new” restore method.
SQL Backups for Service Applications with Database Content
There are five service applications that hold content in databases that you can backup directly from SQL. You can’t get both the service application settings and the content this way, but you can usually recreate the service applications without much trouble and then just leverage the content from the backed up service applications by performing a database restore from your SQL backup and set the destination to be the new service application database.
The service applications components that you can backup directly from SQL are:
– Search Administration (but not the index)
– Business Data Connectivity
– Secure Store
– User Profile Service social database
– User Profile Service profile database
– Managed Metadata
Those databases can be backed up and restored through the SQL Server Management Studio. Using this approach, you can easily create a service application on a new farm, and then use SQL Server Management Studio to restore the backed up copy of the service application database over the newly created one.
Keep in Touch
How did you service application backup and restore go? Did you try it through PowerShell or Central Administration? Let me know in the comments below, or you can always find me on Twitter, Facebook, or on my personal blog.