Migrating Project Server 2013 database between environments

A common requirement when setting up a new Project Server instance, is to replicate production data back into another environment such as Development or Test. In doing so, you have an environment where you can develop, test configuration changes or even perform training against, without impacting your production Project Server instance.

In this post we will walkthrough migrating data from our production Project Server 2013 environment which will be the source, over to a development / test environment which will be the target using the simple and fool-proof database attach method.

As with all these posts there are a few assumptions:

  • All of your environments are at the same patch level for SharePoint and Project Server
  • The target environment has been ‘cleaned’, removing any existing PWA and SharePoint content and associated databases prior to restoration.
  • You are on the same domain

So let’s get started…

Backup your source databases

On the source environment, backup the SharePoint content database hosting PWA and site collections and the Project Service Database (as this is most likely from a production environment you could always just take a copy of your production backups that you have correct? ;) ).

Restore to your target environment

In your target environment, restore the two databases into SQL, the Project Service Database and the Content DB that contains the PWA site and Project Workspaces you wish to migrate.

Databases Restored

Once restored, check that each of the databases has the correct permissions assigned (db_owner). In my example here, I am using a single account demo box (demo\administrator), but you will need to use the correct account for your environment.

Set Database Owner

Test and Mount the SharePoint Content Database

Before mounting the SharePoint Content database, it is a wise move to Test the Content database against the web app you intend to restore it to. In performing the test, SharePoint will check the contents of the Content DB against the target web application to see if all the features, customisations etc. are present. If they are not, this step will highlight what is missing so you can rectify the problems.

To Test the SharePoint Content DB, enter the following command in a SharePoint Management Shell running as an administrator.

Test-SPContentDatabase –Name <SP Content Database Name> –WebApplication <Web Application URL>

Test-SPContentDatabase Output

In this case you can see there is a missing setup file and web part that I should correct before proceeding, but as the test output shows, they are not Upgrade blocking problems, so I can continue if I wish.

Once the test is complete, the next step is to mount the database using this command:

Mount-SPContentDB –Name <SP Content Database Name>  –WebApplication <Web Application URL>

Mount-SPContentDatabase Output

Again, just like the upgrade you need to make sure you have access to the PWA site collection, to do so, either enter the following command:

Set-SPSite –Identity <URL of PWA Site Collection> –SecondaryOwnerAlias <Domain Account>

Set-SPSite Output

Mount and Test Project Service Database

Next we need to Mount then Test the Project Service Database. This step is slightly different than with the SharePoint Content databases in that you need to mount the database before testing it, however SharePoint will let you test a content database whilst the database is not mounted.

Mount-SPProjectDatabase –Name <Name of Project Service DB>  –WebApplication <Web Application URL>

Mount-SPProjectDatabase Output

Once mounted, enter the following command to test the Project Service Database:

Test-SPProjectDatabase –Name <Name of Project Service DB>

Test-SPProjectDatabase Output

Here you can see we have a clean bill of health and are fine to proceed to the next stage and wire up the Project Web Instance.

Mount and Test Project Web Instance

Finally, now that the Content database and Project Service database have been mounted into SharePoint, all that is needed is to wire them up together by using the Mount-SPProjectWebInstance command:

Mount-SPProjectWebInstance –DatabaseName <Name of Project Service DB> –SiteCollection <URL of PWA Site>

Mount-SPProjectWebInstance Output

Once mounted, run the test command to check that all is wired up correctly:

Test-SPProjectWebInstance  <URL of PWA site>

From my testing, this will return that one of the tests, the check for the Queue status will return a FailedWarning initially as the queue is starting up, then a few minutes later it will show that the status is Passed.

Test-SPProjectWebInstance Output

There should be no need to enable any features as we are moving from one 2013 environment to another.

Post Migration Tasks

If you development / test environment is running under a different administrator account, then make sure you navigate to Central Administration > Manage Service Apps > Project Server Service App and choose to Edit your Project Server Instance, modifying the Administrator account to be the correct account for your environment.

Edit Project Web App

Next, choose to Manage the PWA instance and use the Bulk Update Connected Project Sites to ensure the workspaces are relinked and reassociated with the correct development / test instance and not still linked to Production. Finally if you have Reports or OLAP cubes, you will need to reconfigure those to work with the restored databases.

And that’s it, all that is outstanding is to test your migration, checking you have access to all the capabilities and data before releasing the environment back to your dev’s or testers.

Oh and one last thing, I would highly recommend once you have migrated your environments that you do something to differentiate the environment from production, either by changing the look and feel / colour scheme, or by editing the main PWA page to but a ‘Welcome to the DEV site’.  You only have to do something in the wrong environment once to realise what a good idea this is Smile


2 thoughts on “Migrating Project Server 2013 database between environments

  1. HI, i have follwed your steps, but i’have a lot of Sharepoint Database missing. Can you help me?
    How i can rebuild the collection site and app?????

  2. Pingback: Błąd podczas migracji PWA (Object reference not set to an instance of an object.) | Wojciech Wróblewski

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