本例,快速清理“students”数据库的日志,清理后日志文件不足1M。
USE [master] GO ALTER DATABASE students SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE students SET RECOVERY SIMPLE GO USE students GO --此处需要注意,并非所有数据库的日志文件名都是“数据库名_log” DBCC SHRINKFILE (N'students_log' , 0,TRUNCATEONLY) GO USE [master] GO ALTER DATABASE students SET RECOVERY FULL WITH NO_WAIT GO ALTER DATABASE students SET RECOVERY FULL GO --查询指定数据库的日志文件名称 USE students GO SELECT name FROM SYS.database_files WHERE type_desc='LOG'