Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save joeywas/69d7201fe6a9090f573cb8d975744e64 to your computer and use it in GitHub Desktop.

Select an option

Save joeywas/69d7201fe6a9090f573cb8d975744e64 to your computer and use it in GitHub Desktop.
UserViews missing from Project Server SE content database

UserViews missing from Project Server SE content database

We recently had a problem with a brand new Project Web App (PWA) site in Project Server Subscription Edition (SE). Database views used for reporting (normally suffixed by UserViews) were missing from the pjrep schema in the content database.

Running Repair-SPProjectWebInstance -Identity 'https://domainname.for.pwa.site/sites/sitename' -RepairRule 7 did not resolve this issue.

Cause: More than one site in content database

There were two sites in the content database, one site that had been soft deleted and the actual site.

When Repair-SPProjectWebInstance -Identity 'https://domainname.for.pwa.site/sites/sitename' -RepairRule 7 is used, it executes pjrep.MSP_Epm_GenerateAllMultiValueAssociationViews stored procedure to create database views.

This stored procedure checks how many records exist in database table pjpub.MSP_WEB_ADMIN. If there is more than one record, the stored proc exits and does not create views.

The problem is the soft deleted site record existed in pjpub.MSP_WEB_ADMIN, so the stored procedure would never create the views.

Solution: Force Delete site from content database

  • Identify Site ID that was soft deleted by executing this SQL against the content database
SELECT SiteID, WADMIN_DEFAULT_SITE_COLLECTION, WADMIN_IS_DELETED
FROM pjpub.MSP_WEB_ADMIN
WHERE WADMIN_IS_DELETED = 1
  • Force delete site using SharePoint PowerShell
# Reference to good PWA site
$GoodSite = Get-SPSite 'https://domainname.for.pwa.site/sites/sitename'
# get reference to the content database
$siteDatabase = $GoodSite.ContentDatabase
# Use the SiteID value from SQL in previous step
$SiteIDToDelete = 'SiteID from sql'
# force delete it
$siteDatabase.ForceDeleteSite($SiteIdToDelete, $false, $false)
  • Execute Repair using Sharepoint PowerShell
Repair-SPProjectWebInstance -Identity 'https://domainname.for.pwa.site/sites/sitename' -RepairRule 7

Result: UserViews database views now exist in content database

  • UserViews now exist in the pjrep schema of the content database

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment