MSSQLCity.Com - All about MS SQL
     
About Us  
SSWUG Articles  
Articles  
FAQ  
Administration  
Backup/Restore  
Connectivity  
Development  
General  
Installation  
Replication  
Transfer/move  
Trouble  
SQL 6.5  
Scripts  
Tips  
Test Exams  
Advertise  
Download  
History  
Search  
Traffic  
Related Links  
     
Your button logo
Add to Favorites
 
     
 


How can I start replication agents via Transact-SQL?

Answer:

SQL Server has the following replication agents:

  • Snapshot Agent
  • Distribution Agent
  • Logreader Agent
  • Merge Agent


  • There are several ways to start replication agents via Transact-SQL.

    1. You can use the sp_start_job system stored procedure.

    In the Enterprise Manager select the name of the job that start the replication agent and specify this name as the job_name:

    EXEC msdb..sp_start_job <job_name>

    2. You can use the xp_cmdshell extended stored procedure.

    For example:
    EXEC master..xp_cmdshell "snapshot.exe <parameters>"

    3. You can use SQL DMO.


     

     
    Visit The SQL Server Worldwide User's Group for all the latest news and information about SQL Server, Oracle, DB2 and XML for developers and administrators.

    (c) 1997, 2005 Bits on the Wire, Inc