stsadm.exe -o preupgradecheck
This step is very important don't skip it. After making sure all components of my MOSS 2007 will get migrated to SP 2010 farm. I detached the database from MOSS 2007 Database server and moved it over to SP 2010 database server, the database server is SQL 2008. Everything was smooth till this point. The moment I tried to attach the MOSS 2007 content database, I received an error as shown below. I checked my permissions on the database server and found nothing wrong.
Later I realized that this is a bug with SQL management studio and I need to use TSQL to attach the database
USE [master]
GO
CREATE DATABASE [WSS_Content_Databasename] ON
( FILENAME = N'E:\MSSQL\MSSQLSERVER.DB\Data01\WSS_Content_databasename.mdf' ),
( FILENAME = N'E:\MSSQL\MSSQLSERVER.DB\Data01\WSS_Content_databasename_log.LDF' )
FOR ATTACH
GO
if exists (select name from master.sys.databases sd where name = N'WSS_Content_databasename' and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [WSS_Content_databasename].dbo.sp_changedbowner @loginame=N'sa', @map=false
GO
Database attach went through fine after this and I had my first site migrated to SharePoint 2010 :-)