Detached, can''t Re-Attach - "File in use by another process"

  • So I'm moving a bunch of DBs from one drive to another. Detached & re-attached about 20 without incident. I get to a small, lightly used one that detaches, but I can't move the file to the new drive because "It is being used by another person or program"

    So, I thought I'd attach it to it's original location, but get " .... it is being used by another process."  I skipped that for now and went on to the next DB ... no problem ....

    What's going on ?   No replication. Since it's detached, SQL can't be still using it, can it ??

  • Is any tape backup occuring?

  • USE master;GOEXEC sp_who 'active';GO
    If the process found this way should not run then kill it and detach the db, otherwise wait until the process is finished; there is also an option for closing all connections when detaching.
  • I don't know if any tape backups were running, but I doubt it's factor since other DBs on the same drive were fine. Good question though.

    There were no active connection on that DB.  There were some on other DBs that I cleared - those went fine.

    Thanks for the suggestions.

  • Yes, Dumb, but I've probably tripped over that before !!  🙂     In this case, I'm pretty sure I've got the right file.

    EDIT: My bad. I was mixing up different instances of SQL on the same server, so in effect, I did screw up the way you suggested.   D'OH !

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply