Blog

How to Configure NextGen Archiving in WinCC OA to use a Microsoft SQL Server

How to Configure NextGen Archiving in WinCC OA to use a Microsoft SQL Server

This two-part blog series is intended to be a step-by-step overview on how to set up and utilize an MS SQL Server and WinCC OA’s NextGen Archive (NGA). Information for a general setup exists via the WinCC OA Documentation (see Further Reading/Links), but this walkthrough aims to be more detailed and explicit in the necessary steps.

  1. How To Create a Microsoft SQL Server Install for NextGen Archiving
  2. How to Configure NextGen Archiving in WinCC OA to use Microsoft SQL Server

Table of Contents:

  1. Notes/Prerequisites
  2. WinCC OA
    1. 2.1 Project Setup
    2. 2.2 NGA Configuration
    3. 2.3 Archive Group Configuration
    4. 2.4 DPE Archive Configuration
    5. 2.5 Data Retrieval
  3. Further Reading/References

1. Notes/Prerequisites

Required programs

This demo was implemented using:

  • WinCC OA 3.18 P006
  • Microsoft SQL Server 2022 Express
    • NOTE: Other versions of MS SQL may work with NGA, but it has not yet been verified by DMC.
  • Microsoft SQL Server Management Studio 18
  • Windows 11

Assumptions:

  • Proper licensing for NGA is configured.
  • The OS user has Windows administrator privileges.

2. WinCC OA

2.1 Project Setup

Back to Table of Contents

  1. Create a new project with NGA configured.
    1. When creating a new project, proceed with the project setup as normal.
    2. Under the “General Settings” step, ensure that the Use NextGenArchiver option is selected.
    3. For this demo, I’m creating a project titled NGA_Demo located in the “C:/WinCC_OA_Proj” directory.

Screenshot 1

If converting an existing project from HDB/RDB to NGA, then follow these steps in the “Converting existing project to NextGen Archiver Project” section: NGA Notes and Restrictions

2.2 NGA Configuration

Back to Table of Contents

It’s time to fire up OA and open GEDI.

  1. Create new back-end.
    1. Navigate to the “Database Engineering” window via “SysMgm/Database/Database Engineering”.
    2. Under the “Backend list”, click the + icon (Add new backend).
    3. Name the Backend a user-friendly name.
      1. I used the title MSSQLEXPRESS.
      2. NOTE: The Backend name does not need to match the server name, so use a name that makes most sense for your application.

Screenshot 2

Screenshot 3

2. Configure the MS SQL Backend “General Settings – Basic Configuration”. 

  1. Specify the following parameters:

Parameter

Value

Name

<User-friendly backend name>

Profile

MSSQL_nonRedundant

Database Connection

<host>/<SERVER NAME>

Database Username

<winccoaUsername from db.windows.config>

  1. NOTES:
    1. The Profile option cannot be changed later.
    2. If using a redundant server, use the MSSQL option for Profile.
    3. Don’t worry about specifying the Password, the field will clear upon initial configuration saving.
  2. Click the Password field, enter the winccoaPassword from db.windows.config, and click OK.

Screenshot 4

Screenshot 5

3. Configure the MS SQL Backend “Extended Settings”.

  1. Specify the following parameters:

Parameter

Value

Database Control/ Execution File

NGAMSSQLServerBackend

Database specific configuration/db.database

< dbName from db.windows.config>

Screenshot 6

4. Finish MS SQL Backend setup

  1. Select the Active option.
  2. Click Save.

Screenshot 7

2.3 Archive Group Configuration

Back to Table of Contents

Now that the database connection has been established, we can set up Archive Groups.

  1. Create new archive group
    1. Navigate to the “Runtime Engineering” window via “SysMgm/Database/Runtime Engineering”.
    2. Under the “Archive Groups”, click the + icon (Add a new group).
    3. Name the Archive Group.
    4. I used the title DEMO.
    5. Ensure the Active option is selected.
    6. Configure the “Storage Settings” section as desired.
    7. Click Save.

Screenshot 8

Screenshot 9

Screenshot 10

Screenshot 11

2. Verify SQL Archive Group Creation

  1. Open Microsoft SQL Server Management Studio.
  2. Right click dbo.archive_groups and select the Select Top 1000 Rows option.
    1. The new archive group should be visible in the “Results” section.

Screenshot 12

2.4 DPE Archive Configuration

Back to Table of Contents

Now that we’ve created an archive group, we can apply the archive group to a DPE so that its historical data can be logged and tracked.

  1. Insert _archive config
    1. Within PARA, right click the target DP or DPE and select the Insert config option.
    2. Select Archive settings.
    3. Click OK.

Screenshot 13

Screenshot 14

2. Select archive group

  1. Underneath the target DP/DPE, select the new _archive option.
  2. Select the desired archive group in the “Archive Group” drop-down.
  3. Ensure the Active option is selected.
  4. Click OK.

Screenshot 15

3. Verify SQL Archive Group Application

  1. Open Microsoft SQL Server Management Studio.
  2. Right click dbo.elements and select the Select Top 1000 Rows option.
    1. The newly configured DPE(s) should be visible in the “Results” section. 

Screenshot 16

2.5 Data Retrieval

Back to Table of Contents

Now that DPEs have been configured with archiving capabilities, we can now retrieve DPEs’ historical data.

  1. Verify SQL DPE Archiving.
    1. Open Micorosft SQL Server Management Studio.
    2. Right click dbo.event_<segment_id>_a and select Select Top 1000 Rows.
      1. The segment_id for each archive group can be found in the dbo.segments table.
    3. If values have been changed since archiving was configured, entries should be visible in the “Results” section.

Screenshot 17

2. Retrieve historical data.

  1. The WinCC OA functions dpGetPeriod() and dpQuery() can be used to retrieve historical data.
    1. The two examples below demonstrate a test panel running each of the two aforementioned functions and printing the results to the Log Viewer.
    2. The returned data should reflect that viewed in the Micorosft SQL Server Management Studio tables.
  2. Be sure to understand your server’s backup and retention policy to determine what data and how much historical information can be accessed.

NOTE: For help writing SQL queries, use the SQL Panel found in SysMgm/Reports/SQL-Query

Screenshot 18

Screenshot 19

Screenshot 20

3. Further Reading/References

Learn more about our Manufacturing Automation and Intelligence expertise and contact us for your next project. 

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Related Blog Posts