1

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...

2 Answers 2

1

I'm investigating this myself at the moment - I had a similar issue. What it turned out in my case is that I created a few site collections a year ago while on contract at a client (as site administrator). Since then I left, and I assume my AD account was either suspended or deleted. On my return I had the same login credentials, but I suspect that my AD account's unique id had changed. Your primary admin account, was it also deleted and added again at some stage from AD?

0

you moved the content DB from one farm to other farm with different domian, right? How many Site collections already in that web App where you mount the migrated DB?

Do you have the root level Site collection in the that web App?

If you know users does not exist, you can remove them, use the powershell script to do...here are:

http://weblogs.asp.net/bsimser/archive/2013/02/12/powershell-tools-removing-orphaned-users-from-sharepoint.aspx

http://www.sharepointdiary.com/2012/09/find-and-delete-orphaned-users-in-sharepoint.html

13
  • Yes, I moved the content DB from one farm to a new farm in new domain. There were 0 site collections in that web app, because I removed the content DB for the web app, and added the restored one. The content DB I restored contains the root site collection. Commented Apr 29, 2014 at 18:29
  • what error you are getting in the browser? also try to remove the user and then try? is their authentication difference from source to target farm i.e windows to FBA or Classic to Claims? Also check the status of content Database from the Central admin, if he required upgrade?
    – Waqas Sarwar MVP
    Commented Apr 29, 2014 at 18:50
  • I fixed my orphaned groups and I ran the orphan cleanup, so I have no orphaned users now. Same problem. I get 2 different error messages for 2 different users (primary/secondary site col admin). The spadmin account gives me "error: access denied". Using the spfarm account gives me "an unexpected error has occurred". Both farms are using windows auth. I ran a Upgrade-SPContentDatabase on the DB after restoring. Servers in farm lists "no action required". Commented Apr 29, 2014 at 19:08
  • SPadmin is site collection admin? also did you configured the Object Cache, make sure its properly configured? Object cache also cause access denied.
    – Waqas Sarwar MVP
    Commented Apr 29, 2014 at 19:21
  • Yes both accounts I'm using are site col admin (primary/secondary) for now while I try to get it working. I'm not too familiar with the object cache, I added the web application properties for PortalSuperUserAccount and PortalSuperReaderAccount and gave full/read permissions to those accounts. I'm still getting the same errors. ULS log "unexpected" level has this: SPWeb is missing it's CurrentUser for user 'NT AUTHORITY\SYSTEM'. Commented Apr 29, 2014 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.