Rename Central Admin Database

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 
Advertisements

5 thoughts on “Rename Central Admin Database

  1. 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.

  2. 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

  3. 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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s