Receiving "Error Renaming File or Folder" when attempting to rename .MDB and .LDB of a detached database

  • We have 2 SQL2008 databases whose file names do not match the names of the database and we would like to change the name of the file names to match that of their database.

    I have detached the database, but even after detaching it, I get the error "Error Renaming File or Folder" when attempting to rename xxx.MDB and xxx.LDB to abc.MDB and abc.LDB from Windows Explorer. The files reside on a Windows Server 2003 R2 server. Computer Management on the server does not show the files to be open.

    I am logged in with administrative rights and the files are not marked read-only. I can create/rename/delete other files in the same folder.

    Can anyone tell me how I can rename the database files (or why the system thinks they are in use?)

    Thanks!

    Cheryl

  • Usually, when an .LDB file is still around, the Access database was not closed properly. Standard way of fixing the problem is to delete the LDB file and then try opening the file in Access. If that works, then try renaming the MDB file. Don't do anything with the LDB file. Access should handle that itself.

  • Thanks for your reply, but this is a SQL2008 database, not an Access database, so the .LDB would normally exist.

    Cheryl

  • CherylNH (10/31/2011)


    Thanks for your reply, but this is a SQL2008 database, not an Access database, so the .LDB would normally exist.

    Cheryl

    Brings up an interesting question: why are the extensions MDB and LDB and not MDF and LDF?

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • Win 2008R2 ... Do you have the needed windows authority to rename files ?

    (one of the security changes with win2008R2 en SQL008(r2))

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • You are absolutely correct! They are mdf/ldf. My bad.

  • use the alter database command (see BOL).

    If you are renaming the PHYSICAL file name you will need to

    offline database (also an alter database command)

    run alter database command modify file command

    rename the actual file in windows

    online the database

    there is no need to detach the database.

    It is wise to back the database up first

    Other than suffixing files with mdf and ldf though, it does not really matter what they are called.

    ---------------------------------------------------------------------

  • Thanks so much George. I appreciate your taking the time to answer such a simple question.

    Cheryl

  • ..and thank you for the feedback.

    ---------------------------------------------------------------------

  • i've had trouble like this before, it was down to permissions, detaching a database usually in single user mode locks the files to the user who detached it, so trying to log on to the server and modify/copy the files as a different account results in permission denied.

    this got very annoying as we had multiple sub domains in the same forest but our client machines all where in the same sub domain, so if we where in client and server domain all was good but as soon as we went to a different part of the domain, always had to remember to use the client domain NT login to do what we wanted, either that or log on to the server, detach the DB, do what was needed, attach the DB

Viewing 10 posts - 1 through 9 (of 9 total)

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