• kapil_kk (7/1/2013)


    Hi,

    I have data file and log file at different location.

    data file at location:

    D:\Folder1\test.mdf

    while log file at place

    D:\folder2\test_log.ldf

    Now I want to move this log file to D\folder1\test_log.ldf

    How can I achieve this?

    I first detach the databse

    EXEC sp_detach_db @dbname = N'dump';

    Then move the data and logfile to new path

    after I run this script

    EXEC sp_attach_db @dbname = N'dump',

    @filename1 = N'D:\test\dump.mdf', @filename2 = N'D:\test\dump_log.ldf';

    GO

    But its gives me error:

    Unable to open the physical file "D:\test\dump.mdf". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)".

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/