WinCC Professional Alarm Log Backup: Configuration and Export Methods
SIMATIC WinCC Professional (TIA Portal) stores alarm events in segmented SQL-backed archive files that are persisted only when Runtime is active. Unlike WinCC Advanced, where alarm-log backup can be configured directly on the alarm log object in the engineering interface, WinCC Professional requires configuration through Runtime Settings, the Alarm Control OCX, the WinCC OLE DB Provider, the Connectivity Pack, the Industrial Data Bridge, or the WinCC/ODK API. This reference covers every documented mechanism for archiving, backing up, and exporting alarm data from a WinCC Professional Runtime, with concrete configuration parameters, SQL table layouts, VBScript skeletons, and a verification matrix.
1. Alarm Logging Architecture in WinCC Professional
Alarm logging in WinCC Runtime Professional is implemented as a circular-segment archive in the Microsoft SQL Server instance that is shipped and licensed with WinCC. Each segment is a bounded SQL Server database file (typically 1–500 MB per segment) that the runtime closes and rotates when its configured size or time limit is reached. Closed segments are renamed with a timestamp suffix and moved to the configured backup path.
| Parameter | Default | Typical Range | Engineering Location |
|---|---|---|---|
| Segment size (per file) | 1 MB | 1 MB – 500 MB | Alarm log > Properties > Archive configuration |
| Segments in path (online) | 500 | 1 – 1000 | Same |
| Backup path | Project path\ArchiveManager | Any local/network path | Runtime Settings > Services > Archive backup |
| Loggable events per segment | ~5,000–10,000 | Function of alarm text length | Derived from segment size |
| Shortest logging cycle (alarm events) | Event-driven (no cycle) | n/a | n/a |
| Shortest logging cycle (process values) | 500 ms | 500 ms – 1 h | Tag logging > Properties |
The WinCC documentation emphasizes that alarm logs are read out more quickly when the data records are smaller, so segment size should be tuned against the typical alarm event rate of the process. For WinCC Professional, the shortest logging cycle for associated process values is 500 ms; for WinCC Advanced, the equivalent lower bound is 1 second. The distinction matters when correlating an alarm log with a high-speed tag archive.
Reference: Logging Process Values and Alarms (Siemens documentation, PDF).
2. Configuring Alarm Logs in the Engineering Interface
Before configuring backup, the alarm log itself must exist. In TIA Portal V15.1 through V20, the steps are:
- Open the HMI device editor and select Alarm logs in the project tree.
- Insert a new alarm log (default name:
AlarmLog_1). The alarm log holds both configuration data (classes, priorities, colors) and runtime alarm events. - Open the HMI tags > Alarm category. Mark each alarm class to be persisted. By default, Errors and Warnings are logged; Information and System must be explicitly enabled if required.
- In the alarm log properties, configure the storage location. For WinCC Professional the storage is always SQL-backed and is automatically created under
<Project>\HMI\<Device>\ArchiveManager\AlarmLog_1at runtime build time.
Reference: Basics on alarm logging (RT Professional) – TIA Portal V20 documentation.
3. Configuring Runtime Backup in Runtime Settings
The primary mechanism for persistent alarm-log backup in WinCC Professional is Runtime Settings > Services > Archive Manager. This is the equivalent of the simpler "Alarm Log backup" toggle exposed in WinCC Advanced, but with more granular parameters.
3.1 Parameter Set
| Setting | Recommended Value | Notes |
|---|---|---|
| Activate backup | Enabled | Required for any persistence |
| Backup path | D:\WinCC_Archives\AlarmBackup\ | Local SSD recommended; NAS requires SMB signing per WinCC guidance |
| Backup start time | 00:00:00 | Daily full-segment sweep |
| Backup at segment close | Enabled | Copies each closed segment immediately |
| Delete segments after backup | Disabled (production); Enabled (long-running plants with limited disk) | If enabled, restore requires un-deleted segments plus backup |
| Backup retention (days) | 365–730 | Audit/regulatory dependent |
| Backup media | Local hard disk; Network drive (\<server>\archive$) | Avoid removable media on production nodes |
3.2 Effect on the File System
When backup is active, the runtime creates two parallel hierarchies under the backup path:
-
AlarmLog_1\<YYYY-MM-DD>_<HH-MM-SS>_R<NNNN>.mdf– closed SQL Server data files -
AlarmLog_1\<YYYY-MM-DD>_<HH-MM-SS>_R<NNNN>_log.ldf– transaction log
These files can be re-attached to any SQL Server instance (including SQL Server Management Studio) for offline querying, restoring into a test system, or feeding into a long-term historian.
4. Manual Export via the Alarm Control Toolbar
WinCC Professional embeds the WinCC Alarm Control OCX in any screen page. The control ships with an export button that dumps the currently displayed alarm view to CSV without scripting.
4.1 Operator Procedure
- Open the runtime screen that contains the WinCC Alarm Control.
- Apply any filters (time range, class, area).
- Click the Export toolbar icon (or File > Export in the OCX context menu).
- Select a destination path and confirm.
The exported file is a tab-separated CSV with header row. The columns follow the OCX column configuration; typical columns include Number, Time (millisecond resolution), Date, State (raised/came-in/acknowledged/cleared), Class, Text, Area, Event, Priority, UserName.
4.2 Button Re-Assignment (External Button)
To trigger the OCX export from a custom screen button (for example, a button on a faceplate), use the OLE-Automation interface. Reference: Siemens Support entry 11769423: Assigning OCX toolbar functions to external buttons.
' VBScript invoked on click of a custom button (WinCC Professional, TIA V15.1+)
Dim objAlarmCtrl
Set objAlarmCtrl = HmiRuntime.Screens("MainScreen").ScreenItems("AlarmControl_1")
' "Export" corresponds to OCX toolbar button ID 6
objAlarmCtrl.Export "D:\Exports\AlarmExport_" & Format(Now,"YYYYMMDD_HHMMSS") & ".csv", _
hmiExportSeparatorTab, _
hmiExportSelectionVisible, _
hmiExportFormatCSV
Set objAlarmCtrl = Nothing
5. Automatic Export via Scheduled Global Script
For unattended CSV export (for example, every 30 minutes), implement a global VBScript action triggered by a scheduler tag or by the WinCC Scheduler.
5.1 Scheduling Options
| Method | Trigger Source | Resolution | Notes |
|---|---|---|---|
| WinCC Scheduler (cyclic task) | Project tree > Common data > Scheduler | Min 1 s | Native, no tag overhead |
| Tag-triggered action (Boolean "Pulse_30min") | PLC sets bit via tag | Determined by PLC | Synchronized with plant cycle |
| Windows Task Scheduler > CScript | OS scheduler | 1 min granularity | Decoupled from HMI; can survive HMI restart |
5.2 Scheduler-Triggered Action Skeleton
' Global action bound to a 30-minute cyclic scheduler task
Const strPath = "D:\Exports\Alarm_"
Dim strFile
strFile = strPath & Year(Now) & Right("0" & Month(Now),2) & Right("0" & Day(Now),2) _
& "_" & Right("0" & Hour(Now),2) & Right("0" & Minute(Now),2) & ".csv"
Dim objAlarm
Set objAlarm = HmiRuntime.Screens("Overview").ScreenItems("AlarmControl_Export")
objAlarm.Export strFile, hmiExportSeparatorTab, hmiExportSelectionAll, hmiExportFormatCSV
HMIRuntime.Trace "Alarm export written: " & strFile & vbCrLf
Set objAlarm = Nothing
6. Programmatic Export via the WinCC/ODK API
The WinCC Open Development Kit (ODK) provides ANSI-C and .NET APIs that enumerate, read, and write archive segments without a screen object. The API exposes archive management functions for listing existing archives, reading data out of archives, and inserting data into archives, with the ability to export the data into *.csv files.
Reference: SIMATIC WinCC WinCC Engineering V15.1 – Programming reference (entry 109755216).
6.1 Key API Calls
| Function (C / .NET) | Purpose | WinCC Variant |
|---|---|---|
DMArchiveGetID / Archive.GetID
|
Resolve archive name to handle | RT Pro / RC |
DMArchiveGetSegmentCount |
Enumerate segments | RT Pro / RC |
DMArchiveGetSegmentData |
Read raw records | RT Pro / RC |
DMArchiveGetField |
Read column metadata | RT Pro / RC |
DMArchiveExport |
Direct CSV/XLS export | RT Pro / RC |
6.2 C Skeleton (WinCC/ODK, ANSI-C)
/* Export the entire AlarmLog_1 archive to a CSV file using ODK */
#include "apdefap.h"
void ExportAlarmLog(void)
{
DM_ARCHIVE_INFO sInfo;
DM_ARCHIVE_HANDLE hArchive = 0;
char szFile[] = "D:\\Exports\\AlarmLog_FullExport.csv";
if (DMArchiveGetID("AlarmLog_1", &hArchive) == DM_ARCHIVE_OK) {
if (DMArchiveExport(hArchive, szFile, DM_EXPORT_CSV, DM_EXPORT_APPEND_OFF,
DM_EXPORT_TIME_FROM_FIRST, DM_EXPORT_TIME_TO_LAST) == DM_ARCHIVE_OK) {
printf("Export OK\n");
} else {
printf("Export failed: %d\n", DMGetLastError());
}
}
}
7. Export via WinCC OLE DB Provider (Connectivity Pack)
The WinCC Connectivity Pack exposes the archive database through an OLE DB Provider so that any OLE DB consumer (SQL Server Management Studio, Power BI, custom .NET, Python via pyodbc) can query alarms directly. The provider name is WinCCOLEDBProvider.1 and the connection string is fixed-format:
Provider=WinCCOLEDBProvider.1;
Catalog=CC_<ProjectName>_<HH-MM-SS>;
Data Source=.<WinCCServer>;
' Example for a project named "PlantLine_A" with start time 09-30-00:
Provider=WinCCOLEDBProvider.1;Catalog=CC_PlantLine_A_09-30-00;Data Source=.\WinCC
The alarm archive tables follow the naming convention ALG<ViewName> for configuration and AL<ViewName> for runtime data. The runtime table columns include MsgNr, State, TimeComing, TimeGoing, TimeAcknowledgement, Ms, MsgText, MsgClass, Counter, and UserName.
7.1 SQL Query Skeleton
SELECT
MsgNr,
State,
TimeComing,
TimeGoing,
TimeAcknowledgement,
Ms,
MsgText,
MsgClassSymbol,
UserName
FROM
ALGVAlarmLog_1
WHERE
TimeComing BETWEEN '2024-01-01 00:00:00.000' AND '2024-01-31 23:59:59.999'
ORDER BY
TimeComing ASC;
7.2 References for OLE DB Export
- Exporting Archive Data with the Aid of the SIMATIC WinCC/Connectivity Pack (OLE DB Provider)
- Export of WinCC/CAS archive data with a separate application
8. Industrial Data Bridge
The Industrial Data Bridge (IDB) is a separate WinCC option that provides source-to-destination data pipelines, with transformations, for archive and message data. IDB supports destinations including SQL Server, Oracle, ODBC, CSV, and OPC UA.
Reference: SIMATIC WinCC/IndustrialDataBridge V7.3 Released for Delivery.
8.1 Typical Pipeline
- Source: WinCC archive via OLE DB or WinCC archive XML.
- Transform: map
ALGVAlarmLog_1columns to destination schema; convert UTC/local timestamps; apply text replacements. - Destination: SQL Server historian (e.g., OSIsoft PI, Wonderware Historian, AVEVA) or flat-file CSV on network share.
8.2 When to Use IDB
- Long-term retention beyond the runtime backup window.
- Multi-server aggregation across several WinCC stations.
- Forwarding to an MES or cloud endpoint that requires periodic delta updates.
9. PM-OPEN EXPORT Premium Add-On
PM-OPEN EXPORT is a premium third-party add-on (distributed through the SIMATIC WinCC Premium Add-ons program) that exports process values (archive and online values), messages, and User Archive data into ASCII files such as CSV. It runs as a WinCC add-in and supports scheduled exports with file rotation.
Reference: Where can you find information about the WinCC Premium Add-ons?
9.1 Comparison with Native Mechanisms
| Feature | OCX Export | ODK API | OLE DB / Connectivity Pack | PM-OPEN EXPORT |
|---|---|---|---|---|
| Online query (no export) | No | Yes | Yes | No |
| Scheduled CSV | Via script | Via external task | Via external task | Built-in |
| User Archive support | No | Yes | Yes | Yes |
| Filter on alarm class | OCX filter | SQL WHERE | SQL WHERE | Built-in UI |
| License cost | Included | Included | Connectivity Pack license | Premium add-on |
| Suitable for >10 stations | Limited | Per-station | Yes (central DB) | Yes |
10. Simulation vs Runtime Mode Caveat
A common commissioning trap is that WinCC Runtime Professional simulation mode does not persist closed archive segments to the backup path. The Alarm Control OCX shows historical data within the simulated session because segments are held in memory, but after the simulator closes, all segments are discarded.
Resolution: Confirm the project is started as WinCC Runtime, not Start with simulation. In TIA Portal, right-click the HMI device and select Start > Start runtime (not Start > Start simulation). Verify that the WinCC RT service (TMA) is running on the target and that the configured backup path exists and is writable by the runtime service account.
To distinguish the two states at runtime, read the tag @ServerState or query the WinCC service via sc query "CCArchiveMgr"; the RUNNING state indicates a real runtime, while simulation launches CCSimRT.exe as a child process.
11. Restoring Backup Segments
Closed segments in the backup path are detached SQL Server databases. To restore:
- Open SQL Server Management Studio on a SQL Server instance matching the original runtime version.
- Right-click Databases > Attach.
- Browse to
<BackupPath>\AlarmLog_1\<YYYY-MM-DD>_<HH-MM-SS>_R<NNNN>.mdf. - Confirm the transaction log path resolves, then click OK.
- Query the attached database using the same column layout as live runtime.
12. Verification Checklist After Commissioning
| Check | Method | Pass Criteria |
|---|---|---|
| Alarm log exists | Project tree > Alarm logs | AlarmLog_1 present, all desired classes selected |
| Runtime backup enabled | Runtime Settings > Services | Activate backup = true, path reachable from service account |
| Service account write access | Test-create a file in backup path as the service user | File created |
| First closed segment written | Trigger N alarms > wait for segment close > check path | *.mdf and *.ldf present with timestamp |
| Manual OCX export | Click export button | CSV opens in Excel with correct columns |
| Scheduled script export | Wait one scheduler period | CSV file appears at scheduled path |
| OLE DB query | SSMS > linked server query | Rows returned |
| Reboot persistence | Stop runtime > restart > check Alarm Control history | Historical alarms visible across restart |
| Simulation mode NOT used | Task Manager > check process | WinCCRT.exe present, CCSimRT.exe absent |
13. Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Remediation |
|---|---|---|---|
| Alarm history lost on reboot | Running in simulation mode | Check process list for CCSimRT.exe | Start real runtime via WinCC RT Service |
| Backup path empty | Backup not activated; path not writable | Runtime Settings > Services > check path; check NTFS permissions | Enable backup, grant Modify rights to CCAdmin/CCOperator groups |
| OLE DB query fails with "catalog not found" | Wrong catalog name in connection string | Query SELECT * FROM MDArchiveCatalog
|
Use exact catalog from the runtime folder name |
| OCX export button disabled | Operator authorization insufficient | User Administration > check "Export" right | Grant "Alarm control: Export" authorization |
| ODK export returns DM_ARCHIVE_ERR | Archive not yet created; service not running | Check WinCC Alarm Logging service state | Start AlarmLogging service or wait for first alarm |
| Scheduled script does not run | Global action disabled | Project tree > Common data > Scheduler > action enabled | Enable the action; check trigger condition |
| Backup segments accumulate indefinitely | Retention not configured | Runtime Settings > Archive backup | Set retention days or external cleanup script |
| CSV file locked on next export | Excel or external process holding file | Check open file handles (handle.exe) | Close consumer before next export or use unique filenames |
14. Frequently Asked Questions
Why does WinCC Professional not expose a simple "Alarm Log backup" toggle like WinCC Advanced?
WinCC Professional uses a SQL-backed archive infrastructure shared with tag logging, so backup is configured globally under Runtime Settings > Services > Archive backup rather than on each individual log object. This allows per-segment rotation and central backup management across all logs in the project.
How do I verify that alarm data will survive a WinCC runtime reboot?
Trigger a sufficient number of alarms to close one segment (default 1 MB), confirm a *.mdf file appears in the backup path, restart the WinCC RT service, and open the Alarm Control. If historical alarms from before the restart are visible, the backup is functioning correctly.
Can I export alarm data automatically every 30 minutes to CSV?
Yes. Implement a global VBScript action bound to a WinCC Scheduler task with a 30-minute cycle, call AlarmControl.Export on the embedded Alarm Control, and write to a timestamped CSV path. Confirm the script runs and the file is written before relying on it in production.
What software opens the SQL backup files generated by WinCC?
The closed alarm-log segments are SQL Server databases and can be opened with SQL Server Management Studio (attach), Visual Studio (Server Explorer), or any SQL Server-compatible client. Attach the *.mdf file and query the ALGVAlarmLog_1 view for historical alarm data.
Is there a native method to query live alarms without exporting?
Yes. The WinCC Connectivity Pack provides an OLE DB Provider that exposes live alarm tables over WinCCOLEDBProvider.1. Any OLE DB consumer (SSMS, Power BI, custom .NET, Python via pyodbc) can run SQL against the catalog CC_<ProjectName>_<HH-MM-SS> and read the ALGVAlarmLog_1 view in real time without producing a CSV file.