Problem Overview
Symptom: After an uncontrolled server shutdown caused by a main power cut, a WinCC v7.3 SP3 Update 7 (2-server / 2-client, non-redundant) project reports missing trend data and lost taglogging/alarmlogging archives from the period spanning the restart window. The *.mdf and *.ldf files exist on disk but WinCC Trend control, OnlineTableControl, and Alarm Control return empty time ranges or "no data available" messages for the affected segment window.
This failure mode is most commonly observed in plants where:
- Multiple WinCC project copies (e.g.,
Project1andProject2) exist on the same machine with an autostart shortcut pointed at only one of them. - The UPS (uninterruptible power supply) is undersized for the runtime load, runs flat before operators intervene, and the servers hard-power-off.
- Archive backup is disabled in Taglogging and Alarmlogging editor configuration.
- SQL Server 2008 R2 / 2014 (the default instance bundled with WinCC v7.3) marks the databases as
SUSPECTafter abrupt shutdown, and the WinCC ArchiveManager cannot attach them at runtime startup.
Affected versions: Siemens WinCC V7.3, V7.3 SP1, V7.3 SP2, V7.3 SP3 with Update 7 installed. The same recovery flow applies to V7.4 and V7.5 with minor folder-name changes.
WinCC v7.3 Archive Database Architecture
Before restoring archives you must understand the file layout WinCC writes to disk. A runtime project stored at C:\Siemens\WinCC\Project1 contains:
| Folder / File | Purpose | Recovery Relevance |
|---|---|---|
ArchiveManager\<Project>Tlg.mdf |
Taglogging primary database (SQL Server) | Holds raw process values, compressed values, and long-term segments |
ArchiveManager\<Project>Tlg.ldf |
SQL Server transaction log for taglogging | Required for SQL attach; may be corrupted after power loss |
ArchiveManager\<Project>Alg.mdf / .ldf |
Alarmlogging primary + log database | Stores active and historical alarms/events |
ArchiveManager\*.dc* |
Compressed segment swap files | Created when a configured segment is closed and exchanged; safe to delete to force rebuild |
ArchiveManager\Backup\* |
Configured backup destination (Taglogging + Alarmlogging backup) | Primary recovery source if activated before the incident |
CommonArchiving\* |
Central archive directory for multi-segment or external coupling | Target folder where .mdf / .ldf are dropped at runtime for automatic attach |
<Project>.mcp |
Compiled WinCC project file | References all DB files; recreating server package refreshes links |
*.mdf / *.ldf files while WinCC Runtime is active. Always stop Runtime, close WinCC Explorer, perform the file operation, then restart the project.Root Cause Analysis for Lost Archives
Five root causes have been observed in field deployments running WinCC v7.3 Update 7:
-
SQL Server SUSPECT state after power loss – When the OS loses power mid-transaction, the SQL Server database engine cannot complete the recovery phase. The database is marked
SUSPECTinsys.databases, WinCC ArchiveManager cannot attach it, and the runtime window displays no trend data even though the file exists on disk. -
Wrong project autostart – Operators or commissioning engineers duplicate the project folder to create a sandbox (e.g.,
Project2) but leave the Windows Startup shortcut or WinCC autostart list pointing at the wrong project. After the restart, the live archive database belongs toProject2;Project1displays a gap. -
Archive backup not configured – Taglogging Editor and Alarmlogging Editor both offer a "Backup" tab with destination path and schedule. If left blank, only the live
*.mdf/*.ldfis written; no redundant copy exists to recover from. - UPS runtime exhausted – A typical server-grade UPS sized for 15 minutes of load cannot bridge a multi-hour outage. Once batteries deplete, the server hard-powers-off, skipping the Windows shutdown sequence and any controlled WinCC stop.
- Server package mismatch – After project edits the server package on the client must be regenerated. If the client holds a stale package, trend requests are routed to segment indices that no longer exist on the server, producing empty trend windows for valid time ranges.
Recovery Procedure A – Reattach SQL Database from Backup Folder
When the Taglogging and Alarmlogging Backup tab is configured (recommended baseline), perform the following controlled restore. This procedure recovers archives without disturbing the running project.
Prerequisites
- Local Administrator rights on the WinCC server.
- SQL Server Management Studio (SSMS) version matching the WinCC-bundled instance (2008 R2 for WinCC v7.3 baseline, 2014 for V7.4+).
- Runtime may remain active if you are copying files into
CommonArchiving; otherwise stop Runtime first.
Step-by-Step
- Stop WinCC Runtime on the server. Close WinCC Explorer.
- Open SSMS, connect to the WinCC instance (named instance
WinCCby default). - Detach the corrupted database by right-clicking
<Project>Tlgin Object Explorer and selecting Tasks → Detach. Tick "Drop Connections" and "Update Statistics". - Navigate to the configured backup folder (default
ArchiveManager\Backup). Identify the*.mdfand*.ldfpair whose timestamp matches the gap window. - Copy the backup pair into the live
ArchiveManagerfolder ofProject1. Do not copy intoCommonArchivingfor the primary database – the live folder is the correct location for the runtime attach. - Re-attach the database in SSMS: Tasks → Attach → Add → select the restored
.mdf. Confirm the.ldfpath matches. Click OK. - Restart WinCC Runtime. Verify the trend window using WinCC OnlineTrendControl or the Taglogging editor's "Display" button.
.ldf file is missing or corrupted, SSMS will offer to create a new transaction log. Accept only if the .mdf was cleanly detached; otherwise data loss will occur.Recovery Procedure B – Copy Segment Files into CommonArchiving
Used when the segment files exist on a peer server or duplicate project (e.g., Project2 on the same machine that was running during the outage). This is the documented Siemens approach for multi-segment runtime and external database coupling.
- Verify both projects have identical configuration (same tag IDs, archive configuration, and segment sizes).
- On the source project, locate the closed segment files (
*.mdf/*.ldf) inside theArchiveManagerroot. Do not descend into subfolders. - Copy these files into the destination project's
CommonArchivingfolder while the destination WinCC Runtime is active. - The ArchiveManager service detects the new files and automatically attaches them as additional segments. Trend windows across both segments return continuous data.
- Clean up the copied files manually when the retention period expires; segments placed in
CommonArchivingare not auto-deleted by the configured swap-out job.
Recovery Procedure C – Recreate Server Package and Rebuild Taglogging DB
Used when the database is so corrupted that SQL Server cannot attach it, or when the runtime reports "connection to server lost" in WinCC Control diagnostics. This procedure rebuilds the database files from scratch and relies on the backup folder for historical data.
- On the server, open WinCC Explorer and stop the WinCC Server service.
- Close WinCC Explorer on every client in the project. Wait for the WinCC Server service to reach "stopped" state.
- Create a full project backup by copying the entire
Project1folder toProject1_BAK_<date>. - Delete or rename the following files inside the live project folder:
<Project1>Tlg.mdf<Project1>Tlg.ldf- All files matching
*.dc*inArchiveManagersubfolders
- Open WinCC Explorer. Open the Server Data dialog and delete the existing server package for each client.
- Regenerate the server package: right-click the server in the project tree, select "Server Data" → "Generate Server Package" for each client. Distribute the new package to the client machines via "Remote Desktop" or manually copy the resulting
<Project>*.pckfile. - Restart WinCC Runtime. The ArchiveManager creates fresh empty
*.mdf/*.ldffiles. Trend windows report empty for the rebuild window only. - Reapply Procedure A to merge any available backup segments back into the freshly created database.
Verification Checklist
Confirm recovery by running the following checks from the WinCC project tree before signing off the incident:
| Check | Method | Pass Criteria |
|---|---|---|
| Archive segments attached | Taglogging editor → "Display" button | Segment list shows gap-window entries with start/end timestamps matching the incident period |
| SQL DB state | SSMS → SELECT state_desc FROM sys.databases WHERE name='<Project>Tlg'
|
Returns ONLINE, not SUSPECT or RECOVERING
|
| Trend continuity | OnlineTrendControl with timeline set to the outage window ±2 hours | Continuous line plot with no white gaps before, during, and after the power cut |
| Alarm continuity | AlarmControl with filter "from = outage start - 1 h, to = outage end + 1 h" | Alarm list shows pre-outage and post-outage entries without a time gap |
| Client package sync | On client: WinCC Explorer → "Server Data" dialog | Package timestamp matches server; "Status" column reports "OK" |
| WinCC Control diagnostics | Start → All Programs → Siemens Automation → WinCC → Tools → WinCC Control | No red entries, no "Archive connection lost" messages, no "Database SUSPECT" messages |
Prevention Strategy
Apply the following layered controls to eliminate recurrence.
- UPS sizing – Size the UPS for at least 30 minutes at full server load (CPU + disk spin-up + monitor). Configure the bundled network shutdown agent to send a graceful Windows shutdown to each WinCC server when battery falls below 25%. Test the shutdown path quarterly by simulating mains loss.
- Enable Archive Backup in both editors – Taglogging Editor → select archive → "Backup" tab. Set "Activate Backup" = yes, configure a destination path on a separate physical disk (not the same RAID volume as the live database), set schedule to daily at 02:00. Repeat for Alarmlogging Editor.
-
Stop Runtime cleanly during maintenance – Always use WinCC Explorer → "Stop Runtime" rather than logging off Windows or pressing the power button. Configure a Windows scheduled task that runs
net stop "WinCC_Server"before any planned reboot. -
Single project per machine – Do not duplicate the
<Project>folder on the same machine. Use the WinCC Project Duplicator tool (orCCProjectMigrator.exe) for offline editing. Maintain only one active project per server with one autostart entry. -
SQL Server health monitoring – Add a daily SQL Agent job that runs
DBCC CHECKDB('<Project>Tlg') WITH NO_INFOMSGSand emails the operator on any reported corruption. Schedule outside production hours. -
Disk redundancy – Place the live
ArchiveManagerfolder on a RAID-1 or RAID-10 volume separate from the OS volume. Place the Backup folder on a separate physical disk or NAS share. - External archive access – For long-term analytics, configure the WinCC Archive Connector (part of DataMonitor) to expose archives through OLE DB to a reporting database. This provides an offline copy independent of WinCC runtime state. Refer to the official documentation: WinCC Archive Connector (RT Professional).
Diagnostic Flowchart
Field-Proven Pitfalls
- Detaching the live DB while Runtime is running produces "Archive connection lost" events for every connected client and may corrupt further segments. Always stop Runtime first.
-
Copying segments into the live
ArchiveManagerroot while subfolders are open causes the ArchiveManager to skip the file until the next service restart. Copy while Runtime is stopped or intoCommonArchivingwhile Runtime is running. - Mismatched segment sizes between two project copies produce silent rejection. Always verify the Taglogging editor → Archive Configuration → Segment size matches before performing a CommonArchiving copy.
- UPS without network shutdown agent – the batteries hold the server alive, but Windows never receives the shutdown command. When the batteries die, the OS crashes the same as an unprotected server.
-
Deleting
*.dc*files from a healthy database – these are compressed swap segments; deleting them removes compressed historical data that is not held in the main.mdf. Only delete when the goal is to rebuild the database from scratch (Procedure C). -
Network share for live archive – placing
ArchiveManageron an SMB share introduces latency spikes that confuse the SQL Server recovery process after power-up. Always keep the live database on local direct-attached storage.
Standards and Reference Documentation
When planning recovery and prevention, cross-reference the following official Siemens documents:
- WinCC V7.3 SP3 Manual – "Working with Archives" section, covering Taglogging, Alarmlogging, and the ArchiveManager service.
- WinCC Information System help file
WinCC_Information_System.chm– search keyword "CommonArchiving" for the segment reattach procedure. - WinCC V7.3 Release Notes Update 7 – fixed bugs affecting archive attach after uncontrolled shutdown.
- Siemens Support Entry ID 109751706 – "What to do after a power failure with WinCC Runtime" (operator guide).
- WinCC DataMonitor Configuration Manual – Archive Connector configuration for OLE DB access: WinCC Archive Connector (RT Professional).
- SQL Server 2008 R2 / 2014 Books Online – "DBCC CHECKDB", "Database States", and "Attaching and Detaching Databases".
FAQ
Why does WinCC v7.3 lose archive data after a power cut even though the .mdf files are still on disk?
The SQL Server instance bundled with WinCC v7.3 marks the database as SUSPECT when it cannot complete crash recovery after an uncontrolled shutdown. WinCC ArchiveManager will not attach a SUSPECT database, so the runtime displays empty trend windows for the affected period. The fix is to attach the database manually via SQL Server Management Studio, or to restore the matching backup segment from the configured Backup folder.
Can I copy taglogging segments from a duplicate WinCC project back into the production project?
Yes, provided the projects share identical archive configuration, tag IDs, and segment sizes. Copy the closed segment .mdf and .ldf files (without subfolders) from the duplicate project's ArchiveManager into the production project's CommonArchiving folder while Runtime is active. The ArchiveManager auto-attaches the segments; clean them up manually because CommonArchiving files are not auto-deleted.
How long should a WinCC server UPS be sized for?
At minimum 30 minutes at full load to allow an operator to acknowledge alarms and initiate a controlled shutdown, ideally 60 minutes for unmanned night shifts. Configure the UPS network shutdown agent to send a graceful Windows shutdown when battery drops below 25 percent. Test the shutdown sequence quarterly.
What files should I delete to force WinCC to rebuild the corrupted taglogging database?
Stop Runtime and close WinCC Explorer on the server and all clients. Delete or rename the project taglogging database files <Project>Tlg.mdf, <Project>Tlg.ldf, and all *.dc* files in ArchiveManager subfolders. Restart WinCC Explorer, delete and regenerate every server package, then start Runtime. The ArchiveManager creates fresh empty files. Reapply backup segments afterward.
Where do I configure automatic archive backup in WinCC v7.3?
Open the WinCC Explorer on the server, expand Taglogging, select each archive, and open the Backup tab. Tick Activate Backup, specify a destination path on a separate physical disk, and set a schedule. Repeat for Alarmlogging. Without this step, only the live .mdf/.ldf pair exists and there is no second copy to recover from after a hard shutdown.