Issue
Trying to reset the SharePoint UPS sync database, I had the following error message:
PS C:> $upa.ResetSynchronizationDatabase() Exception calling "ResetSynchronizationDatabase" with "0" argument(s): "Operation is not valid due to the current state of the object." At line:1 char:1 + $upa.ResetSynchronizationDatabase() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException
Resolution
Database was in mirror, and i had the following event on the SharePoint box:
You need to first remove mirroring session and try again.