Solved

Starting Snapshot Agent from a Script

Posted on 2003-10-24
5
906 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:
Dishan Fernando 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

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…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

636 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