Can't rename database files after detaching database

  • I wanted to rename my database files, so I detached the database. However when I try to rename them I get the "file in use" error message from windows. Is there a step I missed? Maybe I just have to wait a bit for SQL Server to release the files?

    Edit: This is SQL 2000

  • The only thing I can think of on this is that you did not detach the right database. SQL releases the files on detach, and the OS does not usually lock the file because SQL had control of it. I would look through sysdatabases and sysfiles for each database to ensure that these files are not being used by SQL.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • Thanks for the response. I'm sure I detached the correct database because I eventually reattached it using the same files (then just did backup/restore to move it). Next time this happens though I'll be sure to check sysdatabses as you suggested.

Viewing 3 posts - 1 through 2 (of 2 total)

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