|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, February 14, 2011 7:42 AM
Points: 360,
Visits: 188
|
|
Hi folks, What would be the fastest way to shrink the transaction logs in SQL 2005, would it be using DBCC SHRINKFILE after taking the full backup of the log.
Thank you
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 3:21 PM
Points: 5,317,
Visits: 11,307
|
|
it would be, but unless you really need the space back, don't bother, you will fragment you log file at the OS level.
---------------------------------------------------------------------
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:02 AM
Points: 5,244,
Visits: 11,264
|
|
how big is the log file?
the file will not shrink if there are transactions occupying the file. You would need to truncate the log first to clear transactions then shrink. This breaks your backup chain so a backup afterwards would be required. Do you really wanteed to shrink the file?
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:56 AM
Points: 5,123,
Visits: 20,371
|
|
| If your log file was created without a growth factor (either percentage or maximum size )-- a most unusual configuration. That said unless your database has undergone a significant increase in activity, i.e. many new rows inserted, many updates and deletes, and this level of activity is NOT expected to be repeated, shrinking the log file can be deleterious as noted by George Sibbald you will fragment you log file at the OS level. and as with any fragmented file the time for IO operations will increase. Further if the size is a result of normal operations, after shrinking the log file it will just grow again. Remember the log file is truncated as a part of normal operation of the database engine (check points) and in the Simple backup mode. The freed up space is reused. So attempt to learn what the normal every day operational size is and leave the log file alone.
If everything seems to be going well, you have obviously overlooked something.
Ron
Please help us, help you -before posting a question please read Before posting a performance problem please read
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 5:35 AM
Points: 202,
Visits: 325
|
|
ramdas.narayanan (7/18/2008) Hi folks, What would be the fastest way to shrink the transaction logs in SQL 2005, would it be using DBCC SHRINKFILE after taking the full backup of the log.
Thank you
Think this method below would help you : :) BACKUP LOG name WITH TRUNCATE_ONLY USE db DBCC SHRINKFILE (name_Log, 1)
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 5:14 AM
Points: 38,118,
Visits: 30,403
|
|
rinu philip (7/20/2008)
Think this method below would help you : :) BACKUP LOG name WITH TRUNCATE_ONLY USE db DBCC SHRINKFILE (name_Log, 1)
Be very careful of Backup log with truncate. If you are running in full recovery mode, truncaet will break the log chain and will leave you unable to restore to a point in time after the truncation. You will have to take another full/diff backup after doing the truncation to ensure hat you can do a point-in-time recovery.
You may also like to note that BACKUP LOG < DB name > WITH TRUNCATE_ONLY is currently deprecated and will not work in SQL 2008.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, February 14, 2011 7:42 AM
Points: 360,
Visits: 188
|
|
| Thank you for the information and suggestion.
|
|
|
|