SHRINK LOG FILES in SQL 7

  • Good Day fellow DBAs I would like to ask a question regarding shrinking a log file in MSSQL7. When I am using the command DBCC SHRINKFILE (' ) the command is executed successfully but the log size is not shrinked. Truncating the log seems to work its just the shrinking thats not. I'm currently using the script provided by Microsoft which can be found in their site. Another problem is that when a database has more than 1 log file (even if I am specifying what logfile to shrink) error occured

    "-=Still Learning=-"

    Lester Policarpio

  • Are you taking backups of the transaction log before you attempt to shrink? If the log file contains data or has not hit a checkpoint, then the file would not shrink using dbcc shrinkfile.

    I'd recommend running a manual log backup, and then run a shrinkfile. Note - even though you may specify a size for the log to shrink to, there is no guarantee you will see the file shrink immediately.

  • Thanks Clive I was also advised by my officer about transactions not comitted to the database that cause the shrink to fail I think a full backup then shrink will do the trick am I right?

    "-=Still Learning=-"

    Lester Policarpio

  • That will also work yes.

    If you are concerned about the growth of your log file, then you need to look at the frequency of your log backups.

  • Actually our servers do not backup log files. when i arrived at the company they are set to full recovery but not backing logfiles. We decided to change the recovery model from full to simple but prior to the recovery model alteration the logfiles are already in a huge state. This is why I need to shrink the logfiles then leave the job to the simple recovery to truncate the log files in the future

    "-=Still Learning=-"

    Lester Policarpio

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

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