Troubleshooting WinCC OS Secondary Server Download Stalls and Database Context Errors in PCS 7

Troubleshooting WinCC OS Secondary Server Download Stalls and Database Context Errors in PCS 7

Operator Station (OS) downloads to a secondary redundant WinCC server stall or fail with database context errors when the target node maintains locked Microsoft SQL Server databases or corrupted network sharing permissions. When the Engineering Station attempts an online target download, any active WinCC runtime process, orphaned database attachment, or mismatched DCOM credential on the secondary server prevents the database replacement sequence. To restore reliable downloads, deactivate runtime, reset WinCC background daemons, verify SIMATIC HMI user group memberships, and execute the Siemens Security Controller on both nodes.

Table of Contents

Mechanisms of OS Target Downloads to Redundant Servers

In a redundant SIMATIC PCS 7 Operator Station architecture, the Engineering Station (ES) compiles two distinct OS project databases: the primary server project (OS(1)) and the secondary standby server project (OS(2)). When the engineer initiates an OS download from SIMATIC Manager (Target System -> Load):

  1. Remote Handshake and Verification: The ES connects via Windows RPC/DCOM and SMB to the target secondary server, validating security credentials, computer name, and target directory path.
  2. Runtime State Detection: The ES queries the remote WinCC Project Manager daemon (CCProjectMgr.exe) to confirm whether WinCC Runtime is active on the standby node.
  3. Database Transfer: If downloading changes, differential data is merged. If downloading the entire project, the target WinCC Explorer instance is commanded to close, the existing .mdf and .ldf configuration databases are detached from SQL Server (WINCC), new project files are copied across the network share, and the new database context is registered into SQL Server.
  4. Project Initialization: WinCC Explorer on the secondary server automatically opens the copied project and prepares it for runtime activation and redundancy synchronization.

Root Causes of Database Context and Opening Stalls

When the download hangs on "Opening WinCC Project" or aborts with "The project could not be opened: database context does not exist or is invalid", the failure is typically traced to four underlying conditions:

  1. Active Database File Locks on Secondary Server: If WinCC Runtime was running and failed to deactivate cleanly, background processes such as CCProjectMgr.exe, pdlrt.exe, or CCEmergencyStore.exe maintain active file handles on *.mdf files, preventing the ES from overwriting or detaching them.
  2. Orphaned SQL Server Attachments: The local SQL Server (WINCC) instance on the secondary server retains an internal catalog registration pointing to an old or partially deleted database path, creating a context collision when the new database attempts to register.
  3. Mismatched User Rights and DCOM Permissions: The engineering user account executing the download from the ES lacks identical credentials, password, or group assignments (SIMATIC HMI, SIMATIC NET, local Administrators) on the secondary OS server.
  4. Corrupted Network Share (_PRJ): The shared project directory on the secondary server has damaged NTFS permissions or missing share rights, blocking write access during the file transfer phase.

Step-by-Step Resolution and Clean Download Procedure

Follow this sequential engineering recovery process on the affected secondary OS server:

Step 1: Deactivate and Terminate Secondary Server Runtime

  1. On the secondary OS server console, if WinCC Explorer is responsive, select File -> Deactivate to stop runtime cleanly.
  2. Once runtime is deactivated, select File -> Close to shut down the project.
  3. Open the Windows Run prompt (Windows Key + R), type reset_wincc.vbs, and press Enter.
  4. Allow the script to terminate all active WinCC processes and detach project databases from SQL Server.

Step 2: Purge Corrupted Project Files on Secondary Server

  1. Navigate to the drive and directory where the secondary OS project is stored (e.g., D:\WinCC_Projects\<OS_Standby_Folder>).
  2. If a clean full download is intended, delete the contents of this target directory, or rename the folder to <OS_Standby_Folder>_OLD as a backup.
  3. Recreate the empty target folder with the exact original name.

Step 3: Reconfigure Windows Network Share Permissions

  1. Right-click the newly created target project folder and select Properties.
  2. Select the Sharing tab and click Advanced Sharing.
  3. Check Share this folder. Set the share name to match standard PCS 7 format (<Project_Folder_Name>_PRJ).
  4. Click Permissions and grant Full Control to Administrators, SIMATIC HMI, and the engineering user account.
  5. Select the Security (NTFS) tab and ensure SIMATIC HMI and Administrators possess Full Control.

Step 4: Execute Siemens Security Controller

  1. On the secondary OS server, open the Start menu and navigate to Siemens Automation -> Security Controller.
  2. Click Repeat Settings to reapply all firewall exceptions, DCOM permissions, registry rights, and local group policies.
  3. Perform the same step on the Engineering Station.

Step 5: Perform Full Download from Engineering Station

  1. On the ES, open SIMATIC Manager.
  2. Right-click the secondary OS server object and select PLC -> Download.
  3. In the download selection dialog, select Entire Project.
  4. Click OK to execute the download.

Network Share and Security Controller Alignment

Proper DCOM and RPC communication between the ES and OS server nodes requires strict alignment across the Windows security layer:

  • Identical User Accounts: In workgroup architectures, the engineer must ensure that identical local Windows usernames and passwords exist on the ES, Primary OS, and Secondary OS.
  • Group Memberships: The active engineering user must belong to Administrators, SIMATIC HMI, and SIMATIC NET.
  • Network Adapter Binding: In systems with multiple network adapters (Terminal Bus vs. Plant Bus), ensure that Simatic Device Drivers and the Terminal Bus are bound to the correct physical NIC in the Simatic Shell configuration settings.

SQL Server Database Context Recovery

If the "database context does not exist or is invalid" error persists after recreating the project folder, an orphaned database reference remains in SQL Server:

  1. Launch Microsoft SQL Server Management Studio (SSMS) on the secondary OS server, connecting to .\WINCC.
  2. Expand the Databases node.
  3. Check if any database corresponding to the project name appears in an Offline, Recovery Pending, or Suspect state.
  4. If an orphaned database is present, right-click it, select Tasks -> Detach, check Drop Connections, and click OK.
  5. Close SSMS and execute reset_wincc.vbs once more before re-attempting the target download from the ES.

Verification

Confirm successful OS download and redundancy synchronization:

  1. Local Project Opening: On the secondary OS server, verify that WinCC Explorer launches and displays the project name in the title bar without error dialogs.
  2. Redundancy Editor Verification: Open the Redundancy editor in WinCC Explorer on the secondary server. Verify that the partner server computer name and redundancy settings match the primary server.
  3. Runtime Activation and Synchronization:
    * Activate WinCC Runtime on the secondary server.
    * Verify that the secondary server connects to the automation stations.
    * Open the WinCC Alarm Logging window and confirm receipt of system message 1010001 (Redundancy: Partner server online).
    * Verify that archive synchronization (Redundancy Tag Logging and Alarm Logging sync) completes successfully.

Limitations and Operational Precautions

  • Avoid Downloading to Secondary While Primary is in Transition: Never initiate an OS download to the secondary server if the primary server is currently compiling, failing over, or undergoing runtime restart.
  • Full Download Requires Runtime Stop: An "Entire Project" download to a redundant server requires stopping runtime on that node. Ensure the redundant partner node is healthy and carrying plant operations before downloading.
  • Do Not Manually Attach Databases via SSMS: Never manually attach or alter WinCC project databases using SQL Server Management Studio unless specifically directed by Siemens Technical Support. WinCC requires proprietary metadata registration handled exclusively by WinCC tools.
  • Preserve Network Connection During Transfer: An interruption in network connectivity during the database copy phase leaves the target database context in a corrupted state, requiring a manual folder purge and full re-download.

Engineer FAQ

  • What does the error 'database context does not exist or is invalid' mean in WinCC?
    It indicates that WinCC Explorer cannot connect to or register the project SQL database files (.mdf/.ldf) because of permission lockouts or orphaned database instances in SQL Server.
  • Why does the download succeed for the primary OS server but fail on the secondary server?
    Differences in local Windows user permissions, unapplied Security Controller settings, lingering WinCC file handles, or network share permission mismatches on the secondary server typically account for single-node failures.
  • How does Simatic Shell affect remote OS project downloads?
    Simatic Shell governs broadcast name resolution and encrypted communication between PCS 7 stations. If Simatic Shell is bound to the wrong network adapter, remote downloads stall.
  • Is it safe to delete the OS project folder on the secondary server before downloading?
    Yes, when performing a full download ('Entire Project'), deleting or renaming the old project folder on the target server ensures a clean transfer without file handle collisions.
  • What should I do if reset_wincc.vbs hangs during execution?
    If reset_wincc.vbs hangs, open Windows Task Manager as administrator, forcefully terminate remaining CC*.exe and pdlrt.exe processes, and restart the Microsoft SQL Server (WINCC) service.
  • Can I perform an 'Online Changes Download' if the secondary server project was recreated?
    No. Once a project folder is deleted or recreated, internal change synchronization history is lost, requiring an 'Entire Project' download while the server is offline.
  • Why does WinCC Explorer open automatically on the target server after a download?
    PCS 7 target download automation commands the remote station to open WinCC Explorer to register the database context with SQL Server and verify project integrity.
  • Does running the Siemens Security Controller require a computer restart?
    In most cases, applying settings in the Security Controller updates policies immediately without requiring a restart, though a restart is recommended if DCOM rules were modified.
  • How do I verify that the secondary OS server is actively synchronizing with the primary server?
    Check WinCC internal tags '@RedundancyState' and '@RM_Master', and inspect the redundancy log file 'WinCC_Sys_01.log' or '@Redundancy' system alarms.
  • What role does the Windows Computer Name play in WinCC OS download failures?
    The computer name configured in WinCC project properties must match the actual Windows computer name of the target server exactly (max 15 characters, no underscores or illegal characters).

Technical References

  • Siemens Industry Online Support (SIOS) Portal: Why does the OS download fail with an error regarding database context? (Entry ID: 58826849).
  • SIMATIC PCS 7 Operator Station Engineering Manual (V8.2 / V9.0 / V9.1), Siemens AG.
  • SIMATIC WinCC Redundancy Manual, Siemens AG.

Related Articles

Related Tags

PCS 7, WinCC, OS Download, Redundancy, SQL Server, Database Context, Security Controller, Troubleshooting

20 respuestas