以下为SQL2008 缩小日志文件的脚本,在SQL Server Management Studio中打开数据库,将脚本里的数据库名称替换成需要缩小日志的库名称,然后
运行以下脚本。
USE WSS_Content_Keeptime2010_V2;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE WSS_Content_Keeptime2010_V2
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (WSS_Content_Keeptime2010_V2_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE WSS_Content_Keeptime2010_V2
SET RECOVERY FULL;
GO