How to rename a Sharepoint Content Database

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:

WSSContentDBRename

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

image

Select the Web Application associated with the database you want to rename, and click on the Database name itself.

image

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.

image

image

Switch over to SQL Management Studio, and back up the database, then take it offline.

image

image

Next… restore the database

image

And choose a friendly name to restore the database to.  In this case, it will be the ContentDB for my My Sites.

image

Switch back over to Central Admin (you probably still have open) and click on “Add a content database”

image

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.

image

I hope this could be helpful for everyone and thanks to Sean for the tips.

 

Technorati Tag:

Print | posted on Sunday, December 20, 2009 3:08 PM

Comments on this post

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
The steps worked great. The Site collection will disappear in Central Administration once you delete the Content database. When you create the new Content database (with the correct name per SQL) the Site collection inforamtion will repopulate. Thank you very much for the steps and screenshots.
Left by Jeff McIntosh on Mar 22, 2010 7:11 PM

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
it's so useful~
ty
Left by watches replicas on Apr 29, 2010 3:17 AM

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
many people are doing what they can to raise both funds and awareness for the disease. One of the companies heavily involved in the fundraising is Starbucks.
Left by jouer au site de roulette on May 22, 2010 1:30 PM

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
declares a variable x to be of the type of the expression E. The E is required, not optional. This is a strongly typed declaration, and you can only assign values whose type is typeof(E) to it.
Left by fabulous on Jun 01, 2010 11:18 AM

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
I had some issues (of my own) in separating the database from the share point. The reason was simple. I just did not know how to do it. Even though, I learned (after some couple of hours of researching in the internet) it and I must say since that step, everything moved very fine and I got my share point content name renamed!
Left by toll free numbers on Aug 14, 2010 12:16 PM

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
Thank you in advance and congratulations for the project yet. In fact how did you register the bike for the road? it seemed almost impossible in France …
This is a great post; it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it
Left by ink cartridges on Aug 16, 2010 3:44 AM

# re: How to rename a Sharepoint Content Database

Requesting Gravatar...
creates a Content Database by adding a GUID to the end of the database name
Left by bag suppliers on Aug 19, 2010 3:27 AM

Your comment:

 (will show your gravatar)
 
Please add 2 and 2 and type the answer here: