If you had ran Configuration Wizard to create your SharePoint Farm then your Admin Content database will have AdminContent_XXX-XXXX-XXXXX (Guid) in its name. If you want to fix it, so you SQL Management studio looks good and no one actually blames you to be a bad SharePoint Admin, you can use the script below.
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue #List all web applications Get-SPWebApplication -IncludeCentralAdministration $CentralAdminUrl = "http://sp2013:2013/" $CentralAdminDB = Get-SPContentDatabase -WebApplication $CentralAdminUrl #Verify the database object is good $CentralAdminDB.Name #New DB Name $NewCentralAdminDBName = "01_Content_NewCentralAdmin" $NewCentralAdminContentDB = New-SPContentDatabase -Name $NewCentralAdminDBName -WebApplication $CentralAdminUrl -MaxSiteCount 2 -WarningSiteCount 1 #Verify the database is added Get-SPContentDatabase -WebApplication $CentralAdminUrl #Verify the database object is good $NewCentralAdminContentDB #Move the Sites to nicely named DB $CentralAdminDB.Sites | % {Move-SPSite $_ -DestinationDatabase $NewCentralAdminContentDB -Confirm:$false -Verbose} iisreset #Verify the Site collection are moved Get-SPContentDatabase -WebApplication $CentralAdminUrl #If databases are moved then dismount the orignal DB Dismount-SPContentDatabase $CentralAdminDB -Confirm:$false -Verbose #Confirm First Database is gone Get-SPContentDatabase -WebApplication $CentralAdminUrl #Delete the database from SQL Server
Hmm, I thought I’d try this with the new SP2016 and received the following error. “Move-SPSite Cannot complete the copy or merge operation because the database schema versions are different 16.0.79.0 and 16.0.79.0 Clearly they are the same, but the commandlet doesn’t think so. Hopefully MS fixes this.
Bismarck
I only tried this in 2013 but not 2016 but I know there is a bug in 2016 which does not upgrade the schema of 2016 Content Database. I am testing it right now. Can you please try to upgrade both content databases using Upgrade-SPContentDatabase cmdlet. You can also see the Database status from Upgrade and Migration page in CA.
Thanks.
I was doing that as you were typing your response. That command would not work. It couldn’t find the new Database even though it was listed in the Content Databases screen. I then realized I had not installed the SP2016 RC Patch that just recently came out. Installed the patch and re-ran your PowerShell script and “Ta Da” it worked !!!
Bismarck
Awesome. Thanks for confirming it.
Hi,
Just so you know it is the opposite to what you would expect and is confirmed as per Jerry’s advice. If you do not want to do the patch, you can just perform Upgrade-SPContentDatabase against the original GUID based DB. Whereas personally and without looking you would be gunning for the newly created DB.
Thanks
Has anyone tried this in SP 2019. I get the error “Move-SPSite Cannot complete the copy or merge operation because the database schema versions are different” and when i try to upgrade the database, it says it doesnt need an upgrade.
any help is appreciated.
If you are facing this issue then I suggest you dismount the database and mount it again. If there is issue with schema, it will get resolved automatically.