Sql Server 2008 R2 清空数据库中ldf日志文件

/************************************************************
* Sql Server 2008 R2 清空数据库中ldf日志文件
* 将[SciProject]e替换为您要操作的数据库即可
************************************************************/
USE [master]
ALTER DATABASE [SciProject]
SET RECOVERY SIMPLE WITH NO_WAIT
ALTER DATABASE [SciProject]
SET RECOVERY SIMPLE
GO
USE [SciProject]
DECLARE @logname VARCHAR(150)
SELECT @logname = NAME
FROM sys.database_files
WHERE NAME LIKE'%log'
DBCC SHRINKFILE(@logname, 11, TRUNCATEONLY)
GO
USE [master]
ALTER DATABASE [SciProject]
SET RECOVERY FULL WITH NO_WAIT
ALTER DATABASE [SciProject]
SET RECOVERY FULL
GO

上一篇:一例invalid conversion from ‘int’ to ‘modbus_error_recovery_mode’


下一篇:金蝶数据优化