## TL;DR
The Windows Update database is the local datastore that tracks update metadata, history, and state - when it corrupts after a failed cumulative update, scans and installs behave erratically even though the component store may be fine. Rebuild it: stop the update services, rename the SoftwareDistribution folder including the datastore, restart services, and rescan for a full rebuild. Then retry the cumulative update and check DISM separately only if servicing errors also appear.

```text
windows update database corruption detected after failed cumulative update
```

## Use this when
- Windows reports update database corruption detected, or a troubleshooter fixes update database corruption repeatedly.
- Update history is blank, wrong, or scans fail inconsistently after a cumulative update failed or was interrupted.
- The datastore log entries in WindowsUpdate.log show database errors at scan time.

## Not for this skill when
- DISM reports component store corruption with 0x80073712 or similar. That store is repaired with DISM, not by rebuilding the update database.
- A WSUS server database is corrupt. That is server-side SUSDB maintenance, a different procedure.

## Steps
1. Separate the two databases first so you fix the right one: run DISM CheckHealth for the component store and note the result, and record the exact wording of the database corruption message and where it appeared. If DISM is healthy and the message is about the update database, proceed with the datastore rebuild and do not run store repairs you do not need. Verify: you have a DISM health result and confirmation that the corrupt database in question is the update datastore
2. Stop Windows Update, BITS, and Cryptographic services from an elevated terminal and confirm they are stopped. The datastore files live under the SoftwareDistribution folder and are locked while these services run, so this order matters for a clean rebuild. Verify: all three services report stopped and remain stopped
3. Rename the whole SoftwareDistribution folder to a backup name, which preserves the old datastore and history for reference while forcing a complete rebuild. If a subfolder refuses to rename because a file is in use, restart the machine and rename it before update services start their first scan, rather than deleting files piecemeal. Verify: the old folder is renamed intact and no partial deletion has mixed old and new datastore files
4. Restart the services and run a full Check for updates. The first scan rebuilds the datastore from the update source, so it takes longer and update history will initially look empty - that is expected after a rebuild and is not data loss of installed updates, which are still recorded in installed updates. Verify: a new SoftwareDistribution folder and datastore are created and the scan completes with a coherent offer list
5. Install the cumulative update that originally failed, restart as requested, and run one more scan to confirm normal operation. Review installed updates to confirm the cumulative update is present, since the rebuilt history view may present the record differently than before. Verify: the cumulative update shows as installed, a follow-up scan completes cleanly, and no new corruption message appears

## Why it happens
The update datastore is a working database, not a static file: every scan, download, and install writes state into it, often during the most fragile moments of servicing. A cumulative update that fails mid-transaction, a power loss, or a forced shutdown during install can leave its records half written, and subsequent operations then trip over inconsistent state that the client reports as database corruption. Rebuilding works because the datastore is a cache of server-side truth - everything in it can be re-derived from the update source and the actual installed state of the machine, so a clean rebuild loses nothing except the convenience copy of history.

## Variants and edge cases
### Database corruption message returns after every rebuild
Something is corrupting the new database too. Check disk health and storage errors first, then review security software that intercepts writes in the Windows folder.

### Corruption after restoring the machine from backup
Backup tools that capture the datastore mid-write can restore an inconsistent copy. Rebuild the datastore after any bare restore before judging update health.

### Troubleshooter says fixed but the same failure continues
Troubleshooter fixes are often just a datastore rename. If you already rebuilt, move on to the DISM and CBS evidence rather than looping the troubleshooter.

Compatibility: Applies to Windows 10, Windows 11, and Windows Server 2016 and later. Datastore rebuilds need administrator rights.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_JZbmatKIy-vlvNt6FvU3Aw
