SQL Transaction logs out of control
Today I had to set up some SQL Log Shipping, but the source server had transaction logs from the past few months that were never cleaned out because SQL 2005 was running with a “Full” backup model (as opposed to “simple”, that never cleaned out the transaction log files after the backups ran.
So, today, I had to clean out the logs. I started by switching and running a simple backup. This was easy enough in the “Options” of hte database, but also could’ve avoided this step by running the following command:
BACKUP LOG <DatabaseName> TO DISK = ‘<BackupFile>’ or in context: BACKUP LOG TestDB TO DISK=’C:\TestDB1.bak’
That backs up the logfiles, and allows me to truncate the data that’s been backed up. Now, to shrink the logfile back down so that it doesn’t eat my entire server, I run the DBCC Shrinkfile command:
DBCC SHRINKFILE (<FileName>, <TargetSize>) The target size is in MB, so to shrink my logfile to 500 MB, I ran this:
DBCC SHRINKFILE (DB_logfile, 500)That did the trick. Now my logfile is back down to 500 MB and I can start working on log shipping so that I have some redundancy.
July 21st, 2010 at 10:43 pm
Buy:Lipothin.Wellbutrin SR.Acomplia.Prozac.Benicar.Zetia.Aricept.Female Cialis.Cozaar.Seroquel.Buspar.Amoxicillin.Advair.Ventolin.Lipitor.Zocor.Female Pink Viagra.Lasix.Nymphomax.SleepWell….
September 7th, 2010 at 8:34 pm
Buy:Benicar.Lipitor.Buspar.Ventolin.Lasix.SleepWell.Prozac.Nymphomax.Amoxicillin.Zocor.Female Cialis.Female Pink Viagra.Zetia.Wellbutrin SR.Aricept.Advair.Seroquel.Lipothin.Acomplia.Cozaar….
November 11th, 2010 at 6:27 am
…
BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…