declare @db nvarchar(20)
set @db='dbname'
dump transaction @db with no_log
backup log @db with no_log
dbcc shrinkdatabase(@db)
如果不需要定点还原,在数据库属性里,选项->还原模式改为“简单”,这样日志文件就会小很多
以上是对应的08以前,但是08不支持上述语句,08用如下语句
USE dbname;
GO
BACKUP LOG dbname disK='d:\test.bak'
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (Bigdata_Log, 1);
GO