Issue : User Profile
Synchronization service is failing , because of this import and export
operations are not working between AD and SharePoint.
We have gone through
all the logs and finally we could find some data is corrupted in sync database
through diagnostic logs , which is collected by Microsoft Support team.
We have implemented
following steps to rebuild sync database and before that we have taken UPA
Databases backup and farm backup.
1 Stop the
SharePoint Timer Service in the App Server running UPS.
2 Stop User
Profile Synchronization service through Central Administration.
Central Admin > System Settings .Manage Services
on Server > App Server > User Profile Synchronization Service and click Stop
3 Run the
following PowerShell in SharePoint Management Shell with elevated permissions
Get-SPDatabase | Out-File D:\Databases.txt
Open the databases.txt file and file the ID
for Sync database.
4 Run the
following PS commands to remove data in sync database
$syncDataBase
= Get-SPDatabase -Identity “GUID of Sync database”
$syncDataBase.Unprovision()
$syncDataBase.Status=’Offline’
5 Get
the reference to User Profile service, reset and provision the sync database
$ups
= Get-SPServiceApplication -Name “User Profile Service”
$ups.ResetSynchronizationMachine()
$ups.ResetSynchronizationDatabase()
$syncDataBase.Provision()
6 Verify that
Farm admin account has access to sync database in SQL.
7 Start back
the SharePoint Timer Service which we stopped in step 1.
8 Start back
the User Profile Synchronization Service running in App Server. Central Admin
> System Settings .Manage Services on Server > App Server> User
Profile Synchronization Service and click Start. This might take 10-15 mins to
start after you enter Farm admin credentials
9 Optional
IISRESET
10 Open the User
Profile Service Application under Central Admin > Application Management
> Manager Service Applications. Configure the synchronization connections
and Connection Filters.
11 Rebuilding your
SyncDB or recreating connection to Active Directory will mark all user profiles
for deletion after first full or incremental sync. Disable MySite Cleaner Timer
job to prevent user profiles from getting deleted.
12 Configure any
mappings to custom property mappings
13 Run Full
Synchronization, twice to sync all the users.
Above steps resolved
issue, sync is running successfully.