Solved

Starting Snapshot Agent from a Script

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

740 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