SharePoint, SharePoint 2013

Move-SPSite and database alias issue

I have a web application with 3 content databases and I tried to move site collection between database using the Move-SPSite and got the following error…

Move-SPSite : The databases need to be on the same database server in order to combine them.

To troubleshoot this issue, I ran the following command to check the database server name. This command lists all the content databases used by this webapplication.

Get-SPContentDatabase -webapplication http://portal.contoso.local


Id : 8f9611d3-0c46-477b-95ee-e0898f87e023
Name : SP_MySite
WebApplication : SPWebApplication Name=Portal
Server : SP_SQL
CurrentSiteCount : 230

Id : 05dffa47-4218-4387-bf74-0ad519df55d0
Name : SP_Portal
WebApplication : SPWebApplication Name=Portal
Server : TSTDB
CurrentSiteCount : 201

It seems the issue mentioned above is caused by value in the Server field. One database is using alias name “SP_SQL” and another database is using the database server name. The Move-SPSite command thinks its two different database server…

Any fix for this issue ???

To resolve this issue I removed the content database that uses server name instead of alias name via central admin. Then I ran the following command to attach the database with alias name.

Mount-SPContentDatabase SP_Portal -DatabaseServer SP_SQL -WebApplication http://portal.contoso.local

Another important thing to notice is if I add the content database via central admin instead of PowerShell script and browse the site you get “web page not found” error… so it’s recommended to use PowerShell.

It’s also a good practice to flush blob cache after restoring the content database. From Technet,

after you restore a content database, the BLOB cache will be out of sync with the content. To correct that situation, you must flush the BLOB cache

$webApp = Get-SPWebApplication “<WebApplicationURL>” [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp) Write-Host “Flushed the BLOB cache for:” $webApp



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s