Shrinking Log file.

  • In my prod database 'log_1' file is 161GB with only 5% space used. Can I

    take logbackup

    Dbcc shrinkfile (log_1, 0)

    take another backup ?

    Will this make some space on logfile drive? or do I have to change recovery model to simple?

    What is the best way (steps) to shrink log file in Prod environment?

  • You can just run the shrink operation on the file.

    But, the bigger question is, what caused the log to get so big? Was it a one-time event that's not going to repeat? Then shrink the file. Or, is this file continually growing to this size? If so, you'll probably better off leaving it at that size until you mitigate the reasons for the file growth.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thank you for the reply. I was trying to save space in the disk. when I ran sqlperf (logspace) i saw log space used only 5%. but size was 150+ GB. when I ran shrinkfile (log), it showed logfile size reduced to less thann 100GB and sqlperf (logsapace) shows its 50% space used!!! should i be concern or it's just fine since gain some storage.

    I didn't change full to simple recovery model.

  • OK. Sounds fine. But, you still don't know why the log was that big. Maybe there are load processes or something that require that level of log space. You may see it grow back again.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply