MOSS 2007 upgrade - Upgrading content databases

MOSS 2007 upgrade - Upgrading content databases

Testing and upgrading SharePoint 2007 content databases to SharePoint 2010 and how to solve all post database upgrade issues.

MOSS 2007 upgrade - Upgrading content databases

The following topics will be discussed in this post.

SharePoint content databases

Every SharePoint site collection has its own content database. 

Content databases store much information about every site's structure, navigation, content, settings and much more related data. First step in this post is to determine which content database on your SharePoint database server that needs to be upgraded.

If you are trying to upgrade the web application whose URL is http://webapp on MOSS 2007 server, then you should follow these steps to get the content database server and database name for this web application.

  1. Log into your MOSS 2007 server.
  2. Browse to the Central Administration.
  3. On the left, click Application Management.
  4. Under the SharePoint Web Application Management section, click Content Databases.
  5. In the Content Databases page, you can change the web application from the upper right drop down list and you will find the content database name in the Database Name column.

Now you should have known what content database you are targeting to upgrade. It's time to back it up and restore to the new SharePoint 2010's database server. Follow these steps to back up and restore your content database to the new SharePoint 2010's database server.

First, you should set your content database too read-only to avoid any new updates to the database while you are migrating it. 

To do this:

  1. Log into the database server.
  2. Open Microsoft SQL Management Studio of your SQL server.
  3. Expand the Databases and right-click on your content database, then click Properties.
  4. On the left of the Database Properties window, click Options.
  5. Under Other Options section, scroll down to State section until you find the Database Read-Only option.
  6. Change the false value to true, then click OK.

Now your content database is read-only and ready for taking a backup and restoring it to the new SharePoint 2010 farm.

  1. On the Microsoft Management Studio, Right-click your content database, then click Tasks then Backup.
  2. On the Back Up Database window, select a location for the back up file and click OK.

Now go to your SharePoint 2010 database server and restore the backed up database. Follow these steps to restore the database.

  1. Open Microsoft Management Studio.
  2. Right-click on Databases then click Restore Database.
  3. On the Restore Database window, check From Device option and click the browse button.
  4. On the "Specify Backup" window click Add then browse to your back up file taken before and click OK until you are back to the Restore Database window.
  5. Select the back up sets to be restored and click OK.

Now you have the SharePoint web application's content database ready for testing and upgrading to the SharePoint 2010 web application.

Testing content databases

After setting up your new SharePoint 2010 farm in MOSS 2007 upgrade - SharePoint 2010 new farm topology and specifications and pulling and applying the SharePoint customizations in MOSS 2007 upgrade - Applying SharePoint customizations, then it's time for the actual upgrade to your MOSS 2007 content databases but before this step, the content databases should be tested first against the applied SharePoint customizations on the new SharePoint 2010 farm.

This test is checking what errors that will occur if you have done the upgrade to a specific content database for a specific web application.

To test the MOSS 2007 content database upgrade for a the web application http://webapp, follow these steps.

  1. Log into the SharePoint 2010 server.
  2. Open SharePoint Management Shell.
  3. Type in this command.
    test-spcontentdatabase –name dbname –databaseserver servername –webapplication http://webapp > C:/test-result.txt
    where dbname is the name of your content database, servername is the name of the database server, http://webapp is the URL of the web application that will be connected to the content database and it will finally save the test results in the text file test-result.txt.

Open the file test-result.txt and check the test results. If you found any errors regarding missing web parts, missing features, site definitions or assemblies, then you should add them to your farm and repeat testing the content database.

Mounting content databases

After testing the content database against the new farm customizations and solved all the issues, then it's time to mount the content database to the web application. Before you engage into this step, you should pay a great attention to some precautions.

  1. Mounting content databases may take too much time, it could be some hours that should be clearly communicated in the upgrade plan.
  2. Mounting a content database may lead to an epic increase and expansion in the database size. You should have enough free space for four times more than your database size as a minimum free space. For example, if your content database size is 10 GB, then you should have 50 GB free space on the drive containing the database. This precaution will avoid any errors related to insufficient free space. Fixing this expansion issue will be discussed later in this post.

If you are ready to go upgrading your content database then follow these steps.

  1. Log into your SharePoint 2010 sever.
  2. Open SharePoint Management Shell command prompt.
  3. Type in this command
    <span style="font-size:11.0pt;line-height:107%;font-family:'Calibri','sans-serif';">mount-spcontentdatabase –name dbname –databaseserver servername –webapplication <a href="http://webappurl">http://webapp</a></span>
    Where dbname is the content database name, servername is the database server name and http://webapp is the web application URL that will be connected to content database.

Shrinking content database

After mounting the content database to the SharePoint 2010 web application you will find its size has been tremendously expanded. To fix this issue you should first detect how much free space this upgraded content database has. To do this follow these steps.

  1. Log into the SharePoint 2010 database server.
  2. Open Microsoft SQL Management Studio.
  3. Expand Databases, right-click on the upgraded content database then click Properties.
  4. Look for Space Available option and check out how much free space this database has.

If you found that the content database has more than enough big space, then you should shrink it. To shrink the content database size, follow these steps.

  1. On Microsoft SQL Management Studio, right click on the content database and click New Query.
  2. Type in this command
    Where dbname is the content database name and the 10 is the percentage of the targeted available space after shrinking. In this case it's 10%.


In this post you have done the following:

  1. You have got the content database name of your targeted SharePoint web application.
  2. You have set the content database to read-only.
  3. You have performed a back up and restore the content database to the new SharePoint 2010 database server.
  4. You have tested your content database against the new SharePoint 2010 farm customizations.
  5. You have mounted the content database to the new SharePoint 2010 web application.
  6. You have shrunk the upgraded content database size.

Now it's time moving on to the next step MOSS 2007 upgrade - Shared-Services Provider SSP migration and my sites

Did you find this helpful?

Read Next

The following articles are related to moss 2007 upgrade - upgrading content databases.

MOSS 2007 upgrade - Upgrading content databases
Fady Soliman
Fady SolimanMember since
Jun 22, 2013
Contact Us
Share your COMMENT!

Share your thoughts and feedback on MOSS 2007 upgrade - Upgrading content databases

Ask any questions directly to Fady Soliman and the community!

By using this channel you approve that you agree on our Terms and Conditions