Problem Overview
On a SIMATIC PCS 7 V6.0 SP1 multiproject (Engineering Station, ES, running Windows Server 2000 in the reported case), all WinCC OS applications under the SIMATIC Manager tree (PC Station components) suddenly disappear. The project contains multiple AS stations (S7-400 controllers) and multiple PC stations, all of which previously showed their WinCC OS sub-objects. After the failure, double-clicking a PC station returns an error dialog and the OS hierarchy under that station is empty.
The reported root indicators in this failure mode are:
- SQL Server service (instance
MSSQL$WINCC) is stopped and cannot be restarted from the Services console. Pressing Start in the Services snap-in shows a brief Starting… state, then reverts to Stopped. - SQL error log shows Error 9003, Severity 20, State 1: "Cannot recover the master database. Exiting."
- One or more SQL databases (often a backup copy created by a third-party tool such as VersionDoc) enter Suspect mode (icon shown grey instead of the normal yellowish green in SQL Enterprise Manager / Management Studio).
PCS 7 stores all OS project data, picture hierarchies, tag databases and alarm logging inside Microsoft SQL Server. When the SQL Server instance cannot bring its master database online, WinCC components — even though their .pdl and .db files may still be intact on disk — are no longer linkable inside SIMATIC Manager and are filtered out as a defensive measure.
Root Cause Analysis
The master database is the system catalog of SQL Server: it tracks every other database on the instance, the physical file locations, login accounts, configuration values, and the recovery state of in-flight transactions. SQL Server cannot start any user database, including the WinCC project databases, without a consistent master. Error 9003 is logged when the recovery process for master fails, typically because:
- Physical corruption of
master.mdformastlog.ldf(bad block, truncated file, disk full, anti-virus quarantine, abrupt power loss). - Presence of a Suspect user database that prevents instance-wide recovery. In the reported field case, the VersionDoc daily backup tool created a temporary database that was never dropped and was left in Suspect state.
- Third-party software (archiving, antivirus, backup agents, PCS 7 add-ons) holding an exclusive handle on the
.mdf/.ldffiles while SQL Server tries to attach them, producing torn writes and a corrupted boot page.
When SIMATIC Manager cannot obtain a valid SQL handle, the OS sub-tree of every PC station in the multiproject collapses. This is intentional: SIMATIC Manager hides OS objects whose backing database is unreachable rather than presenting a half-functional project that would corrupt further edits.
Diagnostic Decision Path
| Symptom | Check | Expected Result on Healthy System |
|---|---|---|
| SQL service will not stay started | Open SQL Server Service Manager (Start > Programs > MS SQL Server > Service Manager) | Service reports Running with green indicator on instance WINCC
|
| Suspect databases | Open SQL Enterprise Manager, expand the instance, view Databases folder | All DBs shown with normal icon (green/yellow), no grey icon |
| Error 9003 in error log | Enterprise Manager > Management > SQL Server Logs, or open C:\MSSQL$WINCC\LOG\ERRORLOG with Notepad |
No 9003, 9001, 9002 entries at startup |
| PC Station > WinCC Application missing in SIMATIC Manager | Right-click PC station, choose Object Properties…, tab OS Assignment | OS name shown, configuration loads without error |
Recovery Procedure (Without Reinstallation)
Use this procedure when the project file tree on disk is intact, a recent good backup of the master database is not available, and at least one of the user databases (typically CC_…_…) is in Suspect state but the master.mdf itself has a known good counterpart.
Prerequisites
- Local administrator rights on the ES.
- The PCS 7 V6.0 SP1 installation DVD set (for the SQL Server tools) or the original SQL Server 2000 installation media used to install
MSSQL$WINCC. - A working backup of the entire project directory (
*.s7pproject path, typicallyD:\PCS7\Project\<ProjectName>) copied to external media before any destructive action.
Step-by-Step
- Stop all SIMATIC-related services that may hold database handles:
net stop "S7DOS" net stop "CCAgent" net stop "SQLAgent$WINCC" - Open Start > Programs > Microsoft SQL Server > Enterprise Manager (V6.0 ships SQL Server 2000 client tools). If only Service Manager is installed, install the full client tools from the SQL Server 2000 CD using
sqlstp.exe. - In Enterprise Manager, expand Microsoft SQL Servers > SQL Server Group > (local) (Windows NT) > WINCC. The instance name
WINCCmatches the named instance created by the PCS 7 setup. - Stop the SQL Server service. Right-click the server > Stop. Verify the Service Manager tray icon reports a red Stopped indicator.
- Identify the data directory. The default for a named instance on a PCS 7 V6.0 install is
C:\MSSQL$WINCC\Data. Confirm by looking at the startup parameters via Enterprise Manager > right-click server > Properties > General > Startup parameters. Typical values:-dC:\MSSQL$WINCC\Data\master.mdfand-eC:\MSSQL$WINCC\Log\ERRORLOG. - List the contents of the data directory and identify the suspect files:
dir C:\MSSQL$WINCC\Data\*.mdf C:\MSSQL$WINCC\Data\*.ldf
You should seemaster.mdf,mastlog.ldf,model.mdf,modellog.ldf,tempdb.mdf,templog.ldf,msdb.mdf,msdblog.ldf, plus the PCS 7 project databases such asCC_PCS7_01_08_14_18_31.mdf. - Move the suspect
.mdfand.ldfof any Suspect database to a holding folder outside the data directory, e.g.:
mkdir C:\MSSQL$WINCC\Data\_quarantine move C:\MSSQL$WINCC\Data\CC_PCS7_01_08_14_18_31.mdf C:\MSSQL$WINCC\Data\_quarantine\ move C:\MSSQL$WINCC\Data\CC_PCS7_01_08_14_18_31_log.LDF C:\MSSQL$WINCC\Data\_quarantine\
Do not delete yet. The files are still referenced by SIMATIC Manager and will be re-attached on the next project compile. - If
master.mdfis also corrupt and you have a known good copy from a backup or from another ES that was running the same SP, replace it (see warning below):
copy D:\Backup\master_good.mdf C:\MSSQL$WINCC\Data\master.mdf /Y copy D:\Backup\mastlog_good.ldf C:\MSSQL$WINCC\Data\mastlog.ldf /YWarning: Replacingmaster.mdfwith a copy from a different ES will desynchronize instance metadata (logins, server-level settings, linked server definitions). Only do this when no SQL backup exists and the alternative is full reinstallation. - Restart the SQL Server service from Service Manager. Watch the ERRORLOG with a tail:
type C:\MSSQL$WINCC\Log\ERRORLOG | more
Confirm the line SQL Server is now ready for client connections and the absence of any further 9003 / 9001 entries. - Re-open SIMATIC Manager, open the multiproject, and check every PC station. The OS application sub-tree should reappear within a few seconds as the connection to
MSSQL$WINCCis re-established. - Open each OS in WinCC Explorer and trigger a full project compile (OS Project Editor > Close > Generate / Update). This re-attaches the project database files that were quarantined in step 7.
Recovery Procedure (Reinstalling SQL Server and WinCC)
If the master database is unrecoverable, no good backup exists, and SIMATIC Manager still shows no OS stations, the supported path is to rebuild the SQL instance and the WinCC installation. This was the final fix applied in the field case that produced the source log: "I fix problem with uninstall/install SQL and WinCC."
- Back up the entire
D:\PCS7\Projecttree to external media. Also copyC:\MSSQL$WINCC\Data\*.mdfand*.ldffor every project database, in case the rebuild can be performed by re-attaching the files rather than restoring from project backup. - From Control Panel > Add/Remove Programs, uninstall Microsoft SQL Server Desktop Engine (WINCC) and WinCC in that order. Do not uninstall PCS 7 itself.
- Delete (or rename) the leftover data directory
C:\MSSQL$WINCC. - Reinstall the SQL Server instance using the PCS 7 V6.0 SP1 setup, choosing the Named Instance: WINCC and the same data paths as before.
- Reinstall WinCC from the PCS 7 V6.0 SP1 setup.
- Start SIMATIC Manager, open the project, and let the OS project editor recreate the project database files. Where prompted, point the re-creation at the original
*.mdf/*.ldfcopies that were backed up in step 1. - Recompile every OS and verify the alarm and tag databases are consistent by opening WinCC Explorer > Tag Management and Alarm Logging.
Verification
After either recovery path, perform the following checks before declaring the system healthy:
| Verification Step | Pass Criterion |
|---|---|
| SQL Service Manager indicator | Green, label Running — WINCC |
Tail of ERRORLOG after restart |
Last line: SQL Server is now ready for client connections; no 9003, 9001, 3414, 17204, 17207 |
| SIMATIC Manager > PC Station > OS sub-tree | All previously visible OS applications are listed for every PC station |
| WinCC Explorer > Tag Management | All process tags load without "Tag not found" or "Connection broken" warnings |
| Alarm Logging test message | A test alarm round-trips and is acknowledged without SQL write errors |
| OS runtime start | OS starts in WinCC Runtime; Graphics Runtime, Alarm Logging Runtime and Tag Logging Runtime all show green |
| Time Sync (optional but recommended) | WinCC Time Sync to AS proceeds without "Cannot access database" event |
Prevention and Hardening
Several concrete measures reduce the likelihood of recurrence once the system is recovered:
-
Audit third-party tools that touch the SQL instance. In the field case, the VersionDoc backup utility was creating a daily temp database that was not being dropped on backup completion. Configure the tool to remove its temporary database, or schedule a daily SQL Agent job to drop any database that has been in Suspect state for more than one hour:
EXEC sp_executesql N'IF DB_ID(''VersionDoc_Temp'') IS NOT NULL BEGIN TRY ALTER DATABASE VersionDoc_Temp SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE VersionDoc_Temp; END TRY BEGIN CATCH PRINT ''Could not drop VersionDoc_Temp''; END CATCH'; -
Exclude the SQL data and log directories from antivirus on-access scanning. Real-time scanning of
*.mdfand*.ldfis a known contributor to torn writes. AddC:\MSSQL$WINCC\DataandC:\MSSQL$WINCC\Logto the AV exclusion list. -
Schedule a daily SQL backup of the system databases in addition to the PCS 7 project backup:
BACKUP DATABASE [master] TO DISK = N'D:\SQLBackup\master_full.bak' WITH INIT; BACKUP DATABASE [msdb] TO DISK = N'D:\SQLBackup\msdb_full.bak' WITH INIT;
A recentmasterbackup is the single most important asset for avoiding a full reinstallation in the next failure. -
Move from Windows Server 2000 / SQL Server 2000. The PCS 7 V6.0 platform is itself long out of mainstream support. Plan a migration to at least PCS 7 V8.x or V9.x on a supported Windows Server / SQL Server pair; the disappearance symptom is much less common on SQL Server 2008 R2 and later because of improved recovery semantics and
CHECKDBintegration. -
UPS-protect the ES and configure Windows for Shut down: On battery, 5% rather than hibernate. Abrupt power loss is a frequent root cause of torn
masterpages. - Set SQL Service startup to Automatic (Delayed Start) so the service starts after disk subsystems have stabilized after a reboot.
Frequently Asked Questions
What does SQL Error 9003 mean on a PCS 7 V6.0 ES?
Error 9003, Severity 20, State 1 — "Cannot recover the master database. Exiting" — means the SQL Server instance MSSQL$WINCC found the master.mdf or mastlog.ldf file damaged during its crash-recovery phase at service start. The instance refuses to start any user database until master is restored or rebuilt.
Why do all WinCC OS applications disappear from SIMATIC Manager when only the SQL master is corrupt?
SIMATIC Manager resolves every PC station's OS sub-tree by reading the project database through MSSQL$WINCC. If the SQL handle cannot be opened, the OS objects are hidden rather than shown as broken, which prevents accidental edits against an inconsistent project. Once the SQL instance is restored, the OS sub-trees reappear automatically.
Can I just delete master.mdf and let PCS 7 recreate it?
No. The PCS 7 setup installs the named instance but does not auto-recreate the system databases on launch. Without a known good master file or a SQL-level master backup, the supported recovery is to uninstall and reinstall SQL Server plus WinCC as described in the second procedure above. Always keep at least one off-machine master backup.
Do I need to reinstall the whole PCS 7 V6.0 project as well?
No. The PCS 7 project files (*.s7p, *.s7l, the S7 program, FBD/LAD sources) live on disk under the project directory and are not stored inside master. Reinstalling SQL Server and WinCC rebuilds the tool layer; the project is re-opened afterwards from its original directory.
How can I tell whether a user database is in Suspect mode without installing SQL Management Studio?
Stop the SQL service, open C:\MSSQL$WINCC\Data in Windows Explorer, and look for *.mdf files whose timestamp has not been updated for several hours while other DB files have — these are typically the ones that failed recovery. A more reliable check is to start the service and run, in Query Analyzer: SELECT name, state_desc FROM sys.databases;. Databases in state SUSPECT should be moved to a quarantine folder and the service restarted.
Is there a way to keep the OS sub-trees visible when SQL is down, for read-only inspection?
No supported way. SIMATIC Manager treats a missing SQL handle as a fatal condition for the project and hides the OS sub-trees. Use the offline copy of the project (a regular SIMATIC Manager Archive or a file-level copy) for read-only inspection while the live instance is down.