Solved

Starting Snapshot Agent from a Script

Posted on 2003-10-24
5
809 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

762 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

20 Experts available now in Live!

Get 1:1 Help Now