I have a script which identifies MDF files which do not appear in my list of databases.
The purpose of this is to find databases, usually on development boxes, which have been detached and forgotten, but are taking up space on the disk. A detached database is of course invisible, unless you go poking around looking for it.
What I usually do is:
i) attach them again
ii) take a final backup just in case they actually are needed
(not very likely, but sod's law says if you don't do this, they will suddenly become critical)
iii) drop the thing
But today, I failed at the first hurdle:
Create file encountered operating system error 32
The process cannot access the file because it is being used by another process
SQL Server error 5123 tells me it's a problem attaching the database
Huh? It's a detached database file, isn't it?
What could possibly be using the detached file?
Some utter maniac renamed the .ldf file as .mdf
|GenDraft||1||F:\User Databases\GenDraft_20180925.mdf||PRIMARY||40960 KB||Unlimited||8192 KB||data only|
|GenDraft_log||2||G:\Logs\GenDraft_20180925.mdf||NULL||12352 KB||2147483648 KB||4096 KB||log only|
Post a Comment