DEV Community

Raghubir Singh
Raghubir Singh

Posted on

SQL query check Azure Data Sync processing status

As you aware that Azure data sync service syncs database changes to one database to another(source to destination).First time when this sync process is established successfully, system creates one extra database somewhere called as metadata db in destination server. If user was to check using SQL query that if last process is completed successfully or there is any failure than it can execute following query.

SELECT top 1 sg.[name] as GroupName,
ud.[database] as DatabaseName,
uh.completionTime,
uh.detailEnumId as SyncStatus,
taskType.Name taskType--,
-- uh.recordType
FROM [dss].[syncgroupmember] sgm
join [dss].[syncgroup] sg on sg.Id = sgm.syncgroupid
join [dss].[userdatabase] ud on ud.id = sgm.databaseid
join [dss].[UIHistory] uh on uh.databaseid = ud.id and sg.id= uh.syncgroupid
join [dss].[EnumType] taskType on taskType.EnumId = uh.taskType and taskType.type ='TaskType'
WHERE sg.name = 'groupname' and cast(uh.completionTime as date) = Cast(DATE() as date)
order by uh.completionTime desc

I wish this could help someone.

Top comments (0)