Auto Restart of MINE, FETCHER and APPLY on Windows

 The purpose of this article is to restart dbvrep processes on Windows.


Problem Details

 

Affected Platforms

Windows 


Description

For an unknown reason, dbvrep process died. You cannot see Windows services running either dbvrep process in the Task manager. 

If you hit any error, restart of a dbvrep process won't probably help you. 

Solution

If you're using antivirus protection exclude dbvrep files and archive logs (redo logs) from the antivirus checks. 

If cannot see any error in the MINE|APPLY|FETCHER log check System Log in Event Viewer - https://technet.microsoft.com/en-us/library/aa996634(v=exchg.65).aspx. The process was killed outside by OS environment. Perhaps, you'll find any relevant information what happened with the process from the System log. However, this workaround is perfectly suitable for you.

 

In the Windows command line execute the query. Some details you can see on following page - http://commandwindows.com/sc.htm. You can also use this command:

sc query type= service state= all > allserviceslist.txt

The command will query all services and store them in the file allserviceslist.txt. Find service name starting with name DbvisitReplicate.

Replace pattern CHANGE_FOR_REAL_SERVICE_NAME for a real name of the dbvrep apply service and then add below scrip to the file i.e. check_dbvrep_service.bat

@echo off
for /F "tokens=3 delims=: " %%H in ('sc query "CHANGE_FOR_REAL_SERVICE_NAME" ^| findstr " STATE"') do (
if /I "%%H" NEQ "RUNNING" (
timeout 300 > nul
net start "CHANGE_FOR_REAL_SERVICE_NAME"
)
)

 

You can add to this scripts mail notification, so you'll be noticed by this scripts when scheduler started a process. Bear in mind, this auto restart script won't help if in case of error. So the task will start the process again and again...

Create schedule task using Task Scheduler (Schtasks.exe). Small tutorial below:

Description is up to you.

I recommend repeating the task every 15 minutes.

add check_dbvrep_service.bat file to the task.

Click ok.