How to upgrade SharePoint 2007 site to SharePoint 2010
2 February 2011
Upgrade SharePoint 2007 Site to SharePoint 2010
There are lot of people out there who are really excited about the SharePoint 2010 release. Today I will be providing you with a guide to upgrading your SharePoint 2007 content databases to SharePoint 2010 using database attach upgrade method.
To complete this operation, you need to complete the following steps
1. Pre Upgrade Check
This will be our primary analysis and reporting tool which will provide information regarding your SharePoint 2007 farm and actions that may be required to take prior to upgrading to SharePoint 2010
Launch a Windows command prompt on your SharePoint 2007 Server and go the the stsadm directory path which is given below.
C:\PROGRAM FILES \COMMON FILES\Microsoft Shared\Web Server Extensions\12\bin
Run the following command
stsadm.exe –o preupgradecheck
When the pre-upgrade process completes, you will receive the following message “Operation completed successfully” .It will then launch your web browser displaying the results in HTML format, titled “SharePoint Products and Technologies Pre-Upgrade Check Report”. These results can also be located under the following location
C:\PROGRAM FILES \COMMON FILES\Microsoft Shared\Web Server Extensions\12\Logs
2. Backup database using PowerShell
Below is the PowerShell script to do database backup. You need to change SQL server name, database name and location where you want to save backup file. You can also do database backup using SQL management studio.
[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.SMO’)|out-null
[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.SMOExtended’)|out-null
$s = New-Object (‘Microsoft.SqlServer.Management.Smo.Server’) “localhost”
$dbBackup = new-object (“Microsoft.SqlServer.Management.Smo.Backup”)
$dbBackup.Database = “WSS_Content_Intranet”
$dbBackup.Devices.AddDevice(“C:\Test\WSS_Content_Intranet.bak”, “File”)
$dbBackup.Action=”Database”
$dbBackup.SqlBack
Copy the database backup file to your SharePoint 2010 machine.
3. Restore database using PowerShell
Below is the PowerShell script to do database restore. You need to change SQL server name, database name and location of the database you want to restore. You can also restore database using SQL management studio.
[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.SMO’) | out-null
[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.SMOExtended’) | out-null
$s = New-Object (‘Microsoft.SqlServer.Management.Smo.Server’) “localhost”
$dbRestore = new-object (“Microsoft.SqlServer.Management.Smo.Restore”)
$dbRestore.Database= “WSS_Content_Intranet”
$dbRestore.Devices.AddDevice(“C:\Test\WSS_Content_Intranet.bak”, “File”)
$dbRestore.Action=”Database”
$dbRestore.NoRecovery = $false
$dbRestore.ReplaceDatabase = $true
$dbRestore.SqlRestore($s)
4. Create your SharePoint 2010 Web Application and Site Collection
Go to SharePoint 2010 central admin and under “Application Management” click “Manage Web Applications”
Click “New” under “Web Applications” tab
Fill new web application form and click “Ok”
Fill the required fields and click “Ok” to create site collection
5. Verifying the Content database
The Test-SPContentDatabase is a great reporting tool that will list any missing setup files, web parts and provide you with information on how to remedy any errors. It will also specify whether these missing features will block the upgrade from succeeding.
Test-SPContentDatabase –Name <database name> -WebApplication <URL>
Launch the SharePoint 2010 Management Shell and type the above command, ensuring you have entered your Database Name and URL. e.g. below
Test-SPContentDatabase –Name WSS_Content_Intranet -WebApplication http://testsite
6. Remove Database from Web Application
Ensure that there are currently no databases connected to the web application that we will be attaching to. You can check this via Central Administration / Application Management / Manage content databases.
Go to SharePoint 2010 central admin and click “Manage Content Database” under “Application Management”
Select your newly created web application “testsite” and click on the database which is attached to it.
Check “Remove Content database” and click “Ok” to remove content dataset from web application.
7. Attach database to SharePoint 2010 web Application
We can now proceed and attach our restored SharePoint 2007 database via the following stsadm command line
stsadm -o addcontentdb -url <URL> -databasename <database name>
In my instance, the command looked as follows;
Stsadm –o addcontentdb –url http://testsite –databasename WSS_Content_Intranet
We can now verify that the upgrade was completed successfully by first navigating back to Central Administration / Application Management / Manage content databases, which now displays the upgraded database under my designated Web Application.
We can also view the upgrade status page which is located within Central Administration / Upgrade and Migration / Check upgrade status.
8. Visual Upgrade
To perform the Visual upgrade, navigate to Site Actions / Visual Upgrade. You can also user PowerShell script to perform visual upgrade to all sites and sub sites in site collection. Script is given below. You need to change the database in the given script name according to your environment.
$db = Get-SPContentDatabase WSS_Content_Intranet
$db.Sites | Get-SPWeb -limit all | ForEach-Object {
$_.UIversion = 4; $_.UIVersionConfigurationEnabled = $false;
$_.update()
}
Go to SharePoint 2010 central admin and click “Create Site Collections” under “Application Management”