Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I just right-click deleted all my databases that were not in use. However all the MDF and LDF files are still in the data folder on the machine. What is the best way to determine what MDF and LDF files I can remove since the database no longer exists in SSMS.

Also is this the best way to delete unused databases? (The right-click -> Delete method.)

assuming sql server's still running, any mdf/ldf which corresponds to a "live" database would be in use and would not let you delete it.
–
Marc BNov 29 '12 at 21:23

Norla, I was unaware of that option. Thank you for pointing that out to me. I updated my past questions. Most answers are answered through these comments though so I cannot accept them.
–
Cole MietznerNov 29 '12 at 21:34

1 Answer
1

The Best way to delete databases in sql server is using DROP DATABASE command .
If you right click and delete in SSMS you will end up with files left in folder .

Then You have to manually remove the files from server folder .

To remove these files from folder , first bring sql server to online then go the folder and start deleting the files , when deleting mdf or ldf files you will get error like files in use means that database you are using and you can remove remaining .