Home >Database >Mysql Tutorial >如何缩小SQL SERVER日志文件(1/2)

如何缩小SQL SERVER日志文件(1/2)

WBOY
WBOYOriginal
2016-06-07 17:47:48928browse

如何缩小SQL SERVER日志文件可以将日志文件缩小到自己想要的大小了。把代码COPY到查询分析器里,,然后修改其中的3个参数(数据库名,日志文件名,和目标日志文件的大小),运行即可(我已经用过多次了)

如何缩小sql server日志文件
可以将日志文件缩小到自己想要的大小了。把代码copy到查询分析器里,,然后修改其中的3个参数(名,日志文件名,和目标日志文件的大小),运行即可(我已经用过多次了)

  -----

 

 set nocount on

  declare @logicalfilename sysname,

  @maxminutes int,

  @newsize int

  use marias -- 要操作的数据库名

  select @logicalfilename = 'marias_log', -- 日志文件名

  @maxminutes = 10, -- limit on time allowed to wrap log.

  @newsize = 100 -- 你想设定的日志文件的大小(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,

  @starttime datetime,

  @trunclog varchar(255)

  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn