/****** Script for SelectTopNRows command from SSMS ******/ USE [master] GO ALTER DATABASE AdventureWorks2012 SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE AdventureWorks2012 SET RECOVERY SIMPLE --简单模式 GO USE AdventureWorks2012 GO DBCC SHRINKFILE (N'AdventureWorks2012_Log' , 11, TRUNCATEONLY) GO --这里的DNName_Log 如果不知道在sys.database_files里是什么名字的话,可以用以下注释的语句进行查询 USE AdventureWorks2012 GO SELECT file_id, name FROM sys.database_files; GO USE [master] GO ALTER DATABASE AdventureWorks2012 SET RECOVERY FULL WITH NO_WAIT GO ALTER DATABASE AdventureWorks2012 SET RECOVERY FULL --还原为完全模式 GO
BACKUP LOG [EMAS_BASE] TO DISK='NUL:' -- 备份事务日志,备份成NUL,就不用占硬盘空间 Go USE [EMAS_BASE]; GO DBCC SHRINKFILE (EMAS_BASE_1_Log, 7); --收缩数据库日志文件,收到7M GO