- Function: shrink the database log files - Author: Unknown --eg: database named abc ---------------------------- --------------------------------- set nocount overdeclare @LogicalFileName sysname, @maxminutes int, @newsize intuse ABC- - To operate the database select @LogicalFileName = 'abc_log', --- log file name @MaxUtes = 10, --- limit on time allowed to wrap log. @Newsize = 1 --- You want to set the log file you want to set Size (m) - setup / initializedeclare @ORIGINALSIZE INT SELECT @ORIGINALSIZE = Size from sysfiles where name = @LogicalFileName
SELECT original log size = 'Original Size of' DB_NAME () 'log is' convert (varchar (30), @ OriginalSize) '8k pages or' convert (varchar (30), (@ OriginalSize * 8 / 1024)) 'MB' from sysfiles where name = @LogicalFileName
Create Table DummyTrans (DummyColumn Char (8000) Not Null