Database is being used by another process … but what process?

后端 未结 10 1673

I have written a very small C# program, that uses a very small SQL Server database, purely for some learning & testing purposes. The database is used in this one new pro

10条回答
  •  [愿得一人]
    2021-01-06 00:39

    Try using Process Explorer written by Mark Russinovich, a Technical Fellow at Microsoft. It's a standard swiss-army tool in the pocket of Windows Admins/Developers. It can show you what processes are holding handles on resources in the system.

    Once you've got Process Explorer installed, try the following:

    1. Get your system into a fail-state (such that running your program doesn't work).
    2. Start up Process Explorer (you'll need to be an Admin to make full-use of its features).
    3. Click "Find" in the menu bar at the top and type in the name of your .mdf or .ldf files.

    The search results should display a process/service with a handle on one of the resources still held by a wrongly-terminated process.

提交回复
热议问题