Changing default directory for data

  • Hello all,

    I have a test box with 2 OS installed  WIN2K installed on drive D:\ and WIN2K3 on C:\

    I am trying to test a deploy application and have hit a snag.

    I am Copying an MDF file to  d:\program files\MIcrosoft SQL Server\MSSQL\data\

    Then I Run

    EXEC sp_attach_single_file_db @dbname = 'rex',

       @physname = 'd:\Program Files\Microsoft SQL Server\MSSQL\Data\rex_Data.mdf'

    and i get the following error

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

    Device activation error. The physical file name 'C:\PROGRAM FILES\Microsoft SQL Server\MSSQL\Data\REX_Log.ldf' may be incorrect.

    Obviousely it is trying to create the LDF in the wrong drive and directory, I have created a new database from this SQL server with EM and it creates both the MDF and LDF files in the D:\ address. 

    any ideas?  I have never tested seperate OS and SQL servers on same box before so I am stumped

     

    Thanks in advance

     

    t

     


    Kindest Regards,

    Tal Mcmahon

  • excuse me while I hang my head in shame,

    just a note for everyone out there.........

    MAKE SURE YOU DETACH THE DATABASE!!!!

    Thank you,

    my self flagellation has ceased

     

     


    Kindest Regards,

    Tal Mcmahon

  • Thanks for the followup

  • Yeah I hate posts that end with ...."Nevermind I Got it"

     

    t


    Kindest Regards,

    Tal Mcmahon

  • by the way remove the ldf file of its place and the SQL Server will make a new one for you.

    or you can copy both Ldf and MDF and attach them together

    I hoppe this help u


    Alamir Mohamed
    Alamir_mohamed@yahoo.com

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

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