用SQL语句执行,效率很高,语句如下:
USE [master]
GO
ALTER DATABASE mydatabase SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE mydatabase SET RECOVERY SIMPLE --简单模式
GO
USE mydatabase
GO
DBCC SHRINKFILE (N'mydatabase_log' , 11, TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE mydatabase SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE mydatabase SET RECOVERY FULL --还原为完全模式
GO