Database Synchronization

Check Function and Database Synchronization (Crucial)

This section explains how the database structure is synchronized between the Wise SCADA Development environment and the Runtime environment.

Warning: Incorrect or incomplete synchronization can lead to data loss, errors, and unexpected system behavior.

1. Tables and Columns Automatically Created by Runtime

The Problem In the Development environment, you might define a table or column name in the Historical Tag settings or the Table List that does not yet exist in the physical database.

Runtime Behavior When Runtime is started:

  • It automatically creates missing tables.
  • It automatically adds missing columns.

The Result The database view in the Development environment falls behind the actual state (newly created columns are not visible in the editor).

Solution (Synchronization Steps)

  1. Stop the Runtime.
  2. Return to the Database page.
  3. Select the relevant connection and press the Check Tables button.
  4. In the synchronization screen that opens, use the Save Database → SCADA option to transfer the current structure from the physical database back to the Development environment.

2. Changing Database Type (e.g., SQLite → MySQL)

The Problem Different database systems have different naming conventions.

  • Example: MySQL generally requires table names to be lowercase (e.g., table1).
  • However, “Table1” might have been previously defined for SQLite in the Development environment.

Runtime Behavior After changing the database type, Runtime attempts to create tables based on the old definition (e.g., “Table1”), which causes errors in databases like MySQL that expect specific casing.

The Solution Immediately after changing the database type:

  1. Press the Check Tables button.
  2. In the screen that opens, use the Save Database → SCADA button to make the Development environment accept the new (empty/default) structure suitable for the new database type.
  3. Then start Runtime.
  4. Runtime will generate the tables in the correct format itself (e.g., table1).

3. Important Warnings – Data Loss and Artifacts

3.1 Data Loss (Tag Data Type Change) When you change the data type of a tag that has Historical features enabled (e.g., changing from INT to REAL):

  • Runtime deletes the relevant column and recreates it to match the new type.
  • Consequence: All old records previously stored within that column are permanently lost.

3.2 Artifact Columns (Column Name Change) If you change the name of a column in the Historical Tag section:

  • Runtime creates the new column name (e.g., Value_B).
  • The old column (e.g., Value_A) is not deleted and remains in the database as an artifact (residue).

Cleanup: These unused columns are not automatically deleted by SCADA. Manual cleanup via database management tools is required to maintain database integrity.

4. Manually Added Tables and Error States

4.1 Standard Recognized Tables Wise SCADA automatically recognizes and manages the following three tables by default:

  • Table1
  • AlarmTable
  • EventTable

4.2 Custom Tables If you use a non-standard table name in the Historical Tag settings (e.g., CustomReportTable):

  • You must manually add this table to the lower panel on the Database page.
  • Note: You only need to add the table definition; the columns inside it are automatically created by Runtime, so you do not need to add them manually.

4.3 Duplicate Column Name Error You cannot assign the same column name to multiple Historical Tags within the same table. Each tag must map to a unique column.

Leave a Reply