Solved

Starting Snapshot Agent from a Script

Posted on 2003-10-24
5
821 Views
Last Modified: 2009-07-29
I am modifying the schema of my db by adding a column to a table.  Then I add the column to my transactional replication publication by using sp_articlecolumn.  As a last step I want to run the snapshot agent immediately as my snapshot is now no longer valid.  What system stored procedure do I use to run an existing snapshot agent?
0
Comment
Question by:LStampfli
5 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 9616117
sorry don't the 2 parameters on articlecolumn do this for You?
won't the snapshot agent job get scheduled ...?

if it doesn't then use the sp_start_job procedure...
 

[@force_invalidate_snapshot = ] force_invalidate_snapshot

Acknowledges that the action taken by this stored procedure may invalidate an existing snapshot. force_invalidate_snapshot is a bit, with a default of 0. 0 specifies that changes to the article will not cause the snapshot to be invalid. If the stored procedure detects that the change does require a new snapshot, an error will occur and no changes will be made. 1 specifies that changes to the article may cause the snapshot to be invalid, and if there are existing subscriptions that would require a new snapshot, gives permission for the existing snapshot to be marked as obsolete and a new snapshot generated.

[@force_reinit_subscription = ] force_reinit_subscription

Acknowledges that the action taken by this stored procedure may require existing subscriptions to be reinitialized. force_reinit_subscription is a bit, with a default of 0. 0 specifies that changes to the article will not cause the subscription to be reinitialized. If the stored procedure detects that the change would require subscriptions to be reinitialized, an error will occur and no changes will be made. 1 specifies that changes to the article will cause existing subscriptions to be reinitialized, and gives permission for the subscription reinitialization to occur.

0
 

Author Comment

by:LStampfli
ID: 9617102
I believe that this will cause a new snapshot to be generated on schedule, but not to cause the job to run immediately.  The wording:

"gives permission for the existing snapshot to be marked as obsolete and a new snapshot generated"

implies that a new snapshot can be generated, but not when.

I will double-check that though.  I want to force the snapshot to be created right away.

I tried sp_start_job and that definately does the trick.  I figured there was a replication stored procedure to do this because there are so many of them, but apparently not.

Thanks for the help.
0
 
LVL 8

Accepted Solution

by:
dishanf earned 250 total points
ID: 9649176
~ Create a Job
~ Steps Tab
           -Publisher [Servername] -PublisherDB [db] -Publication [pub- name] -Subscriber [servername] -SubscriberDB [db] -Distributor [servername] -DistributorSecurityMode 1

and set type to "Replication Merge"

and run Job
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now