SQL Server 2005: How to Attach (or Reattach) a Database Missing the LDF

If you need to attach a database that has no log file (.LDF), or have deleted the log file because it was too big and need to reattach the database, SQL Server 2005 does allow you to do this. You can attach the database by following this Tech-Recipe:


1. Open the SQL Server Management Studio and connect to the desired server.

2. Right-click on Databases and select Attach.

3. Click the Add button and select the database file to be attached.

4. Under database details, select the .LDF file and click the Remove button.

5. Click OK.

The database will be attached with a new logfile.

 

About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.

12 Responses to “SQL Server 2005: How to Attach (or Reattach) a Database Missing the LDF”

  1. October 03, 2008 at 7:23 pm, Veronika said:

    thx a lot :)

    Reply

  2. December 16, 2008 at 3:01 pm, foo said:

    Thanks buddy, it really helped me. :)

    Reply

  3. December 19, 2008 at 8:54 pm, Walter Franco said:

    Hi,
    I did exactly like this last month, but my database doesn´t update the log file, it stays at the same old date when i attached and only update if i restart the SQL services. Is that “normal” or I missed something?
    Txs for any help!

    Walter Franco
    Poços de Caldas – MG
    Brasil

    Reply

    • June 05, 2009 at 2:10 am, msolih said:

      before attach, rename your LDF file first.

      Reply

  4. March 12, 2009 at 4:32 pm, Mayur said:

    Hello
    i have one problem
    plz give me solution

    i want to attach script to the database of the microsoft sqlserver 2005 databse
    plz give me suggetion about this topic
    what to do for that

    thnkyu in advance

    Reply

  5. August 24, 2009 at 7:19 am, Kopi said:

    eey dawg u on point, hommie, nearly died of a heart attack, u a great deal dawg, kip it real!!!!

    Reply

  6. May 20, 2010 at 9:34 am, niranajn said:

    good

    Reply

  7. May 20, 2010 at 9:34 am, niranajn said:

    excallent

    Reply

  8. September 03, 2010 at 6:06 am, Shikhavalecha said:

    thanks alot

    Reply

  9. October 08, 2010 at 5:41 pm, Karthika said:

    i am new to sql, my bd is perfect now

    Reply

  10. May 02, 2011 at 1:58 am, AusNetIT Solutions said:

    Hi,

    Can we do this on SQL 2000?

    Thanks,

    Reply

  11. November 10, 2011 at 5:02 pm, mony said:

    very good
    thanks

    Reply

Leave a Reply

You may also like-

SQL Server 2005: The Copy Database WizardThe Copy Database Wizard is a very valuable asset when you are wanting to copy or move a database and its objects to another ...