6
votes

I deleted the localdb instance files which were located in

"C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0"

by accident. The system cannot start the localdb instance now. The way that I know how to fix the issue is to delete the instance by command

"sqllocaldb delete instancename"

, and re-create the instance again. But I found this approach could only work for user account if I deleted the instances files located in

"C:\Users\UserName\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0"

So how can I solve this problem to delete the db instance owned by System?

3
i think this should be migrated to .. dba.stackexchange.com - Dhaval

3 Answers

6
votes

Get PsExec from here: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Run cmd.exe as LocalSystem as demonstrated in this link: How do you run CMD.exe under the Local System Account? psexec -i -s cmd.exe

Now you can run SqlLocalDb stop InstanceName and SqlLocalDb delete InstanceName

0
votes

Have you tried deleting the folder as well? I think the instance should be discovered as deleted if this folder is gone, and it should be recreated. (not 100% sure though; definitely back it up before deleting).

"C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0"
0
votes

You can fix the issue by copying the files you deleted from other machine. Please make sure that you copy from other machine's "C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0".

I'm not sure how to delete the db instance owned by System for now.