I am restoring a content database to a new farm in a new domain. I have used the Move-SPUser command to map as many users over that exist in the new domain. I've used the delete orphan script to remove any orphans.
I have reset the site collection admins in central admin, however I cannot browse to the site. I am getting some strange errors in the ULS logs such as these:
Unexpected SPWeb is missing it's CurrentUser for user 'NT AUTHORITY\SYSTEM'. efd99a47-2203-464c-8de0-c5d63ece6513
Unexpected PortalSiteMapProvider was unable to fetch current node, request URL: /_layouts/people.aspx, message: Object reference not set to an instance of an object., stack trace: at Microsoft.SharePoint.SPUser.get_UserToken() at Microsoft.SharePoint.Publishing.CommonUtilities.<>c__DisplayClass1.<RunWithElevatedSite>b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Microsoft.SharePoint.Publishing.CommonUtilities.RunWithElevatedSite(SPSite siteNonElev, Boolean allowUnsafeUpdates, ElevatedSiteProcessor callWithElevatedSite) at Microsoft.SharePoint.Publishing.CacheManager..ctor(SPSite site) at Microsoft.SharePoint.Publishing.CacheManager.GetManager(SPSite site, Boolean useContextSite, Boolean allowContextSiteOptimization) at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.get_ObjectFactory() at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.get_CurrentNode() efd99a47-2203-464c-8de0-c5d63ece6513
High DelegateControl: Exception thrown while adding control 'Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapDataSourceSwitch': Object reference not set to an instance of an object. efd99a47-2203-464c-8de0-c5d63ece6513
Unexpected SPWeb is missing it's CurrentUser for user 'NT AUTHORITY\SYSTEM'. efd99a47-2203-464c-8de0-c5d63ece6513
High System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'UserInfo_PK'. Cannot insert duplicate key in object 'dbo.UserInfo'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.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.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock) 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
High at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) at Microsoft.SharePoint.Library.SPRequestInternalClass.GetSiteItemSizes(String bstrUrl, UInt32 dwItemType, UInt32 dwSortFlags, UInt32 dwTopN, Object& pvarSizeDataSet) at Microsoft.SharePoint.Library.SPRequest.GetSiteItemSizes(String bstrUrl, UInt32 dwItemType, UInt32 dwSortFlags, UInt32 dwTopN, Object& pvarSizeDataSet) at Microsoft.SharePoint.SPSite.get_Usage() at Microsoft.Office.Web.Environment.Sharepoint.WacSharepointCacheOM.EnsureCacheSiteCollection(SPWebApplication webApp, Boolean elevateReturn, String ownerLogin, String ownerName, String ownerEmail) at Microsoft.Office.Web.Environment.Sharepoint.WacSharepointCacheOM.EnsureCacheSiteCollection(SPWebApplication webApp) at Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob.Execute(SPJobState jobState) at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result) at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result) 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
High SqlError: 'Violation of PRIMARY KEY constraint 'UserInfo_PK'. Cannot insert duplicate key in object 'dbo.UserInfo'.' Source: '.Net SqlClient Data Provider' Number: 2627 State: 1 Class: 14 Procedure: 'proc_SecAddUser' LineNumber: 96 Server: 'SQLSERVERNAME' 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
High SqlError: 'The statement has been terminated.' Source: '.Net SqlClient Data Provider' Number: 3621 State: 0 Class: 0 Procedure: 'proc_SecAddUser' LineNumber: 96 Server: 'SQLSERVERNAME' 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
High ConnectionString: 'Data Source=SQLSERVERNAME;Initial Catalog=Content_DB;Integrated Security=True;Enlist=False;Asynchronous Processing=False;Connect Timeout=15' ConnectionState: Closed ConnectionTimeout: 15 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
High SqlCommand: 'SET NOCOUNT ON; DECLARE @DN nvarchar(256),@LN nvarchar(128),@@DocUIVersion int,@@Level tinyint,@@S uniqueidentifier; DECLARE @ItemId int; DECLARE @@iRet int; DECLARE @ExtraItemSize int; DECLARE @Login nvarchar(255); DECLARE @Title nvarchar(255); DECLARE @Email nvarchar(255); DECLARE @Notes nvarchar(1023); DECLARE @MobilePhone nvarchar(127); DECLARE @AddedToTable bit; DECLARE @UserIdOut int; DECLARE @LoginOut nvarchar(255); DECLARE @TitleOut nvarchar(255); DECLARE @EmailOut nvarchar(255); DECLARE @NotesOut nvarchar(1023); DECLARE @MobilePhoneOut nvarchar(127); DECLARE @DeletedOut bit; DECLARE @NeedtoAddtoList bit; DECLARE @IsGroup bit; SET @IsGroup = 0; SET @@Level = 1; SELECT @Login = @wssp0; SELECT @Title = @wssp1; SELECT @Email = @wssp2; SELECT @Notes = @wssp3; SELECT @MobilePhone = @wssp4; SELECT @@S=@wssp5; EXEC @@iRet = proc_SecAddUser @@S, @wssp6, @wssp7, @wssp8, @wssp9, @wssp10, @Login, @Title, @Email, @Notes, @MobilePhone, @wssp11, @wssp12, @wssp13, @wssp14, @AddedToTable OUTPUT, @UserIdOut OUTPUT, @LoginOut OUTPUT, @TitleOut OUTPUT, @EmailOut OUTPUT, @NotesOut OUTPUT, @MobilePhoneOut OUTPUT, @DeletedOut OUTPUT, @NeedtoAddtoList OUTPUT; IF @@iRet <> 0 BEGIN GOTO DONE; END ; SELECT @ItemId = @UserIdOut; IF @NeedtoAddtoList = 0 BEGIN GOTO DONE; END ; BEGIN TRAN IF NOT EXISTS( SELECT tp_ID FROM UserData WHERE tp_ListId = '873326F4-6C2D-4546-AEDC-669576A52B11' AND tp_ID = @ItemId AND tp_Level = 1 AND tp_RowOrdinal =0) BEGIN SELECT @ExtraItemSize = 0 EXEC @@iRet = proc_AddListItem @SiteId =@wssp15,@WebId=@wssp16,@ListID=@wssp17,@RowOrdinal=@wssp18,@ItemDocType=@wssp19,@SortTypeReversed=@wssp20,@RetainId=@wssp21,@RetainObjectIdentity=@wssp22,@ItemId = @ItemId OUTPUT,@ItemDirName=@DN OUTPUT,@ItemLeafName=@LN OUTPUT,@UserID=@wssp23,@tp_Author = @ItemId,@tp_Editor = @ItemId,@TimeNow=@wssp24,@CopySecurityFromMasterID=@wssp25,@UseNvarchar1ItemName=@wssp26,@ServerTemplate=@wssp27,@IsNotUserDisplayed=@wssp28,@Basetype=@wssp29,@Level=@wssp30,@UIVersion=@wssp31,@tp_GUID=@wssp32,@CheckSchemaVersion=@wssp33,@OnRestore=@wssp34,@AddNamespace=@wssp35,@CheckDiskQuota=@wssp36, @tp_ContentTypeId = @wssp37, @nvarchar1 = @wssp38, @nvarchar3 = @wssp39, @nvarchar4 = @wssp40, @nvarchar5 = @wssp41, @nvarchar6 = @wssp42, @bit2 = @wssp43, @bit3 = @wssp44, @nvarchar9 = @wssp45, @nvarchar10 = @wssp46, @bit4 = @wssp47, @tp_ModerationStatus = @wssp48, @Size=@wssp49, @ExtraItemSize = @ExtraItemSize , @eventData=@wssp50, @acl=@wssp51, @DocClientId=@wssp52; IF @@iRet <> 0 BEGIN ROLLBACK TRAN; GOTO DONE; END END ; COMMIT TRAN; EXEC proc_UpdateDiskUsed @@S, 1; DONE: SELECT @@iRet, @ItemId, @AddedToTable, @LoginOut, @TitleOut, @EmailOut, @NotesOut, @MobilePhoneOut, @DeletedOut ' CommandType: Text CommandTimeout: 0 Parameter: '@wssp0' Type: NVarChar Size: 4000 Direction: Input Value: 'SHAREPOINT\system' Parameter: '@wssp1' Type: NVarChar Size: 4000 Direction: Input Value: 'System Account' Parameter: '@wssp2' Type: NVarChar Size: 4000 Direction: Input Value: '' Parameter: '@wssp3' Type: NVarChar Size: 4000 Direction: Input Value: '' Parameter: '@wssp4' Type: NVarChar Size: 4000 Direction: Input Value: '' Parameter: '@wssp5' Type: UniqueIdentifier Size: 0 Direction: Input Value: '6e32661e-e9ce-4b91-9c83-dc5e9c550ec7' Parameter: '@wssp6' Type: VarBinary Size: 0 Direction: Input Parameter: '@wssp7' Type: VarBinary Size: 0 Direction: Input 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
High System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'UserInfo_PK'. Cannot insert duplicate key in object 'dbo.UserInfo'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.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.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock) at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) 7d431c4d-6e38-4ea0-9bb7-0c1a45da466b
I have no idea what I should do next...