How to Resolve 'SQL Server Cannot Access Database' Errors During PCS 7 ES to OS Downloads

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

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 .mdf file.
  • Missing User Group Memberships: The Windows user account initiating the download on the ES (and the active logon on the OS) must belong to:
  • Administrators
  • SIMATIC HMI
  • SIMATIC 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, or CCAlgRtServer.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>.dcf file 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

  1. On both the Engineering Station and the target Operator Station, launch Security Controller (Start -> Siemens Automation -> Security Controller).
  2. Click Repeat Settings to select DCOM settings, Windows Firewall exceptions, Registry keys, and User Group assignments.
  3. Click Apply Recommendations and allow the utility to reset system policies.
  4. Restart both computers.

Step 2: Validate Windows User Group Memberships

  1. Open Windows Computer Management (compmgmt.msc) -> Local Users and Groups -> Groups.
  2. Verify that the logged-in engineer account belongs to Administrators, SIMATIC HMI, and SIMATIC NET.
  3. If running in a Windows Domain environment, ensure the domain user is explicitly nested within the local SIMATIC HMI group on the target OS.

Step 3: Verify Target Project Folder Sharing and Security

  1. On the target OS, open Windows Explorer and navigate to the root directory where projects are stored (e.g., D:\WinCC_Projects).
  2. Right-click the folder and select Properties:
    * On the Sharing tab -> Advanced Sharing: Ensure the share exists with Permissions set to Full Control for group SIMATIC HMI and Everyone.
    * On the Security tab: Ensure that the local group SIMATIC HMI and SQLServerMSSQLUser$<MachineName>$WINCC have Full Control NTFS permissions.

Step 4: Purge Orphaned Processes and Caches on the Target OS

  1. Ensure WinCC Runtime is fully deactivated.
  2. Open Windows Task Manager; terminate any remaining instances of CCProjectMgr.exe, CCAlgRtServer.exe, or Pcs7AlarmRtHost.exe.
  3. Open Windows Administrative Tools -> Services; restart the service SQL Server (WINCC).
  4. Open the target project directory and delete the <ProjectName>.dcf file.

Step 5: Execute Entire OS Download from ES

  1. In SIMATIC Manager on the ES, right-click the OS project and select PLC -> Download.
  2. Select Entire OS.
  3. 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:

Resource / LayerTarget LocationRequired Identity / GroupRequired Permission LevelTarget Project ShareTarget OS (\\OS\Project)SIMATIC HMI, AdministratorsFull Control (Share Permissions)Project Storage FolderTarget OS NTFS Drive (D:\)SIMATIC HMI, SYSTEMFull Control (NTFS Security)SQL Server InstanceLocal SQL (MSSQL$WINCC)NT SERVICE\MSSQL$WINCCFull Control on .mdf and .ldf filesDCOM EndpointsES and OS WorkstationsSIMATIC HMILocal/Remote Access & LaunchWindows FirewallTerminal Bus AdaptersSiemens Security Controller RulesPorts 135, 445, 1433, 1434 Enabled

Ensuring 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

Related Articles

Related Tags

  • OS_Download
  • SQL_Server_Error
  • Security_Controller
  • SIMATIC_HMI_Group
  • DCF_File
6 respuestas