SQL Server 数据库清空ldf日志文件

USE [master]ALTER DATABASE [DB_Develop]SET RECOVERY SIMPLE WITH NO_WAITALTER DATABASE [DB_Develop] SET RECOVERY SIMPLEGOUSE [DB_Develop]DECLARE @logname VARCHAR(150)SELECT @logname = NAMEFROM   sys.database_filesWHERE  NAME LIKE'%log'DBCC SHRINKFILE(@logname, 11, TRUNCATEONLY)GOUSE [master]ALTER DATABASE [DB_Develop]SET RECOVERY FULL WITH NO_WAITALTER DATABASE [DB_Develop] SET RECOVERY FULLGO

  使用时将DB_Develop更换为你需要操作的数据库名即可。

(0)

相关推荐