设为首页 加入收藏

TOP

删除SQL Server大容量日志的方法(二)
2014-11-24 01:41:53 来源: 作者: 【 】 浏览:15
Tags:删除 SQL Server 大容量 日志 方法
ype=status&0x40 from [+@dbname+]..sysfiles)
  exec(sp_detach_db +@dbname+)
  --删除日志文件
  declare @fname nvarchar(260),@s varchar(8000)
  declare tb cursor local for select fname from #t where type=64
  open tb
  fetch next from tb into @fname
  while @@fetch_status=0
  begin
  set @s=del "+rtrim(@fname)+"
  exec master..xp_cmdshell @s,no_output
  fetch next from tb into @fname
  end
  close tb
  deallocate tb


  --附加数据库

set @s=
  declare tb cursor local for select fname from #t where type=0
  open tb
  fetch next from tb into @fname
  while @@fetch_status=0
  begin
  set @s=@s+,+rtrim(@fname)+
  fetch next from tb into @fname
  end
  close tb
  deallocate tb
  exec(sp_attach_single_file_db +@dbname++@s)
  go

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇连接mssql2005时出现无效的连接 下一篇mssql2005恢复xp_cmdshell

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: