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

Contributor Icon Contributed by shamanstears Date Icon November 20, 2006  
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.

Previous recipe | Next recipe |
 
  • Veronika
    thx a lot :)
  • foo
    Thanks buddy, it really helped me. :)
  • Walter Franco
    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
  • msolih
    before attach, rename your LDF file first.
  • Mayur
    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
  • Kopi
    eey dawg u on point, hommie, nearly died of a heart attack, u a great deal dawg, kip it real!!!!
blog comments powered by Disqus