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

Contributor Icon Contributed by Rob Rogers  
Tag Icon Tagged: Database  

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.

 

12 Comments -


  1. Veronika said on October 3, 2008

    thx a lot :)

  2. foo said on December 16, 2008

    Thanks buddy, it really helped me. :)

  3. Walter Franco said on December 19, 2008

    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

  4. Mayur said on March 12, 2009

    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

  5. msolih said on June 5, 2009

    before attach, rename your LDF file first.

  6. Kopi said on August 24, 2009

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

  7. niranajn said on May 20, 2010

    good

  8. niranajn said on May 20, 2010

    excallent

  9. Shikhavalecha said on September 3, 2010

    thanks alot

  10. Karthika said on October 8, 2010

    i am new to sql, my bd is perfect now

  11. AusNetIT Solutions said on May 2, 2011

    Hi,

    Can we do this on SQL 2000?

    Thanks,

  12. mony said on November 10, 2011

    very good
    thanks

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -