Today we will see how to rename this database so that you stay with a “clean“ name in order to make maintenance tasks easier.
When installing Sharepoint 2013 by the Wizard we are faced with a database structure as follows:
In order to rename the database it is necessary to open the powershell console and add the Sharepoint administration snapin:
Add-PSSnapin -Name Microsoft.Sharepoint.Powershell
Once this is done, we will have access to commands to administer the Sharepoint farm, we will then create a new content database, the parameter Name specifies the desired database name and in Web Application parameter, we have to specify the Central Administration URL of the for the farm:
#create a new Database New-SPContentDatabase -Name "Sharepoint_AdminContent" -WebApplication http://SPSAPP:2013 -Verbose
#Get the existing configuration databases for the specified Central Administration Get-SPWebApplication -Identity http://SPSAPP:2013 | Get-SPContentDatabase | Select Id, Name, WebApplication | Format-List
#Get the Content Database with GUID and move its content to the new one without the GUID Get-SPSite -ContentDatabase 4e80f31e-8b88-4d99-bb4b-eb37c971d6d1 | Move-SPSite -DestinationDatabase b27500d0-9f21-497e-9099-c553d7105ff5 -Verbose
#Run iisreset on the Frontend server iisreset.exe
#Remove the GUID database Remove-SPContentDatabase -Identity 4e80f31e-8b88-4d99-bb4b-eb37c971d6d1 -Verbose
By listing the Database names again, we can see that there is only the one we’ve just created!
Checking in the SQL Management Studio:
There! DataBase Renamed, quickly and painless!
Doubts? Suggestions? Coment!
Until next time!