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

About tbithell
I am the Chief Technical Architect of Portals at B2B Technologies, LLC in Atlanta GA. I first started working on SharePoint in 2005, and have built SharePoint portals and developed custom solutions for a wide variety of users. I have a MS in Computer Science and am a SharePoint 2010 MCITP and MCPD. I am very excited about the new version, and will be blogging about it on a regular basis as I explore the newly released Preview and future releases.

8 Responses to Moving content between SharePoint environments

  1. Ranjani says:

    Hi Tbithell,

    Nice article . I have to do almost the same work but in my case SQL server is controlled by third party and i cant seek their help to take the back up and restore. Is there any other way i can copy the data from my Production url and restore it in my development url

  2. JJohns says:

    Of the MANY blogs I’ve read about how to move production to a dev environment, this one finally got me there. Thank You!

  3. Pingback: Moving content – SharePoint Punk

  4. Fabien says:

    I’m trying to mount the restored database to a new site on the same farm but it doesn’t work… do you know why please ?

    • tbithell says:

      Off the top of my head this doesn’t work in the same farm because of an ID associated with the database. This process is specifically for moving content between farms. That said you may be able to do it if you rename the database. I’d look for some powershell to help with that if I were you.

      • Fabien says:

        Yes indeed there is a PS cmd :

        Mount-SPContentDatabase “new_DB” -DatabaseServer “server” -WebApplication http://webAPP -AssignNewDatabaseId

        That permit the operation but after I’ve got another problem : when I run the PS cmd :

        Test-SPContentDatabase -Name “new_DB” -WebApplication “webAPP”

        I get several error, here one of them :

        Database [new_DB] contains a site (Id = [dd7242c5-51c1-4908-a742-f1235ec1d87e], Url = [/my/personal/frolovaa]) whose id is already associated with a different database (Id = [342c9be7-7ca9-4320-80fd-d5df799e4885], name = [old_DB]) in the site map. Consider deleting one of these sites which have conflicting ids.

        So it’s defenetly not possible in the same farm 😦 … Anyway thanks for the help 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: