IMDTouchKnowledge BaseShop main store

Troubleshooting

Fixing a PCS 7 OS download that fails with SQL errors

HMI and touchscreens Published 8 min read

Short answer

The transfer fails because the target-side WinCC SQL databases, the CC_* copies, stay attached to SQL Server or sit in RECOVERY_PENDING, so WinCCOM cannot replace them. Close Runtime and all editors, reboot the target, remove the obsolete CC_* databases through the SQL administration layer rather than by deleting .mdf files, delete the stale CC_OM DSN, then run one clean download.

On this page
  1. What each error tells you
  2. Shut the target down before touching SQL
  3. Inventory the CC_* databases where they live
  4. Remove obsolete databases the supported way
  5. Clear the stale CC_OM DSN
  6. Worked example: cleaning DESKTOP-BVUKCPK after repeated failed downloads
  7. What you can rule out quickly
  8. When cleanup itself stalls: documented escalation
  9. Run one clean download and verify
  10. Questions asked

An ES-to-OS download that compiles clean and then dies inside WinCCOM is a target-side database problem, not a project fault. The CC_* databases the transfer generates stay attached to the target SQL Server instance or sit in RECOVERY_PENDING, so WinCCOM cannot drop and replace them, and the log reports the .mdf files as in use by another application. Fix it on the target: close WinCC Runtime and every editor, reboot, remove the obsolete CC_* databases through the SQL administration layer rather than by deleting .mdf files, delete the stale CC_OM DSN, then run exactly one clean download. The sections below map each message in the log to its cause and give the order that gets a PCS 7 V10 single-station transfer through.

What each error tells you #

Message in the log What it actually reports Your action
CC_WINCCOMSQL.mdf or DESKTOP-BVUKCPK.mdf in use by another application SQL Server still has these databases attached; the file handle belongs to the SQL service, so Windows refuses the delete Drop or detach through SQL administration, delete files only after SQL releases them
Database name carries the ( Recovery Pending ) suffix SQL Server knows the database needs recovery but something blocks recovery from starting: inaccessible files, storage trouble, insufficient access for the SQL service account, or remnants of an interrupted replacement Treat as both a consequence of the failed downloads and an active blocker of the next one; clear before any retry
Error deleting the DSN CC_OM_DESKTOP-BVUKCPK The data source still resolves to a database SQL owns; a DSN is metadata, so deleting it would not detach the database anyway Remove the database first, then the DSN, then check user and system DSN scope
DBDll::Connect: CreateConnection failed. hr = 80004005 A generic connection failure: SQL unreachable, database offline or pending, wrong login context, or a DSN pointing at a missing database Diagnose the layer beneath the code; it names no cause by itself
DmGDO::CopyProjectRTOS_DeleteScripts failed The script-deletion stage of target replacement could not complete Stage marker only; not proof of damaged scripts
CopyProjectRTOS_ChangeComputerNameInUserAdminData The stage that rewrites the target computer name in user-administration data could not complete Stage marker only; not proof of corrupt users

One blocked database produces all six markers, because WinCCOM stops at the first stage it cannot finish and logs every later stage as failed. A transfer that never reaches a SQL message is a different fault: start with why an HMI is detected but the project download still fails or why an HMI transfer fails in initial start mode despite ping instead.

Shut the target down before touching SQL #

The download has to replace runtime project resources while every owner of them is inactive. An owner is any WinCC component, SQL process, editor, runtime session or background service holding a database connection or file handle.

  • Stop the download, close WinCC Runtime and all project editors on the target, local and remote-desktop sessions alike.
  • Reboot the target OS and the ES once to release abandoned sessions and handles; leave the project closed until cleanup is finished.
  • Confirm no second interactive or remote session has the project open. A hidden session holds the same handles a visible one does.
  • The later message that the target OS is open or running is the same condition seen from the ES after a retry; this list clears it.

Inventory the CC_* databases where they live #

Open the SQL Server Management Studio installed on the target and connect to the local WinCC database instance as the local administrator or the user who installed PCS 7, the working context Siemens support entry 109814255 prescribes for database segment work on a PCS 7 OS. Record the name, state and owner of every CC_* database.

Two facts decide what the list means:

  • Each download attempt generates a fresh set of CC_* databases on the target. Roughly 15 CC_* databases on this target means the remnants of every failed attempt are still attached, because none was ever cleaned.
  • The CC_ prefix alone is not a delete order. Archive segments and other projects on the same instance can carry it; entry 109818900, which covers detaching blocking SQL databases after a WinCC failure, identifies the blocking archive segments by the ( Recovery Pending ) suffix in the name.

Remove obsolete databases the supported way #

One rule first, and it is the safety line of this whole procedure: back up anything you must keep before you drop a single database. This is the live database layer of your operator station, and a dropped archive has no undo.

  • Use the installed PCS 7 or WinCC project-management path to remove an obsolete generated target project where that function exists on your build.
  • Databases that stay attached get dropped or detached through SQL Server administration, under the account that owns them; that is the layer entry 109818900 works in.
  • Delete the physical .mdf and .ldf files only after SQL has released them. A file that still refuses deletion is owned by another process; find that process with an operating-system handle check rather than forcing anything.
  • A database you must keep that sits in RECOVERY_PENDING is a repair job, not a cleanup item: restore or repair it, and for WinCC archive segments in that state entry 109814255 sends the case to Siemens technical support.

Never delete an attached .mdf or edit SQL system tables to make a database disappear. Either leaves instance metadata pointing at files that no longer exist, and a recoverable deployment remnant becomes an instance-level problem.

Clear the stale CC_OM DSN #

CC_OM_DESKTOP-BVUKCPK is the ODBC data source WinCC generated for the target computer. A DSN is connection metadata: deleting it does not detach its database, and dropping the database does not remove the DSN. WinCCOM reconciles both layers during replacement, which is why the transfer logged a DSN deletion error while the database was still attached.

  • Remove the obsolete database first, then delete the confirmed-stale DSN through the ODBC administrator.
  • Check both the user and the system DSN lists; a user DSN created by the transfer account is invisible in your session, and the reverse.
  • Test the DSN target from the same Windows account the transfer uses. hr = 80004005 is a generic failure code, so DBDll::Connect names no cause; the test does.

Worked example: cleaning DESKTOP-BVUKCPK after repeated failed downloads #

Inputs, from the failing system itself:

  • PCS 7 V10; ES DESKTOP-23KFVTG; target DESKTOP-BVUKCPK configured as a single station; transfer by SIMATIC PC Station → Compile and Download.
  • Approximately 15 CC_* databases on the target instance, several in RECOVERY_PENDING, with CC_WINCCOMSQL.mdf and DESKTOP-BVUKCPK.mdf locked by another process.
  • Stale DSN CC_OM_DESKTOP-BVUKCPK; connection failure hr = 80004005.
  • reset_wincc.vbs already run repeatedly on the ES with no change.

Rule in words: each download attempt generates a new CC_* set on the target; a database attached to SQL Server cannot be removed by file operations; WinCCOM replaces databases and DSN together, so both layers must be clean before a retry.

The arithmetic:

  • CC_* databases inventoried on the target: 15 (reported count).
  • Downloads that completed and left a valid live set: 0, because every attempt so far failed at the SQL stage.
  • Obsolete copies to remove: 15 - 0 = 15.

Decision: after backups, all 15 are removal candidates, each tracing to a failed attempt, once you confirm none is an archive database or another project on the instance. Retry the download only when the SQL inventory shows zero obsolete CC_* databases attached and neither ODBC list contains CC_OM_DESKTOP-BVUKCPK. At zero, and only at zero, run one download with Runtime and editors closed; any survivor repeats the same failure.

What you can rule out quickly #

  • Re-adding group memberships: the account is already in Administrators and SIMATIC HMI, so repeating it changes nothing.
  • dir /s *.usr returning File Not Found proves only that no loose .usr files sit on disk; it never reads the project database. User Administrator showing Administrator-Group → Administrator is positive evidence the user data exists, and a near-empty GraCS\UserData folder is not evidence either way.
  • More runs of reset_wincc.vbs on the ES: the script resets WinCC state on the machine it runs on, and the attachments live on the target instance.
  • Reinstalling Windows on the target: premature while the failing databases have an identifiable owner and state. The escalation below is cheaper and reversible.

When cleanup itself stalls: documented escalation #

Reported resolutions for this failure class, in rising order:

  • Stop the MSSQL( WinCC ) service on the machine holding the databases, archive the project, restart the machine, then retrieve the project again. That sequence is documented against a PCS 7 OS SQL failure on Siemens support channels.
  • Where the instance is damaged past cleanup, such as a keep-database stuck in RECOVERY_PENDING with no good backup, one documented field resolution uninstalled and reinstalled SQL Server and then PCS 7 on the OS server, keeping WinCC from starting during the reinstall. The archive you made first is what carries the project across.

Both are field-reported fixes, and the second discards the instance. Reach it only after the database-level path above has failed.

Run one clean download and verify #

  • Compile the OS on the ES and read the compilation result before transferring anything.
  • Keep Runtime, WinCC Explorer and the project closed on the target; one session, no second login.
  • Start one remote download through SIMATIC PC Station → Compile and Download and let it finish without a competing local or remote project operation.
  • Pass checks: the compiled computer assignment resolves to DESKTOP-BVUKCPK, User Administrator opens without a database connection error, and the log carries no CopyProjectRTOS_ failure.

One completed transfer leaves exactly one generated set on the target. If the CC_* count starts climbing again on the next download, the original blocker is back, and the inventory above finds it in minutes.

Questions asked

What does hr = 80004005 actually tell me?

It is the Windows generic failure value, meaning unspecified error. Every layer that fails without a more specific code returns it, so by itself it never tells you whether SQL Server was unreachable, the database was in RECOVERY_PENDING, the login context was wrong, or the DSN pointed at a database that no longer exists. Resolve it by testing the DSN target directly, from the same Windows account the transfer runs under.

Can I just delete the .mdf files from the project folder?

Not while SQL Server has the database attached; the SQL service holds the file handle and Windows refuses the delete. Deleting the file of a database that SQL still references is worse: the instance keeps metadata pointing at a file that no longer exists, and that resurfaces later as attach errors and RECOVERY_PENDING states. Drop or detach through the SQL administration layer first, then delete the files once SQL has released them.

Why did reset_wincc.vbs not fix it?

Because it ran on the wrong machine. reset_wincc.vbs resets WinCC state on the computer it runs on, and the blocked databases are attached to the SQL instance on the target OS, not on the ES. Repeating it on the ES cannot release a target-side attachment. It is still worth one run on the target after database cleanup to clear leftover WinCC processes before the download.

When is reinstalling justified?

After database-level cleanup, DSN removal and a full restart still leave the instance unusable, for example a database you must keep stuck in RECOVERY_PENDING with no good backup. A documented field resolution reinstalled SQL Server and then PCS 7 on the OS server, keeping WinCC from starting during the reinstall. Archive the project first: reinstalling the instance without an archive loses the only copy of the runtime data.

Does the missing .usr file or the empty GraCS\UserData folder mean the users are corrupt?

No. dir /s *.usr proves only that no loose .usr files exist on disk; it never reads the project database the transfer works on. User Administrator showing Administrator-Group → Administrator is positive evidence that the user data exists. Judge the users by whether User Administrator opens after cleanup without a database connection error, not by the contents of GraCS\UserData.

Keep reading

  • Troubleshooting

    EcoStruxure Operator Terminal Expert download fails to HMI

    A failed Operator Terminal Expert download has three separate causes: Windows firewall blocking the transfer executable, fixable with inbound and outbound allow rules scoped to EcoStruxure Operator Terminal Expert.exe; a VMware virtual USB controller that needs its compatibility set to USB 1.1; or a terminal still running Vijeo Designer firmware, which no Operator Terminal Expert project can load until a manufacturer recovery converts it. Match the fix to the runtime you read on the terminal.

    HMI and touchscreens

  • Troubleshooting

    Fixing an HMI Project That Fails After a Git Clone

    The clone is broken because a referenced bitmap .PLK was never committed, not because of an ignore rule. Read the HMI Output tab for the exact filename, prove the file is untracked with git check-ignore followed by git ls-files, then restore and commit it and re-test from a clean clone. Track the .tgt and .def files for the HMI BIOS version as well.

    HMI and touchscreens

  • Troubleshooting

    Fixing Invalid Bit Address Errors When Adding HMI Tags

    When the tag editor throws GUI-024: Invalid Address on a slash-form bit address like IO4/05 after a software upgrade, the fault is in the tag-entry dialog, not in the PLC point. Export the tag database, restore the full bit address in a spreadsheet, re-import, and verify the object against the intended output before the screen returns to service.

    HMI and touchscreens