/*------------------------------------------------------------------
-- Author : htl258(Tony)
-- Date : 2010-04-16 14:30:23
-- Version: Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
Jul 9 2008 14:43:34
Copyright (c) 1988-2008 Microsoft Corporation
Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3)
------------------------------------------------------------------*/
USE tony
GO
ALTER DATABASE tony SET RECOVERY SIMPLE --设置故障还原模式为简单
GO
DECLARE @logname SYSNAME
SELECT @logname=name FROM sys.database_files WHERE type_desc='LOG' --查询日志的逻辑文件名
DBCC SHRINKFILE(@logname,0) --收缩日志,0为收缩后的大小,单位为MB
GO
ALTER DATABASE tony SET RECOVERY FULL --设置故障还原模式为完全
GO
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/htl258/archive/2010/04/16/5493638.aspx