Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012

    Unanswered: unable to attach database

    hi i have a database wich is part of a project tha database worked fine
    i wanted to change the location of the mdf file to the application folder so i copied it to that folder but then i tried to attach it to the server using the management studio right click database select attach that opened the add dialog box with the tree to locate the mdf file but the tree does not expand into the application folder and i can't get to the mdf file
    so i tried to attach with attach command and i got the error message that access is denied error 5
    i checked the security settings in all files and parent folders and everything seems ok

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    As a general rule of thumb, it is "bad karma" to store MDF files anwhere other than with the server's primary store of MDF files... Having the MDF files scattered all over your filesystem makles it difficult to protect and manage them.

    If you wish to fight for your right to cause yourself ongoing pain, we can accomdate that desire!

    Check to see what Windows (or possibly Active Directory) account is running your instance of SQL Server. If you aren't sure how to do that, I can give you detailed directions.

    Use SSMS to see where the disconnect happens when looking for your MDF file in its present location. You can probably see the drive, and one or more folders, but not all the way down to the MDF file itself.

    Once you know what Windows user needs permission and where in the folder heirarchy the existing permissions peter out, you can then use Windows Explorer to grant the needed permissions for the Windows User the runs SQL Server.

    Before I go, let me emphasize that this is a really bad idea. Only pursue this idea if you are really intent on causing long term problems while you use this database.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts