Back

Topic

[KB778]HDS replication : a simple SCADA Basic sample

Tags: HDS, Replication, SQL Server

10 years ago
By RM
Options
Print
Applies to:

PcVue 8.10 onwards


Summary:

This article proposes a Scada Basic sample program explaining how to launch a SQL Server database replication, using replicationmanager.exe utility. If your replication doesn’t start normally, please read the following article KB478.


Details:

If you have an architecture with 2 redundant archiving server (HDS archiving), grouped in an historical association (Multiple active servers and multiple SQL servers), you will probably have to launch some replications from one server to another, in case of server failure.

To launch a replication you can use a MSDOS command with “replicationmanager.exe” (in BIN directory of Pcvue) with some parameters.

For example to launch a replication of last hour:

Replicationmanager.exe /N=”Replication1″ /J=1 /L=600 /T=36000000000

/N=”Name of the replication”created by the Database Manager

/J=1 : equal to 1 if you use sqlexpress 0 otherwize

/L=600 : steps of replication (recommended 1 step for 3 to 30 seconds of data)

The steps are used to divide the replication process. The more steps the less data treated for each step.

/T=36000000000 : period in hundreds of nanoseconds

Below a basic example of scada basic program to launch a replication of 2 SQL databases between two dates

This program is intended to be executed cyclically.

Warning : Always use the verb APPLICATION(“load”,…) to launch a MSDOS command and NEVER USE the verb SYSTEM(“SYSTEM”,COMMAND) which may cause a system instability.

It assumes that the following variables exist in Pcvue database :

@REPLIC.TS.START.DATE(TEXT),

@REPLIC.TS.START.TIME(TEXT),

@replic.copy_valid (BIT)

sub start_replic()

Dim strParam as str;

Dim DblTS as Double;

Dim strTS as str;

DblTS= DATETIMEVALUE(REPLIC.TS.START.DATE,REPLIC.TS.START.TIME);

strTS = DATETIMESTRING(DblTS,”U”);'”U” format for the replication not in the help. It is used to indicate that the timestamp DBlTS is in UTC

strParam =ADDSTRING(“/N=”\Replication1\” /J=1 /L=600 /S=”,strTS);'”Replication1″ is the name of your replication

strParam =ADDSTRING(strParam,” /E=”); DblTS = DATETIMEVALUE(DATE,TIME);

strTS = DATETIMESTRING(DblTS,”U”);

strParam =ADDSTRING(strParam,strTS); print (strParam);

APPLICATION(“LOAD”,”ReplicationManager.exe”,strParam,5, “C:\\ARC Informatique\\PcVue xx\\Bin”);

‘ In the above path, replace PcVue xx with PcVue version you are using. For instance PcVue 10.0 or PcVue 11

@replic.copy_valid = 1;

end sub


Created on: 13 Apr 2015 Last update: 04 Sep 2024