HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Is there any way to detect and get information on a push-subscription on subscriber's side?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
subscriptionsubscriberanysidewaygetpushandtheredetect

Problem

I've got a database in Azure SQL. There may be a push-subscription from on-premises database. I have no access to on-premises servers where distribution/publication/subscription is created and configured.

There are many many ways to get information about subscription from dictributor or publisher's side, they are easily googled. At the same time, I did not manage to find a way to detect subscription existence/health at the subscriber's side.

My current way of detection is indirect. Namely, I know the table where new records appear often and just count the number of the records and then again a minute after. This does not help in the night, when no activity in the database, and this is inconvenient due to necessity to wait a minute or more.

What I need is a script that clearly and directly shows me, if the subscription exists, and probably/if possible some additional information:
* if it is active (does push-side work properly at the moment)
* which articles are configured, etc

Solution

You have 4 tables For transactional replication (push subscription) at the subscriber's side:

  • MSreplication_objects




contains one row for each object that is associated with replication
in the Subscriber database

  • MSreplication_subscriptions




contains one row of replication information for each Distribution
Agent servicing the local Subscriber database

  • MSsubscription_agents




is used by Distribution Agent and triggers of updateable subscriptions
to track subscription properties

  • MSsnapshotdeliveryprogress




is used to track files that have been successfully delivered to the
Subscriber when a snapshot is being applied

you can use this columns to monitor the status for your replication at the subscriber's side

SELECT login_time,
       last_sync_status,
       last_sync_summary,
       last_sync_time,
       spid 
FROM dbo.MSsubscription_agents

Code Snippets

SELECT login_time,
       last_sync_status,
       last_sync_summary,
       last_sync_time,
       spid 
FROM dbo.MSsubscription_agents

Context

StackExchange Database Administrators Q#172695, answer score: 3

Revisions (0)

No revisions yet.