日志收缩
DECLARE @dbname VARCHAR(60) SELECT @dbname = CONVERT(VARCHAR(60), DB_NAME()) EXEC('DUMP TRANSACTION ['+@dbname+'] WITH NO_LOG') DECLARE @logname VARCHAR(60) SELECT @logname = name FROM sys.sysfiles WHERE name LIKE '%log' EXEC('BACKUP LOG ['+@dbname+'] WITH NO_LOG') EXEC ('DBCC SHRINKFILE(['+@logname+'],1)')