Friday, March 4, 2011

Migrating Content Database from SharePoint 2007 to SharePoint 2010


Pre-Requisites

  • MOSS 2007 should have SP2 Installed. You should have SP2 installed on your MOSS 2007 machine. The preupgrade check command was added only in SP2. So if you do not have SP2 installed you will not have the preupgrade check command in stsadm.
  • SharePoint 2010 should be set up on a different Server machine
After installing and configuring your new SharePoint 2010,
Migrating Content Database from SharePoint 2007 to SharePoint 2010
Step 1: We have to run the Pre-Upgrade check command on the MOSS 2007 server to find out if there are any issues in the SharePoint 2007 farm (like missing site definitions, features etc.).
Command: stsadm –o preupgradecheck

Step 2:Backup the content database of the Web Application from SQL Server.
Step3:Copy the backup db to the machine where SharePoint 2010 is installed and restore the backup of database in SQL Server using SQL Server Management Studio. To restore the backup you will first have to create an empty database in SQL Server and the restore your database one top of this new Database.
You may need to change an option in the "options" tab of the restore dialog to get it to work. (Overwrite db).
Step 4: Create a new Web Application in SharePoint 2010.
Step5: Remove Content Database from the new web application.
Go to Central Administration -> Application Management -> Manage Content Databases then Check remove content database and click ok

Step 6: Before you add the content databases to the Web applications, you can use a Windows PowerShell cmdlet to verify that you have all the custom components that you need for that database. At the command prompt, run the following cmdlet.
Use theTest-SPContentDatabase cmdlet to test a content database against a Web application to verify all customizations referenced within the content database are also installed in the web application. This cmdlet can be issued against a content database currently attached to the farm, or a content database that is not connected to the farm. It can be used to test content databases from SharePoint 2010 Products and from SharePoint Products and Technologies. Running this command will check if the database is ready for upgrade or not.
Command: Test-SPContentDatabase -Name –WebApplication
Ex: Test-SPContentDatabase -name WSS_Content_DB -webapplication http://sitename
This example tests the WSS_Content_DB content database against the sitename Web application, and returns a list of issues.


Step 7: Run the stsadm addcontentdb command to add the content Database to the web application which you created. This will initiate the upgrade process as shown in the screen below

Command: stsadm -o addcontentdb -url –databasename