This blog post will detail the PowerShell commands required to carry out an environment rollover using Windows PowerShell where possible. The steps below use the 5 database approach to rollover over the Production environment to the Test / Development environment.
For more details on the Project Server database restore please see Andrew’s blog posts found below:
http://azlav.umtblog.com/2011/06/07/project-server-2010-database-restore-part-i/
http://azlav.umtblog.com/2011/06/09/project-server-2010-database-restore-part-ii/
As a prerequisite I would recommend taking full backups of the Test / Dev farm to enable the environment to be rolled back if required. Use your usual farm backup procedures.
Test / Dev environment Prep
Firstly connect to the Test / Dev Application server and launch the SharePoint 2010 Management shell. If you are not familiar with the management shell it can be found in the Microsoft SharePoint 2010 Products folder – Start | All Programs | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell.
Type the following:
Remove-SPProjectWebInstance –Url <URL of Test / Dev PWA site that you want to refresh with the Production data and config>
Example:
Press Enter and the command will remove the existing Test / Dev instance
You can check in Central admin in the Project Server Service Application to check that the PWA site has been removed:
Using the SharePoint 2010 Management Shell detach the existing content database from the web application that hosted the PWA site collection that was removed in the previous step.
Type the following:
Dismount-SPContentDatabase “<Database name here>”
Example:
Press Enter:
Press Y to confirm and Press Enter.
Test / Dev environment SQL Prep
Take a backup of the 5 databases from the Production environment and copy these over to the Test / Dev SQL server and restore the databases. The databases required are:
- Content database that contains the PWA site and Project Sites
- ProjectServer_Archive
- ProjectServer_Draft
- ProjectServer_Published
- ProjectServer_Reporting
Make a note of the database names used when these databases are restored as they will be required later.
Test / Dev environment configuration
Using the SharePoint Management Shell, attach the restored content database to the web application that will host the PWA site collection.
Type the following:
Mount-SPContentDatabase “<content database name restored in previous step>” -DatabaseServer “<Test / DEV SQL Server>” –WebApplication <web application URL>
Example:
Press Enter:
Now using the SharePoint 2010 Management Shell provision the PWA site collection in the web application where the database was just attached to and using the 4 Project Server databases that were restored previously. Please note, use the same PWA path name used in Production. For example if the instance is called /PWA in Production, use /PWA in the command below on the Test / Dev environment.
Type the following command:
New-SPProjectWebInstance -Url “<web application URL + PWA path>” -AdminAccount “<Project Server Administrator account> -PrimaryDbserver “<Test / Dev SQL Server>” -PublishedDbname “<ProjectServer Published database>” -ArchiveDbname “<ProjectServer Archive database>” -DraftDbname “<ProjectServer Draft database>” -ReportingDbserver “<Test / Dev Reporting SQL Server>” -ReportingDbname “<ProjectServer Reporting database>”
Example:
Press Enter:
You can check the provisioning status of the PWA site using PowerShell or in Central admin in the Project Server Service Application to check that the PWA site has been created:
Type the following:
Get-SPProjectWebInstance –URL <PWA URL> | Select ProvisioningStatus
Example:
Or in Central Admin:
Post Provisioning
The Project Sites will need to be relinked using the “Bulk Update Project Sites” functionality in Server Settings on the newly provisioned Test / Dev PWA site.
The Project Server timer jobs (Resource capacity, Daily Scheduled backup and Cube build – also update the SQL AS server / cube name) will need to have the scheduled times modified on the Test / Dev system so that the Timer Jobs are recreated / relinked in Central Admin on the Test / Dev environment.
The Excel services reports will need to be updated to use the ODC files from the Test / Dev environment as they will currently point to the Production ODC files. This is done by opening the Excel reports in Excel, changing the ODC file then saving the file back to the library.
