"Uninitialized subscription" error in replication monitor

Harsha picture Harsha · Jun 20, 2012 · Viewed 16.8k times · Source

I'm using SQL Server 2012 and trying to implement transactional replication. Im using the system stored procedures to create the publications and subscriptions. I was successful in creating these things, but when i check the replication monitor, it shows "Uninitialized subscription".

When I check the synchronization status on the subscription, i found this log

Date        6/20/2012 7:36:33 PM
Log     Job History (HYDHTC0131320D-PublisherDB-PublicationOne-HYDHTC0131320D\MSS-ReplicationSubscri-7C1D7509-C8A6-4073-A901-0433A2B6D2D3)

Step ID     1
Server      HYDHTC0131320D\MSSQLSERVER2
Job Name        HYDHTC0131320D-PublisherDB-PublicationOne-HYDHTC0131320D\MSS-ReplicationSubscri-7C1D7509-C8A6-4073-A901-0433A2B6D2D3
Step Name       Run agent.
Duration        00:07:41
Sql Severity    0
Sql Message ID  0
Operator Emailed    
Operator Net sent   
Operator Paged  
Retries Attempted   0

Message
2012-06-20 14:14:13.986 Copyright (c) 2008 Microsoft Corporation
2012-06-20 14:14:13.986 Microsoft SQL Server Replication Agent: distrib
2012-06-20 14:14:13.986 
2012-06-20 14:14:13.986 The timestamps prepended to the output lines are expressed in terms of UTC time.
2012-06-20 14:14:13.986 User-specified agent parameter values:
            -Publisher HYDHTC0131320D
            -PublisherDB PublisherDB
            -Publication PublicationOne
            -Distributor HYDHTC0131320D
            -SubscriptionType 2
            -Subscriber HYDHTC0131320D\MSSQLSERVER2
            -SubscriberSecurityMode 1
            -SubscriberDB ReplicationSubscriberDB
            -Continuous
            -XJOBID 0xDFE51AEC7F9E3F42A450CE8874B662CD
            -XJOBNAME HYDHTC0131320D-PublisherDB-PublicationOne-HYDHTC0131320D\MSS-ReplicationSubscri-7C1D7509-C8A6-4073-A901-0433A2B6D2D3
            -XSTEPID 1
            -XSUBSYSTEM Distribution
            -XSERVER HYDHTC0131320D\MSSQLSERVER2
            -XCMDLINE 0
            -XCancelEventHandle 000005F8
            -XParentProcessHandle 00000560
2012-06-20 14:14:13.986 Startup Delay: 619 (msecs)
2012-06-20 14:14:14.606 Connecting to Subscriber 'HYDHTC0131320D\MSSQLSERVER2'
2012-06-20 14:14:14.656 Connecting to Distributor 'HYDHTC0131320D'
2012-06-20 14:14:14.671 Parameter values obtained from agent profile:
            -bcpbatchsize 2147473647
            -commitbatchsize 100
            -commitbatchthreshold 1000
            -historyverboselevel 1
            -keepalivemessageinterval 300
            -logintimeout 15
            -maxbcpthreads 1
            -maxdeliveredtransactions 0
            -pollinginterval 5000
            -querytimeout 1800
            -skiperrors 
            -transactionsperhistory 100
2012-06-20 14:14:14.683 Agent message code 21040. Publication '' does not exist.

How do I solve this issue?

Answer

Dan picture Dan · Oct 19, 2012

I received the same error. My fix was to explicitly define the Job_login and job_password which I had as null to start with.

EXEC sp_addpullsubscription_agent 
@publisher = @publisher, 
@publisher_db = @publicationDB, 
@publication = @publication, 
@distributor = @publisher, 
@job_login = $(Login), 
@job_password = $(Password);