Tech Guru Menu

All items for August, 2008

Permalink:

Truncate Log Files for All Databases in SQL Server

Here is the script I managed to come up with for the purpose of truncating log files for all databases in SQL Server 2000/2005/2008:

use master
DECLARE @Statement varchar (4000)
SELECT @Statement = ”
SELECT @Statement = @Statement + ‘USE [?]; ‘
SELECT @Statement = @Statement + ‘DECLARE @Log_Logical_FileName varchar (100); ‘
SELECT @Statement = @Statement + ‘SELECT @Log_Logical_FileName = rtrim(name) FROM dbo.sysfiles WHERE fileid = 2; ‘
SELECT @Statement = @Statement + ‘BACKUP LOG [?] WITH TRUNCATE_ONLY; ‘
SELECT @Statement = @Statement + ‘DBCC SHRINKFILE(@Log_Logical_FileName,1); ‘
EXEC sp_MSforeachdb @command1=@Statement
GO

  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

Free Kentico CMS

Kentico Software, a web CMS vendor, is now providing a free version of Kentico CMS for commercial and personal projects. Four years after creating Kentico, the company wants to encourage more developers and site owners to embrace the Kentico CMS. We here at CMSWire can’t argue with receiving free software! Read More . . .

  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.