Introduction
This posting walks you through the process of restoring one or more content databases to a SharePoint Server 2013 farm web application. This procedure can be used to restore a production farm web application or even to "refresh" a 2013 development environment with the latest content from the production site, via just the production site content databases or a backup of these databases. It assumes a farm having a single SQL Server database.
Procedure
Notes
This posting walks you through the process of restoring one or more content databases to a SharePoint Server 2013 farm web application. This procedure can be used to restore a production farm web application or even to "refresh" a 2013 development environment with the latest content from the production site, via just the production site content databases or a backup of these databases. It assumes a farm having a single SQL Server database.
Procedure
- Identify the web application that you want to restore.
- Identify the content database(s) of this web application and their location.
- Logon as administrator (not the farm administrator) to the SQL Server of the target farm.
- Create a local folder, and copy to this folder the full backups of the content databases that you want to restore.
- Logout.
- Login as the Farm Setup User Administrator account (eg, spAdmin) to a SharePoint server of the target farm.
- Launch Central Administration
- Navigate to Application Management > Databases > Manage content databases.
- Select the appropriate web application from the Web Application dropdown.
- Click on the title of a content database.
- Enable the option, Remove content database, and then click OK at the popup prompt.
- Click OK again.
- Logout.
- Login to the target farm's SQL Server as administrator.
- Launch SQL Server Management Studio with elevated privileges (right-click).
- In Object Explorer, expand the tree to find the content databases.
- Right-click, point to Tasks and then click Detach...
- Select the database to be detached.
- Enable the Drop Connections option, and then click OK.
- Repeat for each content database associated with this web application.
- Open Windows Explorer, and then navigate to the folder containing the SQL Server databases. This will usually be of the form:
[Drive]:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA
- Rename the content database(s) and associated transaction log files.
- In SQL Server Management Studio, in Object Explorer, right-click Database, and then click Restore Database...
- Select Device, and then click the ellipses "..."
- Click the Add button.
- Navigate to the folder where you placed the content database(s) that you want to restore.
- Select a content database.
- Click OK.
- Click OK again.
- Wait until the restore operation is completed.
- In Object Explorer, right-click Databases, and then click Refresh.
- Verify that the newly restored database is listed.
- Repeat steps 23-32 for each content database.
- Exit SQL Server Management Studio.
- Logout of the SQL Server host.
- Login, as the farm Setup User Administrator account to any SharePoint server in the target farm.
- Launch an instance of the SharePoint 2013 Management Shell with elevated privileges (right-click).
- Execute the following script for each content database you need to restore:
Mount-SPContentDatabase "[content database name]" -DatabaseServer "[database server name or alias]" -WebApplication [URL]
NOTE: use Mount-SPContentDatabase; not Restore-SPFarm. You are "restoring" a content database, not a site.
- After completing these mount operations, the restored web application should become available immediately.
Notes
- The terminology here is understandably confusing. The procedure presented in this posting effectively accomplishes a restore operation. However, technically speaking, you are really only performing unmount and mount operations on content databases.
- Also, Attach and Detach operations performed on SQL Server accomplish different things than performing these operations through Central Administration. A Detach operation performed through Central Administration detaches the content database from the SharePoint farm; it does not detach it from SQL Server.
- Don't worry if your content databases contain multiple site collections distributed among multiple content databases that these won't be properly integrated back into one web application: just mount them all up and SharePoint Server will figure out the rest.
- While you can also mount the content databases through Central Administration, I have found from experience that after doing it this way, not all my site collections will become visible and I may have to unmount and mount a content database several times this way before things finally work out. Why this is, I don't know.
No comments:
Post a Comment