During the Sharepoint setup process (all versions), a Content Database is created on SQL Server and the possibility to rename it during the creation process is often hide.
By default Sharepoint creates a Content Database by adding a GUID to the end of the database name. The result is that you have a SQL Server DB like this:
This is not easy to read and you don’t have immediate undertanding of what is the site related to this Content Database. If I create a site called “MySite”, I’d like to have a Content Database called for example “WSS_Content_MySite”.
How to rename a Content Database? This is not an immediate task and when I’ve to perform this task, I always refer to the wonderful Sean’s post:
To rename it, we are going to:
- Take the database Offline (so nobody adds anything to it while we are renaming)
- Detach the database from SharePoint
- Back up the database using SQL Management Studio
- Restore the database using our desired name using SQL Management Studio
- Re-attach the database to SharePoint
Start by going to Central Administration –> Application Management and click on Content Databases
Select the Web Application associated with the database you want to rename, and click on the Database name itself.
Change the Database Status to Offline (which just makes it so that no new sites can be added to the database), click OK. Click on the database again, select “Remove content database” and click OK. This does not delete the database, just removes it from SharePoint.
Switch over to SQL Management Studio, and back up the database, then take it offline.
Next… restore the database
And choose a friendly name to restore the database to. In this case, it will be the ContentDB for my My Sites.
Switch back over to Central Admin (you probably still have open) and click on “Add a content database”
Change the database to your new friendly name, and hit OK. Voila! You now have a database name that makes sense. Once you have verified that everything still works, you can go back into the SQL Management Studio and delete the database that you previously took offline.
I hope this could be helpful for everyone and thanks to Sean for the tips.
Technorati Tag: Sharepoint