SQL2008R2清理日志文件

SQL2008R2清理日志文件

将以下代码在数据库中执行即可:

USE [master]
GO
ALTER DATABASE [数据库名]
SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE [数据库名]
SET RECOVERY SIMPLE
GO
USE [数据库名]
GO
DBCC SHRINKFILE (N’[数据库日志文件名]’ , 0,TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE [数据库名] SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE [数据库名] SET RECOVERY FULL
GO

–查询指定数据库的日志文件名称
USE [数据库名]
GO
SELECT name FROM SYS.database_files WHERE type_desc=‘log’

©️2020 CSDN 皮肤主题: 游动-白 设计师:上身试试 返回首页