Configuration of HDB - RDB Parallel

How to setup ValueArchive and RDBManager in parallel

  • Install Oracle and Create a new DBSchema with win_install/unix_install - see chapter First-Time Installation.

  • Check the logFile wincc_oa_path/data/RDBSetup/ora/RDB_Setup.log for error messages.

  • Create a new WinCC OA project - see chapter Create project.

  • Add the RDBManager (-num 99 command line parameter) to the console and the necessary config entries to the [ValueArchiveRDB] section of the config file (DbUser, DbPass, Db, ..).

The RDBManager has to be started prior to the startup of the ValueArchives,i.e. has to be inserted to the manager list prior to the ValueArchives in the WinCC OA Console.

Figure 1. Config File with the RDB Settings

Config Entries

[general]
useRDBArchive = 1
useRDBGroups = 1

[ValueArchiveRDB]
DbUser = "userName"
DbPass = "YourPW"
Db = "YourDB"

NOTE

  • With the optional config entry "defaultArchive" the default archive can be changed. If the default archive is not explicitly set and the "useRDBArchive = 1" is being used, the default archive of the RDBManager 97 is used.If the config entry defaultArchive should be used, it has to be set before the first project startup!
  • Internally the RDB manager uses the archive number 97 by default. In the console, however, the RDB manager is started with -num 99.

    The ValueArchive_0 must not be used for the feature HDB-RDB Parallel. Use ValueArchive_1 or higher for archiving.

  • Start the project.

  • Open System Management->Database->RDBManager and set the password for the Oracle Schema User ( The password you specified when creating the database).

After the password was saved, delete the password from the config file. Passwords must never be saved visibly hardcoded in a file.

Figure: Set Password for the Schema User

  • Restart the whole project.

  • Check the wincc_oa_path/log/PVSS_II.log file for error messages.

  • Check the ARC_LOG table in Oracle for error messages (ERRORSTACK): SQL> SELECT ERRORSTACK FROM ARC_LOG;

Figure: SQL> SELECT ERRORSTACK FROM ARC_LOG;

Now the RDBManager is configured and running.

  • Add an archive config for a data point element for testing purposes.

  • Configure the RDB-ArchiveGroup 'EVENT'. Open the "RDB - File Selection" Panel via System Management -> Database -> RDB Archive Groups

Figure: Archive Group "EVENT";

  • Write some values and read them by using the EVENTScreen:

Figure: EVENT Screen - queried Values

  • If everything is set OK, the ValueArchive can be configured for the parallel archiving.

CAUTION

For automatically generated archive groups, the default settings for the archive change are applied. The settings must be reviewed by the user and changed if necessary. A connection to the Oracle DB is required for the configuration of the archive group.As long as both managers (RDB, HDB) are running, values are written to the HDB and the RDB. If one manager stops, the other manager continuous archiving. Consider that this can lead to gaps inside the archiving due to no replication between HDB and RDB.

NEVER use the ValueArchive 0 for parallel archiving.

  • Open the 5Min-ValueArchive Configuration panel - go to 'Special options' and enable 'forward values to RDB'.

Forward to RDB

To write parallel to HDB and RDB, the forwardToRDB flag must be set for the corresponding ValueArchive. With this setting the changes written to the HDB are also written to the RDB.

It is still possible to archive data points either only to the HDB or only to the Oracle DB. To archive data points only to the HDB the _archive-Config must be configured with an HDB-Archive (without active forwardToRDB flag). These values can only be queried using the UI if the config entry queryRDBdirect = 0 is being used.

To archive data points only to the Oracle DB, the _archive-config must be configured with an RDB archive group. The values of the RDB can either be queried over queryRDBdirect=0 or over queryRDBdirect=1. The RDBManager is therefore not only used to forward values and can still be used as an independent archive manager.

Forward To RDB flag, it is verified if a corresponding RDB archive group exists to save the values for the ValueArchive also at the RDB. If not, a new archive group will be created automatically. For _ValueArchive_1 the archive group VA1 will be created, for _ValueArchive_2 the archive group VA2 will be created etc.

Forward To RDB flag can also be changed during runtime, i.e. no restart of the ValueArchive or RDB manager is necessary to apply the changes.

Figure: ValueArchive Configuration Panel - "Forward Values to RDB"

  • The archive group VA1 will be created in Oracle.

  • Check if there are error messages.

  • Check in the RDBManager Archive Group Panel if the VA1 ArchiveGroup was created (System Management->Database->RDBArchiveGroups).

Figure: VA1 Archive Group

  • Start the archive manager 1 in the console

Figure: WinCC OA Console - Start an Archive Manager

Enabling parallel Archiving for a Data point Element

  • Check that the RDBManager and the 5-Minute Archive are running.

  • Configure an archive config on a data point element. Choose the 5-Minute Archive (fwd) and click "Apply".

When the ForwardToRDB flag is set (see above), the corresponding Value Archives inside the archive selection are marked with the postfix "(fwd)" (see figure below).

Figure: Configure an _archive Config

  • Write some values to this data point element:

main(mapping event)
{
  DebugN(dpSet("System1:ExampleDP_Arg2.:_original.._value", 4000));
}
  • The values are stored in parallel in the 5-Minute Archive and in the VA1History Table in Oracle.

  • To check if everything is working. Set the config entry: queryRDBDirect to 0. Therefore, the values are queried by the Archive Manager. To query the values directly from Oracle, set queryRDBDirect to 1.

To increase the performance of historical data queries for a WinCC OA, the config entry queryRDBdirect should be set to 1.

You can also use the function setQueryRDBDirect() to set the config entry "queryRDBdirect" online. By using the function useQueryRDBDirect() you can query whether the RDB or the HDB is being used.

Figure: Config Entry queryRDBdirect = 0

  • Now you can query the values by the archive manager:

main()
{
  dyn_float val; //Contains the values

  dyn_time t;//Contains the source times of the values
        int i;//The function returns -1 in case of errors
        DebugN(dpGetPeriod(makeTime(2020,6,3,14,55),makeTime(2020,6,3,14,56),0,"System1:ExampleDP_Arg2.:_offline.._value", val, t));
        DebugN("Values:", val);
        for(i=1;i<=dynlen(val);i++)
        {
          DebugN("Result values:");
          DebugN(val[i],t[i]);
        }
}

Figure: Queried Values

  • Query the Oracle values e.g. by using SQL:

SELECT VALUE_NUMBER FROM VA1History;

Figure: Query Values via SQL

or change the config entry queryRDBDirect to 1 to query the values from the RDB.

When changing an archived DP element assignment from one archive to another archive and back again (e.g.A1 -> A2 -> A1 -> A2), consider to perform at least one archive record change of the archive that was assigned at first (A1). Assign a DP element to the archive A1 first after this archive record change. This is necessary since the archives only contain DP element assignments per archive record.

queryRDBdirect

To increase the performance of historical data queries for a WinCC OA system, the config entry queryRDBdirect should be set to 1. Otherwise queries for historical data are sent to the HDB of the field system instead of using the RDB. This could lead to delays due to the more complex architecture, depending on the speed of the connection between field and control system (cf. Figure: queryRDBdirect).

Figure: queryRDBdirect

NOTE

If the WinCC OA process running at the control system queries values from the field system the following steps are processed:

If queryRDBdirect is set to 1 the UI starts a direct query to the Oracle DB. The HDB (of the field system) is not used in this case and only the values that are stored in the RDB are sent to the UI.

If queryRDBdirect is set to 0 the query is sent using the DIST connection to the relevant field system. Inside the field system the data from the HDB is read and sent back to the UI.

HDB values can only be queried if queryRDBdirect is not active (= 0). Values of the RDB can be queried independent of the setting for queryRDBdirect.

useElemNameForReadRequest

When using distributed systems, it could happen that the DP Identification for other systems is not available e.g. after a restart of the system and no reestablished connection (due to network problems, etc.). In this case it is not possible to query data points of the other system. With the config entry useElemNameForReadRequest you can query data points for foreign systems even though no DP Identification is available.

Precondition

useElemNameForReadRequest is activated (=1) per default. To be able to use this feature queryRDbdirect must also be active (=1). Furthermore, a correct configuration of the assignment between WinCC OAsystem name and DB Connection must be done (see below)

Configuration of the system name

To access the data sets of the correct database scheme the assignment between database schema and the system name has to be configured respectively (see Configuration of the RDB Database Schema).

Due to the fact that it is possible to determine the SystemId of the foreign system out of the DP Identification the SystemName must be stated additionally.

Figure: Database schema including system name

A query to a foreign system using dpQuery must state the target system with REMOTE "TargetSystemName".