How to detach SharePoint 2007 database and attach to SharePoint 2010 farm?
In this post, I am going to provide all the steps you needed to attach SharePoint 2007 database to SharePoint 2010 database.
1. Go to Central Administration of your SharePoint 2007 farm
Application Management > Content Database
In this example, I created a new site with separate database called SP2007_content_DB in SharePoint 2007 and going to
move this database to SharePoint 2010
Database for above site

2. Next we are going to open SQL Server Management Studio and take full back up of SP2007_content_db
3. Before you backup your database set the database to read-only so that no changes happen to your current database

4. Perform full back of your database
5. Take your backup and move to your SharePoint 2010 environment and open SQL Server 2008 Management Studio
- Restore SharePoint 2007 database which you back up
SharePoint 2007 database is restored to SQL Server 2008 in SharePoint 2010 environment

6. Current SharePoint 2010 Site

7. open SharePoint 2010 Central Administration to unlick current content database
Central Administration > Application Management > Manage Content Databases
8. Click on database and scroll down where it says remove content database
Remove Content Database ( removing content database is not deleting a database)
Use this section to remove a content database from the server farm. When you select the Remove content database check box and click OK, the database is no longer associated with this Web application. Caution: When you remove the content database, any sites listed in that content database are removed from the server farm, but the site data remains in the database.

Click OK to remove the database

9. Next open SharePoint 2010 Management Shell and test your database
test-spcontentdatabase –name –YourDatabaseName –webapplicaiton YourSiteName
test-spcontentdatabase –name –sp2007_content_db –webapplicaiton http://YourSite
Since I don`t have any Upgrade Blocking, I am good to go and mount the database
mount-spcontentdatabase –name sp2007_content_db –databaseserver SQLServerName –webapplication http://YourSite

Mounting database to SharePoint 2010 completed

10. Now go back to Central Administration > Application Management > Manage Content Databases and refresh.
You should see your new database which you mounted

11. Let`s open SharePoint 2010 site and see the contents which we moved to SharePoint 2010.

The reason I am not able to see any content because of the message which I got in step 9

In my next blog, I am going to speak about how you can fix above error messages.