Moving content between SharePoint environments

Yesterday I finished setting up a development environment for a SharePoint 2013 production environment that I maintain.  The last step was to move my production content to my development environment.  I had to dig around a bit to find the PowerShell etc. Rather than go through that again next time, I decided to write a blog about it, so that I’d have all the steps in one place.

The first step is to back up the content database that you want to restore to development.  To do this open up SQL Server Management Studio, right-click on the database you want to back up, hover over tasks, and select backup.  You will be presented with the Back Up Database window.  Make sure that your backup type is set to full, give the backup a name or stick with the default, and note or change the destination.

You can skip these steps if you have scheduled backups running and are able to access the backup drive.  In that case just go grab a copy of the most recent full backup and copy it to your development SQL Server.

The next step is to restore the database to development.  To do this open up SQL Server Management Studio in your development environment, right-click on the Databases folder, and select Restore Database.  When presented with the Restore Database window, click on the Device Radio Button and click the ellipsis next to the text box.  This will bring up the Select backup devices window.  From there click Add, locate your backup file and click OK, click OK again to be returned to the Restore Database Window, and finally from there click OK.  Now your database has been restored, and you are ready to add it to SharePoint.

If you don’t already have one with content in it that you don’t care about in it, create a new Web Application…

https://sharepointv15.wordpress.com/2012/07/24/create-a-web-application-in-sharepoint-2013/

Don’t worry about creating a site collection.

Now go to Central Admin and click on Manage content databases under Application Management.

rsd1

Make sure that the correct Web Application is selected.  If it is not click on the drop down arrow next to the Web Application name, click change web application and select the correct Web Application in the window that you are presented with.

rsd2

Next click on the Content Database name

On the Manage Content Database Settings screen scroll down, click on the Remove Content Database check box, click OK on the warning pop up and click OK at the bottom of the screen.

rsd3

Now you’ll need to open up the SharePoint 2013 Management Shell as an administrator.  To do this click on your start menu, click all programs, click on the Sharepoint 2013 folder, right-click the SharePoint 2013 Management Shell and select Run as Administrator.

From here you will run the Mount-SPContentDatabase cmdlet

Mount-SPContentDatabase “MyDatabase” -DatabaseServer “MyServer” -WebApplication http://sitename

Click below for details on this cmdlt…

http://technet.microsoft.com/en-us/library/ff607581.aspx

At this point you should be able to navigate to the web application URL and see the Site Collection that lives in the database you just mounted.

Note:  This will work in SharePoint 2010 or SharePoint 2013.  However, the database must be the same version of SharePoint that the farm you are trying to mount to is.  If it is a lower version it will automatically try to upgrade it, so keep that in mind.

Advertisements