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
Created the new database, will move the contents of the old database, but for that we need to get the ID of the current AdminContent database:
#Get the existing configuration databases for the specified Central Administration Get-SPWebApplication -Identity http://SPSAPP:2013 | Get-SPContentDatabase | Select Id, Name, WebApplication | Format-List
Alright! We have 2 databases IDs, we can now move the content from the old database to the new, Replace the first block by the ID of the current, and in the second block insert the new ID:
#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
Content moved! Now we must restart the IIS service on the FrontEnd servers of the Farm:
#Run iisreset on the Frontend server iisreset.exe
Now we can simply remove the old base with the following command, noting that the ID must old database’s:
#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!
3 Comments
in SP 2019 it gives me an error ” Cannot complete the copy or merge operation because the database schema versions are different.16.0.156.0 16.0.156.0″
I tried running spconfig, also tried to upgrade the databases, no use
Any help is appreciated.
up
Has anybody found an answer on VG disses comment? It gives me the same error. The databases are up-to-date