Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 mdf files cleanup

Author  Topic 

Tonekene
Starting Member

6 Posts

Posted - 2014-09-04 : 12:42:51
hi
is there an easy way to find out if I have mdf and ldf files that don't belong to any db?

thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-09-04 : 12:46:57
You can use Process Explorer (separate download) to determine if the file is in use. If it's not in use, you can delete it. You can also try deleting each file. It'll error if it's in use by the SQL Server service or anything else.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-09-04 : 12:47:41
By the way, SQL Server cleans itself up if you drop a database that was not offline. If it was offline and you drop it, the files remain in place. If I am going to drop an offline database, I will bring it online first so that the file cleanup occurs.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Tonekene
Starting Member

6 Posts

Posted - 2014-09-04 : 12:49:34
Thank you for a quick response. we do take dbs offline and then delete so we have this issue.
Go to Top of Page

Shanky
Yak Posting Veteran

84 Posts

Posted - 2014-09-16 : 06:55:37
You can try copying it, if data and log file is being used it would give error

Hope this helps

Regards
Shanky
http://social.technet.microsoft.com/wiki/contents/articles/24253.list-of-articles-by-shanky.aspx
Go to Top of Page
   

- Advertisement -