Sql-server – Replications fails with a vague message: “The last step to run was step 3: Detect nonlogged agent shutdown”

sql servertransactional-replication

In Transactional Replication of SQL Server, Synchronization job starts well and proceeds a while. However, in middle of the work it shows this error:

The job failed. The Job was invoked by User WIN-XXXXX\Administrator.
The last step to run was step 3 (Detect nonlogged agent shutdown.).

It's a very generic error message. How can I get more details about the error?

Best Answer

I found the SQL job (under SQL Server Agent, Jobs folder at the left pane of SQL Server Management Studio) associated to Distribution Agent which is in charge of running Synchronization job. I edited the 2nd step of the job i.e. Run agent step (available in the Job Properties dialog that appears by double clicking the job or by right click on the job and selecting Properties).

enter image description here

In the Job Step Properties dialog, I added two parameters to get more log messages:

-OutputVerboseLevel 2 -Output F:\log_dir\snapshotagent.log 

enter image description here

I re-run the Synchronization job and after seeing the error, the details were available in F:\log_dir\snapshotagent.log. I hope it is useful for you.