Storage procedure backup SQL log

xiaoxiao2021-03-06  64

Personal collection, don't understand, don't ask me.

Set NoCount on Declare @LogicalFileName Sysname, @Maxminutes Int, @newsize Int

Use "abc" - Database name to be operated SELECT @LogicalFileName = 'abc_log', - log file name @MaxMinutes = 10, - limit on time allowed to wrap log. @Newsize = 500 - you want to set it Log file size (m)

- Setup / initialize DECLARE @OriginalSize int SELECT @OriginalSize = size FROM sysfiles WHERE name = @LogicalFileName SELECT '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

Declare @counter int, @strunclog varchar (255) select @starttime = getdate (), @TrunClog = 'backup log' db_name () 'with truncate_only'

转载请注明原文地址:https://www.9cbs.com/read-120231.html

New Post(0)