Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to rebuild a ldf file

Status
Not open for further replies.

Siilver

IS-IT--Management
Dec 2, 2002
69
CA
We did a mistake yesterday. I was ask to provide a copy of our database from last week. We copied the mdf file and not the ldf file! I did my restore from last week backup but it copied over my ldf file. So my question is,

Is there a way to rebuild the ldf file from my mdf file?

thanks
 
Since you have the mdf, just attach the database with attach single file. It Should work.

EXEC sp_attach_single_file_db @dbname = 'pubs',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

 
Are you trying to reattach the database without an .ldf file? - if so, just follow Corran007's suggestion.


Or are you trying to 'get back' the .ldf that you overwrote? - if this is what you are trying to do, you are out of luck. There isn't any way to 'get back' the .ldf from the .mdf.

-SQLBill

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top