Scenario
Think about this scenario, you are trying to run the migrate user command to migrate the user from one ID to new id in he certain situation.
- User ID get deleted from AD and recreated but with new SID
- User id change from One Domain to other domain
- User ID got changed after her last name changed.
You run the following command:
PS C:\temp>$user = Get-SPUser -web https://webapplication url-Identity "domain\username"PS C:\temp>Move-SPUser -Identity $user -NewAlias "domain\testuser" –IgnoreSID -Confirm:$falseMove-SPUser : The site with the id ebaf8908-78B9-4BAF-9845-56556B2BE628 could not be found.
At line:1 char:12
+ Move-SPUser <<<< -Identity $user -NewAlias "domain\testuser" -IgnoreSID
+ CategoryInfo : InvalidData: (Microsoft.Share...PCmdletMoveUser:
SPCmdletMoveUser) [Move-SPUser], FileNotFoundException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletMoveUser
Even with Stsadm command:
stsadm.exe -o migrateuser -oldlogin "domain\user" -newlogin "domain\testuser" -ignoresidhistory
The site with the id ebaf8908-78B9-4BAF-9845-56556B2BE628 could not be found.
Now if you trying to get the details about the Site ID & run the below command:
PS C:\temp>get-spsite -identity "ebaf8908-78B9-4BAF-9845-56556B2BE628"
Get-SPSite : Cannot find an SPSite object with Id or Url: ebaf8908-78B9-4BAF-9845-56556B2BE628.
At line:1 char:11
+ get-spsite <<<< ebaf8908-78B9-4BAF-9845-56556B2BE628
+ CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletGetSite:
SPCmdletGetSite) [Get-SPSite], SPCmdletPipeBindException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
Reason:
Migrate / Move user go through all sites in the content databases & User Profile. If there is any orphan sites in the content database then this issue occurred.
Identify:
If you have only few content databases in your farm then run the below mentioned script against each content DB and see if its worked.
Select * from userinfo with (nolock) where tp_siteid like '%ebaf234348-78B9-4VAF-9845-56556B2BE628%'
If you have many databases across on couple of servers then run this
EXEC sp_MsForEachDb 'use [?]; SELECT "?" AS [databasename], ID FROM [?].dbo.AllSites with (Nolock) WHERE ID = "ebaf234348-78B9-4VAF-9845-56556B2BE628"'
You will get the Database name and ID.
Server Name | databasename | ID |
Database Server | ContentDatabase | ebaf234348-78B9-4VAF-9845-56556B2BE628 |
Resolution:
Method # 1
You need to detach the content Databse and re attach it back to Web app will clear the orphan.
To detach a content database by using Central Administration
- Verify that the user account that is performing this procedure is a member of the Farm Administrators SharePoint group.
- On the SharePoint Central Administration website, click Application Management.
- On the Application Management page, in the Databases section, click Manage content databases.
- Select the web application for which you want to detach a content database.
- Click the content database that you want to detach.
- On the Manage Content Database Settings page, select the Remove content database check box.
If the content database contains data, you will receive a warning. Click OK to continue with the operation.
- Click OK to confirm the detachment, or click Cancel to stop the operation without detaching the database.
After detaching the content database in Central Administration, the content database still exists in SQL Server.
To attach a content database by using Central Administration
- Verify that the user account that is being used to perform this operation is a member of the Farm Administrators SharePoint group.
- Start SharePoint 2010 Central Administration.
- On the SharePoint Central Administration website, click Application Management.
- On the Application Management page, in the Databases section, click Manage content databases.
- On the Manage Content Databases page, click Add a content database.
- On the Add Content Database page:
- Use the web Application drop-down menu to select the web application to which you want to attach a content database.
- Specify the database server that hosts the database.
- Specify the database name. If the database does not already exist, it will be created.
- Specify the authentication method for the database, and supply an account name and password if you are using SQL authentication.
- Click OK.
Method # 2
If above method failed, then you have to create a new content Database and move all working sites except orphan to the newly created Database.
- Create content database, you have two options.
- Now move the site collections from old Database to new database.
- Now delete the Old Database.