Wednesday, February 29, 2012

[Replication] Running manually / Running by hand

Had to run some replication by hand while the agent was offline.  Here's how to do it.  I'd give thanks but I don't remember where I first read it.  Probably Hilary Cotter.  Thanks, Hilary!

SELECT      subsystem, REPLACE(command, '-Continuous', '')
FROM  msdb.dbo.sysjobsteps
WHERE job_id IN ( SELECT      job_id
                              FROM  msdb.dbo.sysjobs
                              WHERE name LIKE 'yourreplnamehere%' ) --or whatever the job is called
            AND subsystem <> 'TSQL'
            AND subsystem <> 'snapshot'

That gives you the commands needed.  We’ve removed the -Continuous for simplicity. (otherwise it would continue to run, and you’d need 3 windows)

Login to the server as SQLService.  Bring up a command window.
cd "\Program Files\Microsoft SQL Server\90\com\" (or wherever replication is installed; this was an old box)
distrib.exe (repeat for each server as necessary)

No comments: