WinCC Tag Archive: Restoring Trend Data After Project Migration
Problem Overview
When a WinCC project is duplicated to another engineering station or migrated to a new TIA Portal configuration, operators frequently observe that Tag Logging trends return zero values for ranges that were correctly recorded in the source project. The runtime database is present, segments exist on disk, yet WinCC Picture/Trends controls render flat zero lines or NaN markers where valid process values once existed.
This symptom is distinct from a complete loss of trend data. If the entire archive database were missing or detached, all values would be unavailable; if every value read zero uniformly, the issue is usually a tag connection problem. The case discussed here is intermittent: some points within a trend range return valid historical values, while others are reported as zero or absent.
Root Cause Analysis
WinCC Tag Logging persists process values in a Microsoft SQL Server database (typically CC_<ProjectName>_<RuntimeStartTime>.mdf) split into time-bounded segments. Each archive tag is referenced by an internal numeric ID that is assigned at the time the tag is created in the Tag Logging editor. The runtime does not match archive rows to tags by the symbolic WinCC tag name visible in the editor; it matches by this ArchiveTag ID.
| Field | Description |
|---|---|
| Symbolic name | User-defined identifier shown in the Tag Logging editor |
| ArchiveTag ID | Auto-assigned numeric key persisted in dbo.Archive and the segment tables |
| Storage location | SQL Server MDF/LDF files inside the project's archive directory |
| Match key used by runtime | ArchiveTag ID, not symbolic name |
Three conditions break the ID binding and surface as zero data:
- ArchiveTag deleted and re-created in the configuration. The newly assigned ID does not match any historical row, so the trend curve renders as zero for the entire pre-recreation window.
- Tag Logging configuration imported via TIA Portal master data where the import wizard regenerates IDs even though the symbolic name is preserved.
- Backup segments copied to the new project without re-registration. The MDF/LDF files contain rows keyed by the original IDs; until the SQL Server attaches and the WinCC Archive Manager indexes the segments, queries against the new configuration return no rows for the affected ID range.
dbo.Archive table or use the WinCC OLE DB Provider with SELECT * FROM dbo.Archive. Cross-reference the numeric ID against the segment's primary key column.Prerequisites
Before attempting any restore procedure, verify the following on both source and destination stations:
- WinCC Runtime version matches the configuration version (e.g., V16, V17, V18, V20). Mismatched SQL Server schemas prevent segment attachment.
- SQL Server service account has read/write access to
<ProjectFolder>\CommonArchivingon the destination station. - The destination project is in Configured state (not running) when copying archive backup files; if Runtime is active, only the procedures that use the segment hot-plug workflow are valid.
- The archive configuration in the new project includes the same archive tags (by symbolic name) with the same acquisition cycle and storage cycle.
- SQL Server Management Studio (SSMS) is available on the destination station for verification queries.
Solution Procedure A — Restore Backup Segments via CommonArchiving
This procedure applies when you have a backup of the source archive database (MDF and LDF files) and want to graft the historical segments onto the new project without overwriting the current configuration.
Step 1 — Stop the WinCC Runtime
- Open the WinCC Runtime on the destination station.
- Select File > Stop Runtime, or stop the
CCArchiveConnMonandWinCC Runtimeservices from Windows Services. - Confirm no
sqldata.exeinstances are attached to the archive database.
Step 2 — Locate the CommonArchiving Directory
The default path is:
C:\Program Files (x86)\Siemens\Automation\WinCC\WinCCProjects\<ProjectName>\CommonArchiving\
Each segment is stored as a pair of files: CC_<ProjectName>_<YYYYMMDD>_<HHMMSS>.mdf and the corresponding .ldf log file. Confirm the destination folder exists and is empty for the target time range.
Step 3 — Copy Source Segments
Copy the MDF and LDF files from the source backup into the destination CommonArchiving directory. Preserve the original file names — the timestamp embedded in the filename is used by the Archive Manager to place the segment in the correct time window.
Step 4 — Start the WinCC Runtime
When WinCC Runtime starts, the SQL Server attaches the new MDF/LDF segments and the Archive Manager indexes them automatically. This registration takes 10-60 seconds per segment depending on size and disk I/O.
Step 5 — Trigger Hot-Plug (Runtime Already Running)
If Runtime is already running, segments dropped into CommonArchiving are registered without restart. The runtime polls the directory and activates any segment whose timestamp falls within a missing range:
- Verify the runtime service is running.
- Copy the MDF/LDF pair into
CommonArchiving. - Wait 30-60 seconds and monitor the Windows Event Log under Application > Source: WinCC ArchiveManager for an info-level event indicating the segment has been activated.
- Refresh the trend view; historical values for the registered window should now appear.
Solution Procedure B — Use the WinCC Archive Connector
The WinCC Archive Connector is the canonical tool for mapping a WinCC configuration to an external archive database. It is part of the WinCC DataMonitor option and is also available in TIA Portal WinCC Professional / RT Professional for archive coupling scenarios.
The connector takes the configuration side (which symbolic tags the trend will request) and the database side (where the historical rows actually live) and builds the matching map. If the destination database has been restored from backup but the project has been recreated, the Archive Connector is the recommended reconciliation path because it re-establishes the ID-to-symbol mapping without requiring manual SQL edits.
Reference: WinCC Archive Connector (RT Professional) — TIA Portal V20 documentation.
Connector Workflow
- Launch the Archive Connector from Start > Siemens Automation > WinCC > Archive Connector, or from the TIA Portal project tree under Runtime settings > Archive.
- Select the destination database file (
.mdf). - Select the destination configuration (the new project).
- Click Connect. The connector enumerates the symbolic archive tags in the destination configuration and attempts to match them to ArchiveTag IDs in the database.
- For tags that fail to auto-match, manually map the symbolic name to the ID from the source database (visible via an OLE DB Provider query).
- Save the mapping and restart Runtime.
| Criterion | CommonArchiving Copy | Archive Connector |
|---|---|---|
| Use case | Restoring segments from backup | Re-mapping IDs after configuration change |
| Runtime downtime | None (hot-plug supported) | Brief restart required |
| ID mismatch recovery | Manual via SQL | Automatic via mapping UI |
| License requirement | None | DataMonitor / RT Professional option |
| Applies to | WinCC V7.x, TIA WinCC RT | TIA WinCC RT Professional primarily |
Solution Procedure C — Export / Import via WinCC OLE DB Provider
For partial range recovery or migration to a different WinCC version, the WinCC OLE DB Provider exports archive rows into CSV and re-imports them into the destination archive. This approach is documented in the Connectivity Pack application example.
Reference: Export of archive data using the SIMATIC WinCC Connectivity Pack (OLE DB Provider).
Export from Source
' VBA / VBScript snippet — WinCC Connectivity Pack OLE DB
Set conn = CreateObject("ADODB.Connection")
conn.Provider = "WinCCOLEDBProvider.1"
conn.Properties("Data Source") = ".\WinCC"
conn.Properties("Catalog") = "CC_OpenArch_2024_01_15_15_30_22"
conn.Open
' Query one archive tag for a fixed range
sql = "SELECT TIMESTAMP, REALVAL FROM dbo.Archive WHERE ID = 12345 " & _
"AND TIMESTAMP BETWEEN '2024-01-01 00:00:00' AND '2024-01-31 23:59:59'"
Set rs = conn.Execute(sql)
Import into Destination
The Connectivity Pack includes a sample importer that writes the exported rows into the destination archive using the WinCC Archive Writer API. The importer rewrites the ArchiveTag ID to match the destination configuration.
WinCC Unified and Industrial Edge Considerations
WinCC Unified stores tag logging archives in a different schema than WinCC V7 / TIA WinCC RT Professional. On Industrial Edge, the Export Data feature creates ZIP archives containing the historical segments for download and re-deployment to another Edge device.
Reference: Managing Exported Data Archive — SIMATIC WinCC Unified Runtime on Industrial Edge.
| Aspect | WinCC V7 / RT | WinCC Unified |
|---|---|---|
| Database engine | Microsoft SQL Server (MDF/LDF) | Unified backend, accessed via REST API |
| Segment file naming | CC_<Project>_<Timestamp>.mdf | Internal segment tables, Export as ZIP |
| Hot-plug restore | Drop into CommonArchiving | Use Export Data import wizard |
| External access | OLE DB Provider | REST API, OpenTelemetry |
When migrating from WinCC V7 to Unified, the archive ID schema is not portable. Use the V7 OLE DB Provider to export, then the Unified import wizard or scripted REST API calls to write rows into the Unified database with the new IDs.
Runtime Continuity During Configuration Changes
One of the most common triggers of the zero-data symptom is editing Tag Logging on the configuration PC while Runtime continues to acquire on the operator station. The official Siemens FAQ documents the supported workflow for keeping runtime archiving online while the configuration is updated:
Reference: Siemens Support FAQ 24193864 — Configuration changes during runtime archiving.
Key constraints from the FAQ:
- Always export the Tag Logging configuration to a transfer file (
.tsc) and re-import rather than recreating tags. - Never delete an archive tag and create a new one with the same name — IDs change silently.
- If tags must be deleted, first export the historical rows via OLE DB to preserve the data.
- Use the Archive Configuration tool to compare ID sets between source and destination before any migration.
Verification Procedure
After applying any restore procedure, verify that the trend view returns non-zero historical values:
- Open the WinCC Picture that contains the affected trend control.
- Set the time range to the window covered by the restored segment.
- Confirm values render and match the source project.
- Cross-check via OLE DB Provider:
SELECT COUNT(*) FROM dbo.Archive WHERE ID = <ArchiveTagID> AND TIMESTAMP BETWEEN '...' AND '...'— row count must be > 0 and equal to source. - Inspect Windows Event Log under Application > WinCC ArchiveManager for segment activation events (info-level, no errors).
- Trigger a manual swap of archive segments (Tag Logging > Connect Backup) and confirm Runtime picks up the new range without restart.
| Check | Expected | Tool |
|---|---|---|
| Trend shows non-zero values | Yes, matching source | WinCC Picture / Trends control |
| Row count in archive table | Equal to source | SSMS, OLE DB Provider |
| Event log entries | "Segment activated" info events | Windows Event Viewer |
| Hot-plug test | New segment detected without restart | Manual file drop test |
| Acquisition continues after restore | New rows appended | Live value in trend |
Troubleshooting Matrix
| Symptom | Likely cause | Action |
|---|---|---|
| All values zero for entire history | ArchiveTag ID mismatch | Use Archive Connector to remap IDs |
| Values zero only in restored segment range | Segment not yet attached to SQL | Wait 60s, check Event Log; verify MDF/LDF pair present |
| Values zero only at specific timestamps | Compression/deadband filtering | Verify acquisition and storage cycle in Tag Logging editor |
| Trend returns "No data" | Database detached or wrong catalog | Check SQL Server, confirm CC_*.mdf is attached |
| Slow archive missing entirely | Long-term archive path misconfigured | Verify slow archive path in Tag Logging settings |
| Values zero after TIA Portal re-download | Master data import regenerated IDs | Restore segment backups via CommonArchiving or Archive Connector |
| Archive stops acquiring after restore | SQL Server transaction log full | Shrink LDF, verify disk space, restart SQL service |
Safety and Operational Considerations
- Take a backup of the destination
CommonArchivingfolder before any restore operation. - Verify the destination SQL Server has sufficient disk space — a restored segment may be considerably larger than its compressed archive representation depending on acquisition frequency.
- Do not detach or delete segments while Runtime is acquiring; always stop Runtime or use the Archive Manager Swap Active function.
- For GMP-regulated environments, validate that the restored trend range is reproducible from source before approving the migration in production.
FAQ
Why does my WinCC trend show zero values after copying an old archive into a new project?
The runtime resolves archive rows by ArchiveTag ID, not by the symbolic tag name visible in the editor. If the destination project's configuration regenerated IDs — even when the symbolic name is identical — every historical row keyed by the old ID will not match the new ID and will return zero. Use the WinCC Archive Connector or the OLE DB Provider to remap IDs before restoring.
Can I drop WinCC archive MDF and LDF files into another project's CommonArchiving folder while Runtime is running?
Yes. The WinCC Archive Manager monitors <Project>\CommonArchiving and hot-plugs new segments whose timestamp fills a missing range. Allow 30-60 seconds per segment for SQL Server attachment and indexing, then monitor Event Log for the segment-activated entry before refreshing the trend.
Which WinCC versions support the WinCC Archive Connector?
The Archive Connector is available with TIA Portal WinCC RT Professional (V16 and later) and is bundled with the WinCC DataMonitor option for V7.x. Confirm your installation includes the option; a license-only install without the option binary will report the tool as missing.
Does renaming the archive MDF file break registration?
Yes. The segment filename embeds the timestamp that the Archive Manager uses to position the segment in the time axis. Renaming breaks registration and the segment is silently ignored. Always preserve the original CC_<Project>_<YYYYMMDD>_<HHMMSS>.mdf name when copying from backup.
Is the WinCC V7 archive database compatible with WinCC Unified?
No. WinCC V7 uses Microsoft SQL Server (MDF/LDF) and WinCC Unified on Industrial Edge uses the Export Data feature to package historical segments into ZIP archives for transfer. Use the V7 OLE DB Provider to export rows to CSV, then import via the Unified Import wizard. ArchiveTag IDs must be remapped during the import.