Issues Attaching MdxStepByStep.mdf

  • I am trying to install MdxStepByStep database to my Server(SQL Server 2008)

    Authentication: Windows

    Logged in as Administrator.

    Owner of the database is set to be Administrator.

    On executing the query below,

    " exec master..sp_attach_db

    'MdxStepByStep',

    'C:\Microsoft Press\MDX SBS\Setup\SQL Server\MdxStepByStep.mdf' "

    I get the error;

    "Directory lookup for the file "C:\Microsoft Press\MDX SBS\Setup\SQL Server\MdxStepByStep.mdf" failed with the operating system error 5(Access is denied.)"

    I checked the permission and security of both .mdf and .ldf and the Administrator has Full Control.

    Is there anything else i have to modify to give access to the database?

    Thanks for your time!

  • I need operating system including editions and SQL Server 2008 edition and platform so I can help you.

    Kind regards,
    Gift Peddie

  • Thanks for the quick reply,

    SQL Server 2008: Microsoft SQL Server Standard Edition

    OS: Windows Server 2003

    Platform: NT INTEL X86

    Hope that sheds more light.

  • What about permissions on the directory?

  • Swetha Sankaran (9/1/2009)


    Thanks for the quick reply,

    SQL Server 2008: Microsoft SQL Server Standard Edition

    OS: Windows Server 2003

    Platform: NT INTEL X86

    Hope that sheds more light.

    Then go to the Microsoft SQL Server folder in programs then go to the Data subfolder and add your MDF and LDF file there, then go to SMS and right click and tasks and attach navigate to the MDF and LDF in SQL Server folder and attach the files.

    Kind regards,
    Gift Peddie

  • C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\Data

    Right click->Properties->Security

    Lists,

    Administrators

    Creator Owner

    System

    Administrator: Full Control

    System: Full Control

    Creator Owner: Full Control cannot be selected. The selection is lost on click of apply.

    I moved the .mdf and .ldf to the above directory as I could not select the .mdf from Microsoft Press folder.

  • Did that and the issue still persists.

  • You are attaching it in the wrong folder and I did not tell you to right click on the file right click in Management Studio and task and then attach.

    Make sure you did not remove everybody from the folder because SQL Server is also a member of that default group. You also need to make sure SQL Server is running with an account with the correct permissions and not network service account in configuration manager.

    Kind regards,
    Gift Peddie

  • " right click in Management Studio and task and then attach."

    Sorry if my previous post was confusing, I tried to attach the database from my SSMS after copying the .mdf and .ldf to C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\DATA

    The attachment fails with error,

    "Log file 'C:\Microsoft Press\MDX SBS\Setup\SQL Server\MdxStepByStep_log.LDF' does not match the primary file. It may be from a different database or the log may have been rebuilt previously."

    "You also need to make sure SQL Server is running with an account with the correct permissions and not network service account in configuration manager"

    Also verified that SQL Server is running with correct permissions.

    Atleast its showing a different error now than before. Not sure if it is improvement 🙂

  • I got this from BING you need to delete the original folder.

    http://support.microsoft.com/kb/970767

    Kind regards,
    Gift Peddie

  • Nice, I also had to delete the .ldf from C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\DATA

    Executing:

    exec master..sp_attach_db

    'MdxStepByStep',

    'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\DATA\MdxStepByStep.mdf'

    Created the database with its .ldf

    All is well in MdxStepByStep database now.

    Thanks Gift for your help.

  • exec master..sp_attach_db

    'MdxStepByStep',

    'C:\Microsoft Press\MDX SBS\Setup\SQL Server\MdxStepByStep.mdf'

    When i exeucte above query facing with the following error message.

    Msg 5173, Level 16, State 1, Line 1

    One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.

    Log file 'C:\Microsoft Press\MDX SBS\Setup\SQL Server\MdxStepByStep_log.LDF' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.

    Msg 1813, Level 16, State 2, Line 1

    Could not open new database 'MdxStepByStep'. CREATE DATABASE is aborted.

    Can anyone let me know the solution for this?

  • Executing:

    exec master..sp_attach_db

    'MdxStepByStep',

    'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\DATA\MdxStepByStep.mdf'

    exec master..sp_attach_db

    'MdxStepByStep',

    'C:\Microsoft Press\MDX SBS\Setup\SQL Server\MdxStepByStep.mdf'

    There is a difference between the code that worked and yours so delete your current code read all my posts in this thread so you can locate the Data subfolder in Microsoft SQL Server and add your MDF file before executing the code.

    Kind regards,
    Gift Peddie

  • the link has the correct solution- delete the original ldf log FILE (not the folder). the folder contains other files 🙂

  • Hi, I found that after an install the permissions in the MDX SBS folder and below were not set to inherit same permissions as the parent Microsoft Press. Changing this so that all sub folders below Microsoft Press had the same permissions (read for Users), it allowed me to run the attach_db script (I also deleted the log file to make doubly sure).

    Hope this helps someone!

Viewing 15 posts - 1 through 15 (of 16 total)

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