Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 414
  • Last Modified:

Very Large LDF File

I have a database that has a 10gb LDF file.  I have tried shrinking it using dbcc shrinkfile which does not do anything to the file at all.

The recovery mode is set to full and we use windows backup to backup the databases to an external hard drive.

Any ideas on how to get this file smaller?

Thanks
0
TreeMaster
Asked:
TreeMaster
  • 3
  • 2
2 Solutions
 
Aneesh RetnakaranDatabase AdministratorCommented:
>Any ideas on how to get this file smaller?
You have to backup the database logs at regular intervals; dont stick with the windpws backup, you must create proper backup plans, full backup at least once /day or per week; regular log backups etc.

In order to shrink the file, change the recovery to simple do a log file shrink;
you also need to check the initial size of the log file, if it is set to 10gb, it wont shrink
0
 
TreeMasterAuthor Commented:
Would you recommend using  the SQLCMD via command line to do this?

sqlcmd -S.\SQLExpress -Q"BACKUP DATABASE dbName  TO DISK = 'path'"

I have been playing around with this and it seems to create a .bak file but if I run it again it will continue to add to the file.  Is there a way to make this a differential backup?
0
 
TreeMasterAuthor Commented:
I am using SQL Express if that helps
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
0
 
TreeMasterAuthor Commented:
Got it! thank you very much
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now