thanks for your replies guys... and I do just shrink it using the command I got from my DBA (me) but it just erks me that it would create a 1.6gig file without having the actual logs.

the reason i'm guessing it has 1.6gig of transactions as its probably been imported from a database that was 500meg and did have a 1.6gig log file...

On 23/04/2012 2:45 PM, Ken Schaefer wrote:

Or just detach the existing MDF. Delete the log file. Reattach the MDF -- a new, blank LDF file should be created.

That said, I'm puzzled how restoring a 40MB MDF file could generate 1.6GB of transactions...

Cheers

Ken

*From:*ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] *On Behalf Of *djones...@gmail.com
*Sent:* Monday, 23 April 2012 2:32 PM
*To:* ozDotNet
*Subject:* Re: [OT] the magic of LDF


That's the log file, you don't need it.

Delete the new database, create a new empty database with exactly the same name and filenames, take it off line. now copy the mdf in place of the newly created databases mdf. And put the db back online. You should have a working db without the massive logfile you get from restoring from a backup.

Only do this if your working on a dev machine though. let a dba worry about shrinking the log file after a restore ;-)

Davy

Hexed into a portable ouija board.

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

*From: *Wallace Turner <wallacetur...@gmail.com <mailto:wallacetur...@gmail.com>>

*Sender: *ozdotnet-boun...@ozdotnet.com <mailto:ozdotnet-boun...@ozdotnet.com>

*Date: *Mon, 23 Apr 2012 13:22:09 +0800

*To: *ozDotNet<ozdotnet@ozdotnet.com <mailto:ozdotnet@ozdotnet.com>>

*ReplyTo: *ozDotNet <ozdotnet@ozdotnet.com <mailto:ozdotnet@ozdotnet.com>>

*Subject: *[OT] the magic of LDF

I have an SQL 2008 express database that when backed up produces a BAK file of 44 Meg, zips to just under 4Meg.

When restoring the database on another machine the resulting mdf is 40 meg (good) and the ldf is 1.6 *Gb*!

Yes, i know I can shrink the ldf and also disable the LDF (SET RECOVERY SIMPLE) but how on earth does it decide to create an LDF that is as large as the original but clearly doesnt have the contents of the original (unless I have unearthed the worlds most fantastic compression secret)

Wal

Reply via email to