0X00000884: Service Database Locked — The Real Fix
That 'service database is locked' error means something else is holding the registry open. Here's how to kill it and stop it from coming back.
Yeah, getting 0X00000884 when you're just trying to restart a service or change a startup type is annoying. The system's telling you “The service database is locked.” That doesn't mean your disk is full or corrupted — it means the Windows Service Control Manager (SCM) has an exclusive write lock on the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, and some other process is still holding it open.
The One Fix That Actually Works
- Download Handle from Sysinternals. It's a 200KB command-line tool — no install, just unzip.
- Open an elevated Command Prompt (right-click CMD, Run as Administrator).
- Run this command:
This lists every handle that anyhandle -a -p svchost.exe | findstr /i "services"svchost.exeinstance has open to anything with “services” in the path. The SCM runs inside its own svchost, but other svchost processes can also grab handles if they're misbehaving. - Look for output like:
The key part is the PID (1234 in this example) and the handle value (0xABC).svchost.exe pid: 1234 type: File 0xABC \REGISTRY\MACHINE\SYSTEM\CurrentControlSet\Services\YourBrokenService - Close that handle with:
Thehandle -c 0xABC -p 1234 -y-yskips the confirmation prompt. If the handle closes without error, try restartingservices.mscor running your original operation again. - If that doesn't work, or you get “Access Denied”, the process holding the lock is deeper inside the SCM itself. In that case, just kill the svchost hosting the SCM — but you can't kill it directly. Instead, identify which svchost instance runs the SCM (usually the one with the most services), then run:
...but this will crash all services in that host. So do this only if you're stuck and can reboot after. It's a last-resort move.taskkill /f /pid 1234
Why Step 5 Actually Works
What's happening here is that a handle to a registry key is a reference-counted object in the kernel. When a service starts or stops, the SCM opens a key under Services with write access, does its thing, then closes it. If that close never happens — due to a buggy driver, a misbehaving service, or a process that crashed while holding the handle — the SCM's internal lock on that key never releases. The error code 0X00000884 maps to ERROR_SERVICE_DATABASE_LOCKED, which literally means the SCM can't get exclusive access to the registry path for service configuration.
The reason step 3 uses -a is that handles to registry keys aren't file handles — they're key handles. The -a flag tells Handle to show all handle types, including registry keys. Without it, you'd only see file handles and miss the culprit.
When you close the handle with -c, you're telling the kernel to decrement the reference count on that registry key. If it hits zero, the SCM's lock is released. Simple, direct, no reboot needed.
Less Common Variants That Look the Same
1. Antivirus Hooking the Registry
Some AV products (looking at you, older McAfee and Symantec) inject a filter driver that intercepts registry calls. They can hold handles open indefinitely during a scan. If you're on a corporate machine with managed AV, try temporarily disabling real-time scanning — don't uninstall, just pause it for 30 seconds. If the error goes away, you've found the culprit. Document it for your IT team.
2. Corrupted Service Subkey
If a service entry under Services has invalid data (like a missing ImagePath value), the SCM can get stuck trying to load it and never release the lock. You'll know this is the case if Handle shows the lock on a specific service name, not just the root key. The fix here is to export that service key, delete it, reboot, then import it back. But be careful — deleting a system service key can break things. Only do this for third-party services you recognize.
3. Windows 10 1809 to 1903 Bug
There was a known issue in those builds where the WSearch (Windows Search) service would leak a handle to the Services key during indexing. If you're on an old build, the fix is either updating Windows or disabling Windows Search entirely. It's not a permanent solution, but it stops the lock.
Prevention: Stop It From Coming Back
There's no magic registry tweak to prevent handle leaks. The real prevention is:
- Keep Windows updated. Microsoft patches handle leaks in cumulative updates. The WSearch bug, for example, was fixed in KB4505903.
- Audit your third-party services. If you see the same service name in the handle dump every time, that service's code has a bug. Check the vendor's site for an update, or consider replacing it.
- Use
sc queryinstead ofservices.mscfor one-off changes. The MMC snap-in opens and closes many handles; runningsc stop YourServicefrom the command line is less likely to trigger a race condition with a locked database.
Most people never see this error. If you're seeing it regularly, something on that machine is misbehaving. The Handle trick gets you out of the jam fast, but tracking down the root cause — a buggy service or an old AV — is what prevents the next lock.
Was this solution helpful?