SharePoint 2010 to 2013 Upgrade – Resolving Error during FIM Key Import

During the migration of user profile service application from SharePoint 2010 to SharePoint 2013 I ran into this issue, was unable to import the FIM key and were getting the below errors.

“Unable to Login to the Database”

“The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID f58a9431-badf-4fc5-b116-b2dd21440170) threw an exception.
More information is included below.

Object reference not set to an instance of an object.” The Farm account that we used had the required access on the source and destination DB’s of Synch, social and profile DB’s and yet we got an access denied error message. After wasting a day’s time I decided to retake the backups and restore them. It worked like a charm. The problem we faced first time was because the synch DB was backed up by our client using a windows account which had admin access on the farm and SQL. This account was not the service account and was also different from the account that we were using to create the new service apps. So be cautious of what service account you have to use while backing up the databases for SharePoint 2010 to 2013 Upgrade.