If you ever installed SharePoint 2010 using the installation wizard you probably noticed up ~15 new databases deployed to the SQL Server. Not just you now have to manage 15 more databases 🙁 but all these have very non-admin friendly names like: WebAnalyticsServiceApplication_ReportingDB_33ae7492-5e53-433a-bfca-2b1d819dc646.

A number of people (like Todd Klindt, Shane Young and others) posted articles on how to rename these, and Microsoft created a special TechNet article to help you.

One sunny afternoon I went to fix this GUID problem for a customer and did some PowerShell and SharePoint Central admin magic, renamed all these databases to something nice like SharePoint_WebAnalytics_ReportingDB and thought my job was done, but then have noticed a bunch of errors like this one in the Event Log.

SQL Database ‘WebAnalyticsServiceApplication_ReportingDB_33ae7492-5e53-433a-bfca-2b1d819dc646’ on SQL Server instance ‘ServerName’ not found. Additional error information from SQL Server is included below.

So even though these databases have been renamed they are still listed as SharePoint databases and you can check them on this page http://central_admin_url/_admin/DatabaseStatus.aspx. To delete these invalid databases from the list you can use the following PowerShell code. If you are not sure you want to delete them you can first list them with just Get-SPDatabase | Where{$_.Exists -eq $false}.

# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq
'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
 Write-Host "Loading SharePoint Powershell Snapin"
 Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

Get-SPDatabase | Where{$_.Exists -eq $false} | ForEach {$_.Delete()}

Leave a Reply