This is the strangest thing ever. My company's product uses a database file with Microsoft SQL Server 2008 R2, let's just say it's named myDB.mdf
. I want to delete that file and replace it with a same-named database from another system. So I try to delete it, and of course I can't because it's in use by some process. I reboot specifically to ensure that nothing's still running that has that file open, and I still can't delete it (same reason). I fire up Sysinternals ProcessExplorer and Find->Find Handle or DLL and enter the filename. The process that has it open is named 'System' and has a PID of 4. So I go to Control Panel -> Programs and Features and one-by-one, uninstall all of the components of Microsoft SQL Server 2008 R2. Still can't delete it. Oh, I have MS SQL Server 2012 installed... maybe that's it. Uninstall all components of that. And some other SQL thing from Microsoft, uninstall that too. Still can't delete it. Reboot. Don't open ANYTHING, and still can't delete it. It gives the error "File In Use: The action can't be completed because the file is open in System. Close the file and try again. [Try Again] [Cancel]". I opened up Control Panel -> Programs and Features again, and confirmed that there are no remaining SQL-ish things. And the file's icon is now a white sheet of paper with the top right edge folded over (i.e. it has no file association).
Any idea how I can make 'System' not open the file so I can delete it?