Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Replication: Why can't a PULL subscription be initialized from backup, whereas a PUSH subscription could be initialized?

$
0
0

Hi everyone,

I am facing a strange problem and can't figure out why is it happening and could not find any related thread or documents that could provide me with answers.

So here is the problem:

1. I am initializing a subscription from backup. For which, I have first disabled and stooped (if running) the Distribution cleanup agent, because it was causing problem by making my backups out-dated and had to take another differential backup or transaction log backup to execute the sp_addsubscription procedure.

2. After disabling the distribution cleanup agent, I took a backup (full, differential or transaction log as required) from the publisher database and restored them on the subscriber sequentially so that the LSNs are in sequence.

3. After the restoration of the backups were completed on the subscriber (distribution agent still disabled and not running), I executed sp_addsubscrition with the T-SQL shown below:

use [PUBLISHER_DB]
exec sp_addsubscription 
@publication = N'PUBLICATION_NAME'
, @subscriber = N'SQL_INSTANCE_NAME_OF_THE_SUBSCRIBER'
, @destination_db = N'SUBSCRIBER_DB_NAME'
, @subscription_type = N'Pull'
, @sync_type = N'initialize with backup'
, @backupdevicetype='disk'
, @backupdevicename='PATH_OF_THE_BACKUP'
, @update_mode = N'read only'
GO

The procedure executed successfully with message "Command(s) completed successfully."

4. After that I executed the "sp_addpullsubscription" and "sp_addpullsubscription_agent" on the subscriber with the following T-SQL:

USE [SUBSCRIBER_DB]
GO

EXEC sp_addpullsubscription
@publisher = N'PUBLISHER_SQL_INSTANCE_NAME', 
@publication = N'NAME_OF_THE_PUBLICATION', 
@publisher_db = N'PUBLISHER_DB_NAME', 
@independent_agent = N'True', 
@subscription_type = N'pull', 
@description = N'', 
@update_mode = N'read only', 
@immediate_sync = 0
GO

EXEC sp_addpullsubscription_agent
@publisher =N'PUBLISHER_SQL_INSTANCE_NAME', 
@publisher_db = N'PUBLISHER_DB_NAME', 
@publication = N'NAME_OF_THE_PUBLICATION', 
@distributor = N'SV0D2-MSQLCL6-10', 
@distributor_security_mode = 1, 
@distributor_login = N'', 
@distributor_password = null, 
@enabled_for_syncmgr = N'False', 
@frequency_type = 64, 
@frequency_interval = 0, 
@frequency_relative_interval = 0, 
@frequency_recurrence_factor = 0, 
@frequency_subday = 0, 
@frequency_subday_interval = 0, 
@active_start_time_of_day = 0, 
@active_end_time_of_day = 235959, 
@active_start_date = 20120805, 
@active_end_date = 99991231, 
@alt_snapshot_folder = N'', 
@working_directory = N'',
@use_ftp = N'False', 
@job_login = N'AGENT_LOGIN_USER_NAME', 
@job_password = N'AGENT_LOGIN_PASSWORD', 
@publication_type = 0
GO

This was also executed successfully with the following messages:


'AGENT_LOGIN_USER_NAME' is a member of sysadmin server role and cannot be granted to or revoked from the proxy. Members of sysadmin server role are allowed to use any proxy.
Job 'AUTOMATICALLY_GENERATED_JOB_NAME' started successfully.

So at this point I expect my subscription to show the status "Running" if I see it in the replication monitor. However, it shows me "Uninitialized subscription". Then I thought that the backup is out-dated for some strange reason, so I repeated the steps 1-4 above, but just dropped the subscriptions before doing the steps. Same problem. It executes successfully, but shows the status to be "Uninitialized subscription" and does not sync anything. All jobs are piled up in the undistributed commands. I was getting frustrated, because I thought there was something wrong with the backups.

However, just out curiosity, I tried executing "sp_addsubcription" with the same command as shown above, but just changing @subscription_type from 'pull' to 'push' so that a PUSH subscription is initialized and it was running successfully, which implicates that my backups are completely fine.

My questions are:

1. Why could a PUSH subscription be added and initialized successfully and not the PULL?

2. What am I doing wrong (if anything) and how can I get it working (I do not want a PUSH subscription as the server is a high-availability server)? 

SYSTEM SPECS (TO AVOID FURTHER QUERIES):

OS: Windows Server 2003 Enterprise x64 Edition Service Pack 2
SQL SERVER 2005 (Version 9.0) ENTERPRISE EDITION (both Publisher and Subscriber)

Please provide me with some solution as soon as possible.
Thanks in advance.

Regards,

Ashik


Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>