Monday, 2 January 2012

Restoring dev machine nightmare

Problem: I have a been battling for days with my User Profile service, somewhere along the line it got corrupted with a CU. 

Hypothesis: I tried permissions, restarting the service, re-provisioning the service, nothing seemed to fix the issue.  Ultimately, I rolled back my VM to a clean install and used Spencer Harbar's guide after installing the August (re-issued) CU 2011.  This fix my User profile service.  Just extremely glad this is a dev machine.  Technet has an good article also on setting up the UPS.
Lastly I'm needed to redeploy all my custom code and restore the site collections to get me data.  The site collections have been transferred using backups can be done thru: 1) CA or 2) PowerShell
Restore the site collection using PowerShell PS> Restore-SPSite -Identity -Path "C:\Users\Administrator\Desktop\KB\kbsitecollection.bak" -force
More Info:

PS to backup a Site Collection:
Backup-SPSite -Identity -Path [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
PS> Backup-SPSite -Identity -Path c:\\backup\SCbackup.bak -force -ea Stop

Note: You can't backup and restore a site collection to the same content database.  If you are using the same web application to restore the site collection, add another content database.

Note: You can only have 1 site collection restored per content database.  I restored a site collection, deleted it as I wanted it with a different name and could not restore.  When I perform the restore using PS I get the gollowing error: "Restore-SPSite : The operation that you are attempting to perform cannot be completed successfully. No content databases in the web application were available to store your site collection. The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of this site collection. Create another content database for the Web application and then try the operation again."

Repair the orphaned items for the offending content database:
PS> $cdb = Get-SPContentDatabase "ContentDB_Portal"
PS> $cdb.Repair($true)
PS> $cdb.Update()

More Info:
Take control of the restored content database


Post a Comment