My database attach for WSS migration failed with the message: "Cannot insert the value NULL into column ‘ScopeId’", detailed message at the end. I was able to migrate the same environment two weeks ago successfully but it keeps failing with the new backup. As the message said I tried looking into the Webs table for ScopeId column in the production database. Found that V2 database doesn’t have it but the V3 database does. After much digging, it is found that there is a duplicate entry in my Webs table. I had two entries in Webs table with the same "FullUrl", different Id’s and a NULL "Title" in one of them. After the bad Web was deleted rest of the migration went real smooth. I used the below query to identify the duplicate Web:
SELECT W1.Id As W1Id, W2.Id as W2ID, W1.FullUrl as W1FullUrl, W2.FullUrl as W2FullUrl, W1.Title as W1Title, W2.Title as W2Title
FROM WEBS W1, WEBS W2
WHERE W1.Id < W2.Id and W1.FullUrl = W2.FullUrl
Full migration error:
[SPContentDatabaseSequence] [ERROR] [9/24/2007 8:07:38 PM]: Action 3.0.12.4000 of Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence failed.
[SPContentDatabaseSequence] [ERROR] [9/24/2007 8:07:38 PM]: Cannot insert the value NULL into column ‘ScopeId’, table ‘wss_Content.dbo.Webs’; column does not allow nulls. UPDATE fails.
The statement has been terminated.
[SPContentDatabaseSequence] [ERROR] [9/24/2007 8:07:38 PM]: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command)
at Microsoft.SharePoint.Upgrade.SPDatabaseSequence.ExecuteDataDefinitionMethodCore(SqlSession sqlSession, ISqlSession isqlSession, String sqlscript, SPSqlCommandFactory sqlcmdFactory, String[] strTables, Int32[] nThroughputs, SPLog logGlobal)
at Microsoft.SharePoint.Upgrade.SPDatabaseWssAction.ExecuteDataDefinitionMethod(ISqlSession sqlSession, String sqlscript)
at Microsoft.SharePoint.Upgrade.SecurityUpgrade4.Upgrade()
at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()
[SecurityUpgrade4] [3.0.12.4000] [DEBUG] [9/24/2007 8:07:38 PM]: Begin Rollback()
[SPContentDatabaseSequence] [ERROR] [9/24/2007 8:07:38 PM]: Action 3.0.12.4000 of Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence failed to rollback.
[SPContentDatabaseSequence] [ERROR] [9/24/2007 8:07:38 PM]: This SqlTransaction has completed; it is no longer usable.
[SPContentDatabaseSequence] [ERROR] [9/24/2007 8:07:38 PM]: at System.Data.SqlClient.SqlTransaction.ZombieCheck()
at System.Data.SqlClient.SqlTransaction.Rollback(String transactionName)
at Microsoft.SharePoint.Utilities.TransactionalSqlSession.Rollback()
at Microsoft.SharePoint.Upgrade.SPDatabaseAction.Rollback()
at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()
[SecurityUpgrade4] [3.0.12.4000] [DEBUG] [9/24/2007 8:07:38 PM]: Begin Dispose()
[SecurityUpgrade4] [3.0.12.4000] [DEBUG] [9/24/2007 8:07:38 PM]: End Dispose()
[SecurityUpgrade4] [3.0.12.4000] [DEBUG] [9/24/2007 8:07:38 PM]: Elapsed time: 00:01:45.6730040.
[SPManager] [ERROR] [9/24/2007 8:07:38 PM]: Upgrade [SPContentDatabase Name= wss_Content Parent=SPDatabaseServiceInstance] failed.
[SPManager] [ERROR] [9/24/2007 8:07:38 PM]: This SqlTransaction has completed; it is no longer usable.
[SPManager] [ERROR] [9/24/2007 8:07:38 PM]: at System.Data.SqlClient.SqlTransaction.ZombieCheck()
at System.Data.SqlClient.SqlTransaction.Rollback(String transactionName)
at Microsoft.SharePoint.Utilities.TransactionalSqlSession.Rollback()
at Microsoft.SharePoint.Upgrade.SPDatabaseAction.Rollback()
at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()
[SPManager] [ERROR] [9/24/2007 8:07:38 PM]: Action 3.0.12.4000 of Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence failed to rollback.
[SPManager] [ERROR] [9/24/2007 8:07:38 PM]: at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()
at Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence.Upgrade()
at Microsoft.SharePoint.Upgrade.SPManager.Upgrade(Object o, Boolean bRecurse)