Offline database is very interesting subject, and there are a couple of interesting details associated with it, which one must know.

There are two common queries related to offline database:
1) My hard drive is getting full and I deleted my ‘offline’ databases. After deleting my offline databases, my hard drive is still full and there is no empty space.
2) I recently deleted the ‘offline’ database, and now, when I am attempting to create database with the same name, it is giving me error that the database file already exists.
I can see why these questions are coming up frequently. The common understanding that seems to prevail is that when any database is deleted, files associated with the database (.mdf, .ndf and .ldf) are deleted automatically. This is true for any database that is an ‘online’ database. However, the behavior is bit different in the case of the ‘offline’ database. When any ‘offline’ database is deleted, files associated with the database are not deleted automatically. All the files related to the ‘offline’ database need to be deleted manually after deleting the offline database.
Reference: Pinal Dave (http://blog.SQLAuthority.com)












Interesting fact..just wanted to why it is designed like that?
Nice explanation… and definitely its a new knowledge for me..
Thanks & Regards
Nikhildas
Once my manger asked me to delete offline database’s to free the space…..but target was not achieved…..now i understand why i wasn’t successful…Thanks…
Nice .. simple article.. Thanks Pinal Dave.
That problem happen to me a lot when the database is restoring and I drop the database because a restore failure.
I have faced the same problem. Now after reading your post i know the reason.
Thanks Sir
Can you please explain a bit further as to what are those files. I have made a sample program where I am attempting to create a new database using C#. Routine involves checking if file exists, and deleting the file if that is true, thereafter it attempts to create the database again. Interestingly the routine succeeds on its first attempt but fails when I try using the same database again, even though the database files have been deleted.
[...] Error: Deleting Offline Database and Creating the Same Name This is very interesting because once a user deletes the offline database the MDF and LDF file still exists and if the user attempts to create a new database with the same name it will give error. I found this very interesting and the blog explains the concept very quickly. Have you ever faced a similar situation? [...]
Interesting Topic…Thanks pinal