We're here to help!

Automatic Synchronisation in BATCH Mode in Windows


Read our docs Automate a process of synchronisation in Windows in batch mode

Problem Details

Problem Statement

Problem with the BATCH mode is that it requires a manual input to exit the process.

Applicable Error Code

It does not exit the synchronisation process

Affected Versions

Standby version 7.0.40

Affected Platforms



We want to automate a process of synchronization in Windows in batch mode. Problem with the BATCH mode is that it requires a manual input to exit the process.

Here is the command we used:

dbvisit\_setup.exe --sync --ddc PROD --sync\_nologging --tmp\_dir C:\TEMP --tmp\_dir\_dest C:\TEMP

Below you can see the output of the BATCH mode with the sentence for the keyboard input:

> ------------------------------------------------------------------------------- 
To complete standby database sync run dbvisit on the primary, then on the standby server. 
dbvisit\_setup completed in BATCH mode at 20150625 15:49 
Please press enter to exit...

Could you please review our request? Is there a trick to exit the program without manual keyboard input? Or let us know if you can implement a such feature.


For automation you can implement a workaround in Powershell. An example is:

> #variables
> $output = "C:\temp\output.txt" $eoutput = "C:\temp\error\_output.txt" $program = "C:\Program Files (x86)\Dbvisit\Standby\dbvisit\_setup.exe" $arguments = "--sync --ddc SOURCE --sync\_nologging --tmp\_dir C:\TEMP --tmp\_dir\_dest C:\TEMP" start-process $program -ArgumentList $arguments -RedirectStandardOutput $output -RedirectStandardError $eoutput
> # Waits for finish
> DO { Sleep 30 } While (!(Select-String -Quiet -SimpleMatch -path $output -pattern "Please press enter to exit..." ))
> #Check if file exists and if something is written in. In case yes, email is send with attachment.
> If (Test-Path $eoutput){ # // File exists if((Get-Content $eoutput) -ne $Null) { $From = "YourEmail@gmail.com" $To = "AnotherEmail@YourDomain.com" $Cc = "YourBoss@YourDomain.com" $Subject = "Email Subject" $Body = "Insert body text here" $SMTPServer = "smtp.gmail.com" $SMTPPort = "587" $mycredentials = "Password"
> Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject ` -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl ` -Attachments $eoutput -credentail $mycredentials } }
> # To appliation is send the enter. Beware of title's name. In case you install to different path it's needed to be changed.
> $wshell = New-Object -ComObject wscript.shell;
> $wshell.AppActivate('C:\Program Files (x86)\Dbvisit\Standby\dbvisit\_setup.exe')
> Sleep 1 $wshell.SendKeys('~')
> #Email sent when action is done
> $From = "YourEmail@gmail.com" $To = "AnotherEmail@YourDomain.com" $Cc = "YourBoss@YourDomain.com" $Subject = "Email Subject" $Body = "Insert body text here" $SMTPServer = "smtp.gmail.com" $SMTPPort = "587" $mycredentials = "Password"
> Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject ` -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl ` -credentail $mycredentials

You can save above lines in to file input.ps1 and start by running the following in the command line:

Powershell.exe -File C:\my\_path\input.ps1

As you can see the Powershell is powerfull tool. It is even able to start programs in remote Windows:


So it can fully automate the synchronization for Primary and Standby servers.

P.S. Development is implementing a change in the next update 7.0.42. Then manual input won't be needed.

Miroslav Sivon July 01, 2015 23:08

Have more questions? Submit a request