Detaching database from a failed machine

  • Hello all,

    First time I ever came across this issue so I'm not sure how to handle. I have a laptop which has SQLEXPRESS 2005 installed and 4 or 5 SQL databases created on that machine. The screen on the laptop went out. Since the harddrive is still good I need to retrieve the .mdf and .ldf files from the laptop. I can get to the directory where the files are located on the laptop. The problem is they are technically still attached the SQLEXPRESS on that machine. If I could detach them, I know I can copy them to another machine and re attach them on that machine. Problem is because the screen went out I can't detach them.

    So my question is: how do I detach a database if I can't use that computer to do so?

    Thanks,

    Strick

  • If SQL is down on that laptop you can just copy the the files via CIFS as they will not be locked.

    Else if you can connect to SQL on the machine using client tools from another machine you can issue the instruction to detach tham.

    ---------------------------------------------------------------------

  • That should definately work, but just in case, here's a couple more alternatives:

    1. Shut down the service from another computer, then copy files.

    OR

    2. Most laptops allow you to redirect the output to a secondary monitor, either another monitor or a projector. Connect your laptop to a secondary monitor and use client tools on laptop.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Hi all thanks for your response. Just to add, when I mentioned the screen went out, its the graphics card. So using a projector or monitor won't work since I believe it's still using the graphics card.

    Also how would I go about connecting to SQL Express DB using client tools on another machine since sqlexpress databases on laptop use windows authentication? The other machine wouldn't have rights to detach I'd imagine.

    Lastly can you shed a little light on copying using CIFS? What is CIFS

    Thanks!

    Strick

  • Since you only want the mdf/ldf files - I would not worry about trying to access SQL Server. You can use WMI from either VBScript or Powershell - shut down the SQL Express service and copy the files.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • stricknyn (1/9/2009)


    Hi all thanks for your response. Just to add, when I mentioned the screen went out, its the graphics card. So using a projector or monitor won't work since I believe it's still using the graphics card.

    Also how would I go about connecting to SQL Express DB using client tools on another machine since sqlexpress databases on laptop use windows authentication? The other machine wouldn't have rights to detach I'd imagine.

    Lastly can you shed a little light on copying using CIFS? What is CIFS

    Thanks!

    Strick

    sorry by CIFS I mean good old windows explorer copy and paste. You did say you could get to the directory where the files are

    Do you connect this laptop up to a network at work? If so you can register the SQLExpress edition via SSMS on another machine. Presumably your windows account has access to this SQLExpress edition with enough rights to detach, so if you register using windows authentication it will attempt to connect with the acount you are logged onto the local machine with. Are you sure you cannot register the SQLexpress edition using the sa account?

    Got a spare graphics card? 🙂

    ---------------------------------------------------------------------

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

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