Can't attach MDF and LDF files

  • Hi All

    When I tried to attach my mdf and ldf file , I got error saying " The process cannot access the file because it is being used by another process.

    How do I solve this issue ?

    Your feedback is much appreciated.

     

  • Find the process which has the files locked.

    Use something like handle.exe from the sysinternals suite of applications to find what application has hold of the files.

    Then try again.

  • Almost sounds like they may be already attached.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey wrote:

    Almost sounds like they may be already attached.

    +1000 Either that OF he has an explorer window open and maybe has even clicked on one of the files OR he hasn't yet closed the window that he did the copy with.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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