Problem Details: Trends Stop Working After Moving the Project Folder
After relocating a SIMATIC WinCC V6.2 SP3 HMI project from one directory to another on the same PC, process value trends driven by TagLoggingFast, TagLoggingSlow, and TagLoggingAlarm archives stop updating. The runtime starts without raising a fatal error, but the trend controls display no curves and the online trend archive contains no values. When the operator opens Archive Configuration, right-clicks the archive node, and attempts to Link Database…, every candidate .mdf/.ldf file in the local root of the application is rejected with the message that communication to the database cannot be established.
Even when the most recent database file in the Archive Manager folder is selected manually, WinCC reports that the database is already in use while still failing to render trend data. The same behavior repeats for all three logging archives:
-
TagLoggingFast– high-speed process value archive (default cycle 500 ms / 1 s / 5 s / 10 s, configurable) -
TagLoggingSlow– long-term archive (default cycle 1 min / 1 h / 1 day, configurable) -
TagLoggingAlarm– alarm logging archive (messages and acknowledgements)
This symptom is specific to the Service Pack 3 for WinCC V6.2 including Options release line and is reproducible after any project folder relocation, project copy, or PC rename. It also appears after restoring a project from backup on the same machine.
Root Cause: Orphaned Database Paths and Runtime Lock on .mdf/.ldf
WinCC V6.2 SP3 stores its archive back-end as Microsoft SQL Server 2005 Express databases. Three logical databases exist per project:
| Logical Archive | Database File (default) | Log File (default) | Purpose |
|---|---|---|---|
| TagLoggingFast | CC_TlgFast_<ProjectName>_<PC>.mdf |
CC_TlgFast_<ProjectName>_<PC>_log.ldf |
High-speed process values |
| TagLoggingSlow | CC_TlgSlow_<ProjectName>_<PC>.mdf |
CC_TlgSlow_<ProjectName>_<PC>_log.ldf |
Long-term process values |
| TagLoggingAlarm | CC_Alg_<ProjectName>_<PC>.mdf |
CC_Alg_<ProjectName>_<PC>_log.ldf |
Alarm & event messages |
The <PC> token is the host name of the computer on which WinCC Runtime was first activated. When you copy a project to a new folder – or to a different PC name – the database file name still embeds the old host name. WinCC looks for the database at the absolute path recorded in the project database. Because the relocated project still references the original path, WinCC cannot establish a connection and rejects every candidate file offered through the dialog.
The second failure mode – "database already in use" – is caused by the WinCC Archive Manager holding a SQL Server exclusive lock on the orphan .mdf file via the still-running CCArchiving.exe process. Until the runtime is stopped, the SQL instance cannot re-attach the moved database, and the Archive Manager refuses the link request.
The third failure mode – copy "succeeded but trends empty" – is caused by file timestamps: copying newer files into an existing Common Archives directory where older files of the same logical name already exist causes WinCC to attach the old file (which is still referenced by the project metadata) and ignore the new copy. The Copy Archive tool therefore must be executed while the new project runtime is stopped, or it must write to an empty target directory.
Preconditions Before Repair
Perform the following checks before attempting any file operations:
- Confirm the installed WinCC build is V6.2 SP3 by opening WinCC Information > Installed Software and cross-checking the build number against the Delivery Release: SIMATIC WinCC V6.2 SP3 note.
- Record the Windows computer name (Start > System Properties > Computer Name). The name embedded in the database filename must match the current PC name, or be renamed.
- Verify the SQL Server 2005 Express instance
WINCCis running: SQL Server Configuration Manager > SQL Server 2005 Services. Service status must be Running, Start Mode Automatic. - Verify the WinCC Archive Manager service
CCArchivingcan be stopped: Start > Settings > Control Panel > Administrative Tools > Services > SIMATIC WinCC Archive Manager. - Stop the WinCC Runtime completely (Start > SIMATIC > WinCC > Runtime Stop or taskbar context menu).
CCArchiving.exe holds the lock. Doing so will produce SQL error 5120 ("Unable to open the physical file") and may corrupt the log file.Solution: Step-by-Step Archive Re-link Procedure
Step 1 – Identify the Original Archive Storage Path
The archive database files reside in the Archive Manager subfolder of the project path. The default full path is:
C:\Program Files\Siemens\Automation\WinCC\WinCCProjects\<ProjectName>\Archive Manager\
If the project was created in a non-default location, browse to Information Manager (IM) > HMI as referenced in the engineering context, where the project path is recorded. The "IM" referred to in older Siemens documentation is the WinCC project information manager – accessible via WinCC Explorer > Project > Properties > Project Path.
Step 2 – Locate the .mdf and .ldf Files
List the contents of the Archive Manager folder. Typical entries:
CC_Alg_ProjectA_PC42.mdf
CC_Alg_ProjectA_PC42_log.ldf
CC_TlgFast_ProjectA_PC42.mdf
CC_TlgFast_ProjectA_PC42_log.ldf
CC_TlgSlow_ProjectA_PC42.mdf
CC_TlgSlow_ProjectA_PC42_log.ldf
If the folder is empty or only contains the new (empty) template files, the historical archive data has been lost; proceed to Step 4 to re-create a fresh archive. If the files are present, proceed to Step 3.
Step 3 – Copy Archives from Old Project to New Project
With the WinCC Runtime stopped:
- Open the source (old) project folder's Archive Manager directory.
- Open the destination (new) project folder's Archive Manager directory.
- For each of the three logical archives (
TagLoggingFast,TagLoggingSlow,TagLoggingAlarm): copy the.mdfand the_log.ldfas a pair. Do not mix files between archives. - Confirm the destination folder now contains the historical files with the original timestamps.
Recommended practice: copy one archive at a time, verify trends work, then proceed to the next archive. This isolates any single-archive problem and matches the working procedure used on the original project.
Step 4 – Relink the Archive Through the Archive Manager
- Start WinCC Explorer with the new project.
- Right-click Tag Logging > select Archive Configuration.
- Right-click the TagLoggingFast node > Link Database….
- In the file dialog, navigate to Archive Manager of the new project and select the matching
CC_TlgFast_*.mdffile. - Click OK. WinCC verifies the SQL header, attaches the database, and updates the project metadata.
- Repeat for TagLoggingSlow and TagLoggingAlarm.
WINCC service is running and that the user account starting WinCC has read/write permission on the target folder. NTFS read-only ACLs inherited from the source folder block the attach operation.Step 5 – Resolve PC Name Mismatch
If the source PC name (embedded in the filename) differs from the current PC name, the SQL attach fails with error 5171 (database file does not match expected GUID / name). Two remedies exist:
| Approach | Procedure | When to Use |
|---|---|---|
| Rename the PC back to the original | Windows System Properties > Computer Name > Change. Restart, relaunch WinCC. | Temporary test environment only |
| Detach and re-attach with new name | Use SQL Management Studio Express to detach the old-named DB, copy files, rename .mdf/.ldf to use the new PC name, re-attach via Archive Manager Link dialog. |
Production migrations |
Step 6 – Resolve "Database Already in Use" Lock
- Stop WinCC Runtime completely.
- Open Services (services.msc), stop SIMATIC WinCC Archive Manager if running.
- Open SQL Server Configuration Manager > SQL Server 2005 Services, restart the
WINCCinstance. - Retry the Link Database dialog.
Verification: Confirm Trends Restore
After re-linking, perform the following verification sequence before declaring the repair complete:
- Start WinCC Runtime (Start > SIMATIC > WinCC > Runtime Start or Explorer toolbar button).
- Open the trend picture on the HMI. Curves from the historical archive must render within the configured update cycle (typically 500 ms for Fast, 1 s default).
- Open WinCC Online Trend Control > right-click > Archive System…. Confirm the database connection symbol is green and the time range selector shows valid archived data.
- Trigger a process value change in the PLC (or simulate via internal tags). The new value must append to the trend in real time and persist after a controlled runtime restart.
- Open SQL Server Management Studio Express, connect to
localhost\WINCC, expand Databases. The three databases must show status Normal and the Recovery column empty. - Cross-check file timestamps in the new project's Archive Manager folder. The
.mdf/.ldffiles must reflect the runtime write time, not the source copy time.
Error Code Matrix
| Symptom / Error | Source | Likely Cause | Resolution |
|---|---|---|---|
| "Communication to this database cannot be established" | Archive Manager Link dialog | Path mismatch or SQL service stopped | Verify WINCC SQL service; check path under Archive Manager |
| "Database already in use" | Archive Manager Link dialog | CCArchiving.exe holds exclusive lock | Stop runtime and Archive Manager service, retry |
| SQL error 5120 | SQL Server | NTFS permission denied on .mdf/.ldf | Grant Modify right to the WinCC runtime user |
| SQL error 5171 | SQL Server | Filename embedded PC name does not match | Rename PC or re-attach DB through Management Studio |
| Trends render but new values do not persist after restart | Archive Manager | WinCC still writing to old path | Verify link path; re-run Link Database dialog |
| Trends render but appear flat (no historical data) | Archive Manager | Empty template .mdf attached instead of historical copy | Stop runtime, copy historical .mdf/.ldf pair, re-link |
Alternative Diagnostic: Test on a Secondary WinCC System
To isolate whether the failure is project-related or installation-related, copy the new project folder to a second PC that has a clean V6.2 SP3 install (or a freshly installed V6.2 SP3 on the same machine via a separate Windows user profile). Activate the runtime and observe the trend behavior. If trends work on the secondary system, the primary PC's SQL instance is the source of the failure – repair or reinstall the WINCC SQL Server instance. If trends still fail, the project itself is corrupted; restore from a known-good backup and re-apply the link procedure described above.
Preventive Measures
- Always perform a Project Duplicator copy (WinCC Explorer > Project > Duplicator) instead of a Windows file copy. The Duplicator updates internal path references and the database filename token to match the target PC.
- Maintain a documented PC-name convention for each HMI station so historical archives can be migrated without renaming.
- Run a scheduled SQL backup of all three archive databases weekly to
D:\WinCC_Backup\<Project>\– this protects against the "empty template attached" failure mode. - Document the SP level for every WinCC station. Service Pack 3 for WinCC V6.2 (document ID 35958594) introduces archive compatibility constraints with V6.0 / V6.2 SP2 clients in WinCC/Server scenarios.
Notes for WinCC/Server and Connectivity Pack Users
When the affected project is part of a WinCC/Server – WinCC/Client pair, the client-side trend request must be re-anchored to the server-side archive path. In the client project, open Server Data > Archives, remove the existing entries, and re-add the three archives pointing to the server's WINCC SQL instance using <ServerName>\WINCC. The Delivery Release document for V6.2 SP3 lists the optional packages released or compatible with SP3, including Connectivity Pack and Central Archive Server, both of which rely on the same SQL .mdf/.ldf file structure described above.
FAQ
Where exactly are the .mdf and .ldf files for TagLoggingFast, TagLoggingSlow, and TagLoggingAlarm located?
They reside under the project's Archive Manager folder, typically C:\Program Files\Siemens\Automation\WinCC\WinCCProjects\<ProjectName>\Archive Manager\. Each archive has its own .mdf (data) and _log.ldf (transaction log) file pair, with the PC name embedded in the filename.
Why does WinCC report "database already in use" when I try to re-link TagLoggingFast?
The WinCC Archive Manager service (CCArchiving.exe) holds an exclusive SQL Server lock on the orphan .mdf file. Stop the WinCC Runtime and stop the SIMATIC WinCC Archive Manager service before retrying the Link Database dialog.
I copied the historical .mdf and .ldf files into the new project but trends are still empty – why?
The runtime most likely re-attached the existing empty template .mdf that was created when the new project was first activated. Stop the runtime, delete the empty template files in the destination, copy the historical .mdf/.ldf pair, then re-link through the Archive Manager Link dialog.
Can I rename the .mdf file to match a new PC name?
Yes. Stop the runtime, detach the database via SQL Management Studio Express, rename both .mdf and _log.ldf to use the new PC name, then re-link through Archive Manager. Renaming only the file without updating the SQL internal name will produce SQL error 5171.
Is this archive linking procedure the same for V6.2 SP3 and earlier service packs?
The file structure (.mdf/.ldf in the project Archive Manager folder, three logical archives) is consistent across V6.0, V6.2 SP1, SP2, and SP3. Service Pack 3 (document ID 35958594) does not change the archive database layout, but it does introduce compatibility rules for WinCC/Server and Central Archive Server deployments that you should verify when migrating historical archives.