SharePoint 2016 TIP: change content database name in four steps using PowerShell
On any farm server, open an elevated SharePoint Management Shell.
Execute this commandlet to create a new content database mounted to the same web application hosting the content database you want to rename:
New-SPContentDatabase "[NewDatabaseName]" -DatabaseServer "[Alias or name of database server]" -WebApplication "[Web application URL]"
Execute this commandlet to get the names and, most importantly, IDs of all of the content databases currently mounted to that web application:
Get-SPContentDatabase -WebApplication "[Web application URL]"
You need those IDs in order to be able to execute this commandlet that performs the actual move operation:
Get-SPSite -ContentDatabase "[OldDatabaseID]" | Move-SPSite -DestinationDatabase "[NewDatabaseID]"
Perform an IISRESET on all farm servers hosting that web application. Lastly, dismount the old database from the web application:
Dismount-SPContentDatabase "[OldDatabaseID]"
References
Notes
- I use this simple method all the time to change content database name as I upgrade it (v2v). For example, a customer naming scheme might be "SP2010_....". Once I upgrade it to 2013, I use this method to rename the database to "SP2013_...".