How to Resolve 'SQL Server Cannot Access Database' Errors During PCS 7 ES to OS Downloads
In SIMATIC PCS 7, the error 'The SQL Server cannot access database' or 'No or invalid project context' during an Engineering Station (ES) to Operator Station (OS) download occurs when the target machine's Microsoft SQL Server instance lacks permission to attach the project files or encounters an orphaned database lock. Root causes include the target OS SQL Server service account lacking NTFS rights to the project directory, the user account missing from the mandatory 'SIMATIC HMI' Windows group, or corrupted project connection files (.dcf). Running Siemens Security Controller, verifying folder sharing permissions, purging the .dcf cache, and restarting SQL Server resolves the error.
Table of Contents
- Architecture of ES-to-OS Project Loading
- Root Cause Analysis for SQL Access Denials
- Step-by-Step Remediation Procedure
- Network Share and Permission Requirement Matrix
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Architecture of ES-to-OS Project Loading
In SIMATIC PCS 7 distributed control systems, engineering configurations created on the Engineering Station (ES) are deployed to remote OS Servers, OS Single Stations, and OS Clients via the Download to target system function.
The physical and logical mechanics of an OS download involve multiple coordinated subsystems:
1. Network File Transfer: The ES establishes an SMB connection across the Terminal Bus to the administrative network share of the target OS computer (e.g., \\OS_TARGET\WinCC_Project).
2. Project Database Replication: The ES copies project files, process pictures (.pdl), scripts, and SQL Server master database files (<Project>.mdf and <Project>.ldf).
3. Database Attachment via DCOM: The ES invokes remote procedure calls (RPC/DCOM) signaling the target OS's WinCC Project Manager (CCProjectMgr.exe) to attach the database to the local Microsoft SQL Server instance (MSSQL$WINCC).
4. Validation: The target SQL instance opens the .mdf file, verifies schema consistency, and establishes local ODBC/OLEDB connection handles.
Root Cause Analysis for SQL Access Denials
When the download aborts during the project opening phase with error dialogs such as:
'The SQL Server cannot access database' or 'No or invalid project context / ASO cannot work correct', the transfer fails at Step 3 or 4.
Primary Mechanisms Inducing Download Aborts
- Insufficient NTFS and Share Permissions: The folder hosting the WinCC project on the target OS must grant Full Control to the local Windows group
SIMATIC HMI. If network share permissions only grant access to the specific logged-in user, the internal SQL Server service account (e.g.,NT SERVICE\MSSQL$WINCC) is blocked from opening the newly copied.mdffile. - Missing User Group Memberships: The Windows user account initiating the download on the ES (and the active logon on the OS) must belong to:
AdministratorsSIMATIC HMISIMATIC NET- Orphaned File Locks from Aborted Sessions: If a previous download was canceled midway, or if a background WinCC process (such as
CCProjectMgr.exe,s7tgtopx.exe, orCCAlgRtServer.exe) hung in memory, SQL Server retains an exclusive operating system file handle on<Project>.mdf, blocking the new download from overwriting or attaching it. - Corrupted Project Cache (
.dcf): A corrupted<ProjectName>.dcffile staging outdated database connection strings causes WinCC to attempt binding to an invalid database GUID.
Step-by-Step Remediation Procedure
Follow this comprehensive troubleshooting procedure to restore clean OS downloading:
Step 1: Run Siemens Security Controller on Both Stations
- On both the Engineering Station and the target Operator Station, launch Security Controller (
Start -> Siemens Automation -> Security Controller). - Click Repeat Settings to select DCOM settings, Windows Firewall exceptions, Registry keys, and User Group assignments.
- Click Apply Recommendations and allow the utility to reset system policies.
- Restart both computers.
Step 2: Validate Windows User Group Memberships
- Open Windows Computer Management (
compmgmt.msc) -> Local Users and Groups -> Groups. - Verify that the logged-in engineer account belongs to
Administrators,SIMATIC HMI, andSIMATIC NET. - If running in a Windows Domain environment, ensure the domain user is explicitly nested within the local
SIMATIC HMIgroup on the target OS.
Step 3: Verify Target Project Folder Sharing and Security
- On the target OS, open Windows Explorer and navigate to the root directory where projects are stored (e.g.,
D:\WinCC_Projects). - Right-click the folder and select Properties:
* On the Sharing tab -> Advanced Sharing: Ensure the share exists with Permissions set toFull Controlfor groupSIMATIC HMIandEveryone.
* On the Security tab: Ensure that the local groupSIMATIC HMIandSQLServerMSSQLUser$<MachineName>$WINCChave Full Control NTFS permissions.
Step 4: Purge Orphaned Processes and Caches on the Target OS
- Ensure WinCC Runtime is fully deactivated.
- Open Windows Task Manager; terminate any remaining instances of
CCProjectMgr.exe,CCAlgRtServer.exe, orPcs7AlarmRtHost.exe. - Open Windows Administrative Tools -> Services; restart the service SQL Server (WINCC).
- Open the target project directory and delete the
<ProjectName>.dcffile.
Step 5: Execute Entire OS Download from ES
- In SIMATIC Manager on the ES, right-click the OS project and select PLC -> Download.
- Select Entire OS.
- Confirm the transfer; the project will copy, attach to SQL Server cleanly, and report download successful.
Network Share and Permission Requirement Matrix
The following table outlines the essential network, operating system, and database permissions required for PCS 7 OS downloads:
\\OS\Project)SIMATIC HMI, AdministratorsD:\)SIMATIC HMI, SYSTEMMSSQL$WINCC)NT SERVICE\MSSQL$WINCC.mdf and .ldf filesSIMATIC HMIEnsuring all security entities are configured according to Siemens standards prevents download connection aborts.
Verification
To verify that the OS download mechanism is operating reliably:
1. In SIMATIC Manager, initiate an Entire OS download to the target station.
2. Verify that the file copying progress bar completes to 100%.
3. Confirm that the status message transitions to 'Project is being opened on the target computer' and closes with zero error popups.
4. On the target OS, verify that WinCC Explorer launches automatically displaying the project name.
5. In Windows Services, verify that the SQL Server (WINCC) service remains active with stable memory consumption.
6. Make a minor modification in CFC and execute a Changes only download to confirm online delta transfer works.
Limitations and Operational Precautions
- Never download to an OS target while an engineer has WinCC Explorer open locally on that target station; local file locking will cause SQL attachment to fail.
- Do not store PCS 7 projects on compressed, encrypted, or networked NAS drives; project folders must reside on local physical NTFS partitions.
- Avoid running aggressive third-party endpoint security software that dynamically alters DCOM RPC permissions.
- In redundant OS server pairs, always download to the Standby Server first, activate runtime, verify archive synchronization, and only then download to the partner server.
Engineer FAQ
Why does deleting the .dcf file resolve SQL download errors?
The .dcf file caches database connection strings and project identification GUIDs. If the file contains stale handles from a previous failed session, WinCC fails to attach the .mdf database until the cache is deleted and rebuilt.
Can I use an administrative account that is not in the SIMATIC HMI group?
No. Windows Administrators do not automatically inherit Siemens DCOM and SQL rights unless explicitly added to the SIMATIC HMI group by Security Controller.
What does 'No or invalid project context' mean during download?
This error indicates that the download wizard successfully copied the project files, but the target machine's WinCC Project Manager service failed to initialize the project context in SQL Server.
Technical References
- SIMATIC PCS 7 PC Configuration Manual (V8.1/V8.2)
- Siemens Security Controller Function Description and Best Practices
- Siemens Industry Online Support FAQ: Troubleshooting OS Loading Failures (Entry 33123686)
Related Articles
- How to Restore Disappeared WinCC OS Applications in SIMATIC Manager Due to SQL Suspect Databases
- Understanding OS Delta Download Quantity Limits and Handling Delta Overflows in SIMATIC PCS 7
- How to Resolve 'IMServerX and ASOSHeartbeat Has Stopped Working' Errors During PCS 7 OS Download
Related Tags
- OS_Download
- SQL_Server_Error
- Security_Controller
- SIMATIC_HMI_Group
- DCF_File