本例,快速清理「students」數據庫的日誌,清理後日志文件不足1M。html
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'
相關閱讀:SQL Server 2000:快速清除日誌文件的方法數據庫