SqlServer 2008 R2 日志文件过大,清理方式

 1     USE [master]
 2     GO
 3     ALTER DATABASE DbName SET RECOVERY SIMPLE WITH NO_WAIT
 4     GO
 5     ALTER DATABASE DbName SET RECOVERY SIMPLE   --简单模式
 6     GO
 7     USE DbName 
 8     GO
 9     DBCC SHRINKFILE (N'DbName_Log' , 11, TRUNCATEONLY)
10     GO
11     USE[master]
12     GO
13 
14     ALTER DATABASE DbName SET RECOVERY FULL WITH NO_WAIT
15 
16     GO
17 
18     ALTER DATABASE DbName SET RECOVERY FULL  --还原为完全模式
19 
20     GO
21   

将以上的”DbName”替换成你需要清理日志文件对应的数据库