Migrate a content database from SharePoint 2007 to 2010
BACK UP YOUR 2007 CONTENT DATABASE
Back up your 2007 content database from SQL Management Studio on the SharePoint 2007 server, and put the backup file somewhere it is accessible from the new SharePoint 2010 Server instance.
RESTORE THE 2007 CONTENT DATABASE TO THE SHAREPOINT 2010 DATABASE INSTANCE
Connect to the SQL Server Instance hosting your SharePoint 2010 installation’s databases. Restore the wss_content database from the backup file created in the step above.
DETATCH ANY CONTENT DATABASES FROM THE TARGET WEB APPLICATION
In Central Administration –> Application Management, select “Manage Content Databases” under the Database heading.
Select the target web application in the “Web Application” drop-down box at the top left, if it is not already
Ensure there are no content databases for the target web application. If the list contains any content databases, click on each content database name. On the “Manage Content Database Settings” screen, select the “remove content database” checkbox and click OK.
RUN THE POWERSHELL TEST-SPCONTENTDATABASE CMDLET
Launch the SharePoint 2010 Management Shell available under Start->Programs –> Microsoft SharePoint 2010 Products.
Run the Test-SPContentDatabase command from the SharePoint 2010 Management Shell PowerShell window with the following syntax:
Test-SPContentDatabase –Name your_content_db –WebApplication http://YourSiteName
RESTORE THE CONTENT DATABASE USING STSADM.EXE
Using the stsadm.exe tool, run the addcontentdb command using the syntax below:
stsadm -o addcontentdb -url http://YourSiteURL -databasename your_content_db -databaseServer YourDatabaseServer
PowerShell Command
Mount-SPContentDatabase "<ContentDb>" -DatabaseServer "<DbServer>" -WebApplication http://SiteName