0

I has a desktop program which uses MS sql LocalDb 2022. I realized when this program is running then SSMS 20.1 can not access the corresponding db.

use DbName

causes

"Operating system error 32: "32(The process cannot access the file because it is being used by another process.)"

The mdf file can not be accessed. I checked on an other machine and there was no problem there. I reinstalled the LocalDb and the ssms but it did not fix the problem. Any idea?

3

1 Answer 1

0

Recreating the the local db instance helped me.

cd "c:\Program Files\Microsoft SQL Server\160\Tools\Binn" 
SqlLocalDB delete MSSQLLocalDB
            - you may have to kill sqlserver.exe in task manager to succeed
SqlLocalDB create MSSQLLocalDB
SqlLocalDB start MSSQLLocalDB
            - you have to reattach all the db in ssms           

It is strange that reinstalling the localDB did contain this.

Not the answer you're looking for? Browse other questions tagged or ask your own question.