Overview
The Central Archive Server (CAS) in a Siemens PCS 7 / WinCC installation stores process values, alarms, and long-term logs in Microsoft SQL Server databases. A SQL Server Maintenance Plan is the conventional mechanism to schedule full, differential, and transaction-log backups, but the plan must be aware of which databases legitimately belong to the CAS and which are orphaned remnants from prior host renames, OS images, or project re-compilations. Backing up every database indiscriminately - including stale ones - is the single most common cause of intermittent maintenance-plan failures on a CAS host.
This reference documents the database topology of a WinCC/PCS 7 CAS, the identification procedure for live versus orphaned instances, the safe construction of a Maintenance Plan, and the verification checks that confirm a restore would be functional. All SQL Server procedures below reference the official Microsoft Learn documentation at Back up and restore of SQL Server databases.
Central Archive Server Database Topology
The CAS is a WinCC component that runs as a SQL Server instance and serves as a redundant, long-term store for runtime data. Multiple databases typically exist on a single host:
| Database | Logical role | Source |
|---|---|---|
WinCC_CC_<ProcessName>_<Timestamp> |
Runtime archive / tag logging | Created by WinCC Runtime on first start |
WinCC_Alarm_<ProcessName>_<Timestamp> |
Long-term alarm archive | Created by WinCC Alarm Logging service |
CC_ProcessValueArchive_... |
Compressed process-value archive (CAS) | Created automatically by CAS service |
Master, Model, Msdb, Tempdb
|
System databases (do NOT back up Tempdb) |
SQL Server installation media |
WinCC_CC_PROCESS_A_14_03_2022_10_15_22). Renaming the host therefore leaves the OLD database on the SQL instance while the new WinCC runtime creates a NEW database - both physically coexist until cleaned up.Identifying Required vs. Orphaned Databases
Before configuring any Maintenance Plan, enumerate the databases that are actually in use by the live WinCC/PCS 7 project.
- Open SQL Server Management Studio and connect to the CAS instance (default instance name:
WINCCorPCName\WINCC). - Expand Databases → System Databases and then Databases.
- For each
WinCC_*orCC_*database, run:SELECT name, database_id, create_date, compatibility_level, DATABASEPROPERTYEX(name, 'IsOnline') AS IsOnline, DATABASEPROPERTYEX(name, 'Updateability') AS UpdateMode FROM sys.databases WHERE name LIKE 'WinCC%' OR name LIKE 'CC%' ORDER BY create_date DESC; - Cross-reference the result against the live project path. Open the active WinCC project on the CAS and read the database identifier it expects from the project's Computer properties → Database dialog.
- Mark every database that does not match the current project or current computer name as a candidate for deletion, not backup.
Root Cause: Why "Back Up Everything" Fails
The recurring failure pattern reported by integrators is rooted in the SQL Server Maintenance Plan Wizard interpreting the inclusion list as a snapshot at run time. If a database referenced in the plan no longer exists at execution time (because it was an orphan and was removed, or because the Maintenance Plan was authored against a database that has since been dropped), sqlmaint.exe records an error and may fail the surrounding job step.
Common precursor events that introduce orphan databases:
- OS image / system download on the CAS host restores an older disk state. WinCC re-initialises and creates a fresh database; the older database remains on the SQL instance until manually removed.
-
Rename of the ES or CAS computer. WinCC embeds the computer name into the database name; renaming the host without re-projecting the database leaves the old instance behind (typically visible as
newPCname\WinCCin the WinCC Explorer even though SSMS still shows the oldWinCC_*database). - PCS 7 project compilation that adds tags, alarms, or archive segments. WinCC Runtime does not always require a new database on a compilation-only change, but significant schema changes (e.g. new archive segments, name changes) can trigger creation of an additional database alongside the existing one.
- Manual detach/attach operations by administrators unfamiliar with WinCC.
WinCC_* databases on a healthy single-project CAS should equal the number of WinCC Runtime archives you have explicitly configured (usually one for tag logging, one for alarm logging). If you see more than that, investigate before relying on backups.Building a Safe Maintenance Plan
The Maintenance Plan Wizard in SQL Server Management Studio builds a job that ultimately calls sqlmaint.exe with a switch list. To avoid the failure mode above, do not use the "All user databases" radio button. Instead, enumerate the live databases explicitly.
- In SSMS, expand Management → Maintenance Plans and choose New Maintenance Plan.
- Add a Back Up Database Task. In the dialog, select Specific databases and tick only the live
WinCC_CC_...andCC_ProcessValueArchive_...databases identified in the previous section. Leavetempdband any orphan databases unchecked. - Choose the backup type. For a CAS archive, prefer Full weekly plus Differential daily; use Transaction Log only if the recovery model is set to
FULL(verify withSELECT recovery_model_desc FROM sys.databases WHERE name = '<DB>'). - Specify the backup destination as a stable UNC path on a backup server; never on the same physical disk as the SQL data files.
- Set a retention policy (e.g. Backup set will expire after 14 days) and a verification step (Check backup integrity) - this corresponds to the
CHECKSUMoption in Microsoft's SQL Server backup documentation. - Schedule the plan. The
sqlmaint.execommand line generated by the wizard is logged in the Maintenance Plan history; export it for documentation.
Compensation for PCS 7 Project Changes
Whenever a PCS 7 project is re-compiled or downloaded to the CAS, the operator must re-audit the SQL instance before the next scheduled Maintenance Plan run. Use the following checklist:
| Project change | Expected SQL impact | Required action |
|---|---|---|
| Tag count increase / archive segment added | Possible new archive segment table in existing DB | Re-verify database list, no plan change needed |
| New process picture / new AS assigned | Occasionally a new WinCC_* database appears |
Update Maintenance Plan selection set |
| Project re-named (ES rename) | New WinCC_*_<new_name> database; old one stays |
Add new DB to plan, detach/drop old DB after verifying data |
| CAS host rename | Old and new databases coexist | Same as above |
| OS re-image of CAS | Fresh DBs created on first WinCC start; old DBs may persist if data files were retained | Audit sys.databases, prune orphans |
Removing Orphan Databases
After confirming a database is orphaned (host renames, project no longer references it, last write time older than the live archive cutoff), remove it deliberately rather than allowing it to be backed up indefinitely.
- Stop the WinCC Runtime and the WinCC Archive Manager service on the CAS.
- In SSMS, take a final
BACKUP DATABASE <OrphanDB> TO DISK = '<archive_path>\<OrphanDB>_final.bak'for audit retention. - Run
ALTER DATABASE <OrphanDB> SET SINGLE_USER WITH ROLLBACK IMMEDIATE; - Run
DROP DATABASE <OrphanDB>; - Verify with
SELECT name FROM sys.databases;
Reading the Maintenance Plan Log
The plan history file is the canonical source for diagnosis. Locate it via SQL Server Management Studio → Management → Maintenance Plans → <PlanName> → View History. Common entries and their interpretations:
| Log entry | Meaning | Resolution |
|---|---|---|
Database 'X' does not exist |
Maintenance Plan references a dropped DB | Re-edit plan; remove orphan from selection |
BACKUP DATABASE permission denied |
SQL Agent service account lacks privileges | Grant db_backupoperator or sysadmin on instance |
Operating system error 5 (Access is denied.) |
Backup path unreachable or ACL incorrect | Verify UNC path and write permission of SQL Agent account |
BACKUP LOG cannot be performed because database is in SIMPLE recovery |
Transaction log backup selected against wrong recovery model | Switch DB to FULL recovery or remove log-backup step |
The volume on device 'X' is out of space |
Backup destination full | Increase volume or move to a different share; implement pruning |
Backup set is corrupt (during verify) |
Disk fault or write interruption | Investigate storage; re-run with CHECKSUM |
Restore Verification
A backup is only valid if it can be restored. Schedule a periodic restore drill on a non-production host:
- Copy the latest
.bakfile from the CAS backup share to the test host. - Run
RESTORE HEADERONLY FROM DISK = '<path>\<file>.bak';to verify the backup set. - Run
RESTORE VERIFYONLY FROM DISK = '<path>\<file>.bak';to validate the backup stream without restoring data. - Restore the database under a temporary name using
RESTORE DATABASE <TestDB> FROM DISK = '<path>\<file>.bak' WITH MOVE ..., RECOVERY; - Open WinCC Explorer pointed at the restored DB and confirm tag logging and alarm logging queries return valid data.
The verification steps mirror the recommendations in Microsoft's Back up and restore of SQL Server databases reference, in particular the Media errors and Verify backups sections.
Capacity and Retention Sizing
The CAS database grows roughly with the product of (number of archived tags) × (archive cycle) × (retention). Use a representative calculation:
- Each tag value at a 1-second cycle occupies approximately 16 bytes raw in the compressed archive segment.
- Daily volume per tag ≈ 16 × 86,400 ≈ 1.4 MB (before compression). WinCC compression typically achieves 5×–10×.
- Example: 5,000 tags, 7-day online retention, 365-day archive retention on the CAS → approximately 4–7 GB compressed.
- Plan full backups at 2× this size for breathing room.
Troubleshooting Matrix
| Symptom | Likely cause | Corrective action |
|---|---|---|
| Maintenance plan succeeds sometimes, fails other times | Race with WinCC archive segment switch | Schedule plan outside archive segment switch window (e.g. 02:00 / 14:00) |
| Backup fails immediately after PCS 7 download | New archive DB created; old DB dropped | Refresh selection list in plan |
| Backup hangs for hours | VSS snapshot stalled or AV scan on backup file | Add exclusions for .bak extension in AV |
| Backup succeeds but restore reports corruption | Network path dropped mid-write | Use local staging + copy; enable CHECKSUM |
| Backup file 0 bytes | Disk full or path inaccessible at run time | Monitor free space; validate UNC before scheduling |
| Cannot delete orphan database | WinCC service holds connection | Stop WinCC Archive Manager + WinCC Runtime, then drop |
Operational Recommendations
- Document the
sqlmaint.execommand line of every Maintenance Plan in a controlled location (e.g. the project administration folder). Operators must be able to reproduce the plan after a server rebuild. - After every PCS 7 download, re-run the database inventory query in Identifying Required vs. Orphaned Databases.
- Treat the SQL Agent service account as a privileged identity. Backups of a CAS typically contain years of process data; protect the share with ACLs that allow only the SQL Agent service account, administrators, and the restore drill operator.
- Maintain a 3-2-1 backup policy: at least 3 copies, on 2 different media, with 1 off-site.
- When migrating the CAS to new hardware, use
BACKUP ... WITH COMPRESSION, CHECKSUMto produce a single, verifiable, transferable file rather than detaching and copying raw MDF/LDF files.
FAQ
Should I back up all databases on the WinCC Central Archive Server?
No. Always select specific databases in the Maintenance Plan, excluding tempdb and any orphaned WinCC_* databases from prior host renames or OS images. Selecting "All user databases" is the leading cause of intermittent plan failures.
Why does a Maintenance Plan fail after renaming the CAS computer?
WinCC embeds the host name in the database name. Renaming the host makes WinCC create a new database while the old one remains on the SQL instance; if the plan references the old name, the backup step fails when that database is dropped. Remove the orphan or update the plan to reference the new name.
Do I need to reconfigure the SQL Maintenance Plan after every PCS 7 compilation?
Not necessarily for every compilation. Run the inventory query SELECT name, create_date FROM sys.databases WHERE name LIKE 'WinCC%' after each download and add any newly created archive databases to the plan; remove dropped ones. Compilation-only changes usually reuse the existing database.
How can I verify a CAS backup without disrupting production?
Use RESTORE VERIFYONLY FROM DISK = '<path>\<file>.bak' on a periodic schedule and perform a full restore drill to a test host at least quarterly, as recommended in Microsoft's Back up and restore of SQL Server databases reference.
What is the difference between backing up the MDF/LDF files versus using a Maintenance Plan?
Maintenance Plan backups use SQL Server's native backup stream, capture transaction-consistent state, support compression and CHECKSUM, and can be restored with RESTORE DATABASE. Detaching and copying files bypasses SQL Server and produces inconsistent databases when WinCC is actively writing to them.