The following topics will be discussed in this post.
- SharePoint content databases
- Testing content databases
- Mounting content databases
- Shrinking content database
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.
- Log into your MOSS 2007 server.
- Browse to the Central Administration.
- On the left, click Application Management.
- Under the SharePoint Web Application Management section, click Content Databases.
- 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:
- Log into the database server.
- Open Microsoft SQL Management Studio of your SQL server.
- Expand the Databases and right-click on your content database, then click Properties.
- On the left of the Database Properties window, click Options.
- Under Other Options section, scroll down to State section until you find the Database Read-Only option.
- 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.
- On the Microsoft Management Studio, Right-click your content database, then click Tasks then Backup.
- 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.
- Open Microsoft Management Studio.
- Right-click on Databases then click Restore Database.
- On the Restore Database window, check From Device option and click the browse button.
- 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.
- 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.
- Log into the SharePoint 2010 server.
- Open SharePoint Management Shell.
- Type in this command.
test-spcontentdatabase –name dbname –databaseserver servername –webapplication http://webapp > C:/test-result.txtwhere 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.
- Mounting content databases may take too much time, it could be some hours that should be clearly communicated in the upgrade plan.
- 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.
- Log into your SharePoint 2010 sever.
- Open SharePoint Management Shell command prompt.
- 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.
- Log into the SharePoint 2010 database server.
- Open Microsoft SQL Management Studio.
- Expand Databases, right-click on the upgraded content database then click Properties.
- 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.
- On Microsoft SQL Management Studio, right click on the content database and click New Query.
- Type in this command
DBCC SHRINKDATABASE ( 'dbname', 10, NOTRUNCATE)WITH NO_INFOMSGSWhere 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:
- You have got the content database name of your targeted SharePoint web application.
- You have set the content database to read-only.
- You have performed a back up and restore the content database to the new SharePoint 2010 database server.
- You have tested your content database against the new SharePoint 2010 farm customizations.
- You have mounted the content database to the new SharePoint 2010 web application.
- 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