Thursday, June 27, 2013

Project web app sites missing from Project Service Application


Recently I had a situation in which all the project web app sites were missing from the project service application in Central admin. I was not able to access them either. There were no errors in the event log or anywhere else. After a little poking around I found that all the databases associated with the project sites were still intact. Also, I could see the site collection in Central admin using the view all site collections link. So, luckily this was not a situation in which someone deleted all the project sites. With some relief, I started to look for a way to reattach the databases to the project service application.
My first try was to delete the site collection and create a new project web app site with the same site and database name. So, I backed up the project site collection and related databases and created a new project web app. Doing so resulted in following errors:

The database specified is already used by another project server. Enter a different server or database name and try again.

Next step was to clean up all the references to the project site using powershell

$serviceapp = get-spserviceapplication -name ""
$serviceapp.SiteCollection

Using the above commands, I got the Id of the project site collection and used it to remove the project web app site collection using the below commands

$projsite = $service.SiteCollection | ? {$_.Id -eq ""}
$projecsite.Delete()

Now that the project site was removed, I tried again to create a new project web app site with the same site and database names. Bingo, the site provisioned without any issues and was able to access the site again. All the contents were intact.