question

Darrell avatar image
Darrell asked

Deleting data files while database is online (.mdf, .ldf )

I realise that an OS level lock is put on the data files themselves while they are in use, however I was wondering if there are any conditions in which a database is not offline/detached in which these files can be moved or deleted?

The reasoning behind this is whether it is a safe enough assumption to assume that you don't need to worry about deleting a live database at the file level due to the implied lock.

Thanks!

deletedatafiles
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Rob Farley avatar image
Rob Farley answered

You may find times when the files aren't locked, and I wouldn't consider it a safe assumption. I've never looked hard enough to find out when those times are, but I'm sure I've been able to touch those files occasionally.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.