|
|
| |

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.
|
|
|