2

SQL Server backups contain meta-data about the size of the original log (LDF) file.

So if you backup a database that has a 5GB LDF file, when you restore it, you will get an (empty) 5GB LDF file. This often isn't needed (because the log file of the restored database contains practically nothing)

Often this causes problems with database restores on busy dev servers with not much space left if people *cough* haven't been too careful about shrinking log files before making the backup.

Is there any way to restore a SQL Server backup but tell it "Dont bother making that empty 5GB LDF file, thanks" ?

Aaron Bertrand
  • 181,950
  • 28
  • 405
  • 624
codeulike
  • 121
  • 1
  • 4

3 Answers3

7

No, there is no way. Restores really is meant to recreate the original database that was backed up. There are tools that allow you to query directly a backup w/o actually restoring it (Idera's SQL Virtual Database) but those are horrendously slow.

Remus Rusanu
  • 52,054
  • 4
  • 96
  • 172
2

Simple answer, no. The database being restored must match the source database.

this is not the fix you seek (waives hand dramatically)

Cougar9000
  • 1,538
  • 1
  • 13
  • 29
-1

Well you might have to go through another step or two: restore on another server, shrink, backup, copy and restore. If you restore in simple recovery mode (or switch to simple recovery mode which can be done with the db online), the log database will be (or can be shrunk to) as small as it can get. You can then switch to full recovery when the finance department decides that the potential data loss cost is more expensive than the additional storage.... In SQL Server Management Studio, Rt mouse click on the database and select properties, then go to the options tab, second drop down list from the top. Then go to File sizes and shrink.... Wasn't even difficult, might be time consuming...

Aaron Bertrand
  • 181,950
  • 28
  • 405
  • 624
Ian P
  • 151
  • 2