Details on data buffering

Write access

In the chapter Data buffering, basics has already been alluded that data can be buffered without a connection to the DB (write only access), but they cannot be read from the buffer (read only access). Not until the connection to the database is established, the buffered data can be written into the database and consequently also read out.

Limit for data buffering

In case of a prolonged disconnect to the database, it is required to set a limit in the RDB Configuration in the option “Number of blocks on HDD” (MB, GB, or percent indication). That’s important in case that the RAM and also HDD are out of memory and hence the data cannot be buffered and consequently get lost.

Enabling data buffering

Data buffering can be activated by setting the internal data point element stopWriteToDB of the type _RDBArchive.

stopWriteToDB = 1

The data blocks are not written into the database, but are buffered in the memory, on hard drive disc, respectively. That means that the same behavior is simulated as during a database disconnect. In case of a disconnect and reconnect to the database the data blocks will be still buffered and not written into the database, when the value of this data point element is 1.

stopWriteToDB = 0

Default value. The data are written into the database directly, if a connection to the database is established. If the value of stopWriteToDB was 1 and is set to 0 now, the buffered data will be written into the database by the RDB manager.

In case of a redundant system this data point element should have the same value on both computers so that they exhibit the same behavior after an active/passive switch. This means that if the value of this data point element was set to 1 on the active computer and to 0 on the passive computer then the passive computer would write the buffered data blocks into the database after a switch.

Start of the RDB Manager with buffering and without connection to the database

The following instruction describes how an RDB Manager with an automatic buffering can be started, when the database is not yet available at the start-up of the WinCC OA project, because the Oracle server has not started yet.

Set both internal data point elements before the start-up of the RDB Manager:

  • RDBArchive.connection.closeDBConnection = 1
  • _RDBArchive.connection.openDBConnection = 0

If the database is started, only one of these both data point elements may be set. The second one indicates the status.

With the following steps it will be achieved that always the value 1 or 0 is set on these internal data point elements.

  1. Open the WinCC OA PARA.
  2. Tick the Internal data points checkbox.
  3. Select the data point element _RDBArchive.dbConnection.closeDBConnection.
  4. Set the value to 1.
  5. Click on Apply.
  6. Deactivate the Last value bit.
  7. Click on Apply again.
  1. Select the data point element _RDBArchive.dbConnection.openDBConnection.
  2. Set the value to 0. Thereby the connection to the database will not be established immediately.
  3. Click on Apply.
  4. Deactivate the Last value bit.
  5. Click on Apply again.
  6. In case of a redundant WinCC OA project check on the passive computer whether the set values have been applied.

  7. Select the data point element _RDBArchive_2.dbConnection.closeDBConnection.
  8. Set the value to 1.
  9. Click on Apply.
  10. Deactivate the Last value bit.
  11. Click on Apply again.
  12. Select the data point element _RDBArchive_2.dbConnection.openDBConnection.
  13. Set the value to 0. Thereby the connection to the database will not be established immediately.
  14. Click on Apply.
  15. Deactivate the Last value bit.
  16. Click on Apply again.
  17. In case of a redundant WinCC OA project check on the passive computer whether the set values have been applied.

The activation of the database connection can take place after a defined delay time. Use the tnsping <connect_identifier> command to determine whether the connection to the database has been finally established. To do so, call the tnsping command in an system() function in a CTRL script.

Example

main()
{
  string out;
  out = system("tnsping EITST077_DB11g");
  DebugN(out);
}

The output takes place in the WinCC OA log viewer.

If a connection to the database could be established successfully, it should nevertheless be awaited about 3 minutes until the Oracle server is fully booted. Then the connection can be reopened:

  • Setting the data point element _RDBArchive.dbConnection.openDBConnection to 1 for host 1.
  • Setting the data point element _RDBArchive_2.dbConnection.openDBConnection to 1 for host 2 in case of a redundant project.