> 数据库 > SQL Server 2008 >

SqlServer数据库定时删除系统日志

USE [master]
GO
ALTER DATABASE [ems_db] SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE [ems_db] SET RECOVERY SIMPLE
GO
USE [ems_db]
GO
DBCC SHRINKFILE (N'ems_db_log' , 0,TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE [ems_db] SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE [ems_db] SET RECOVERY FULL
GO
 
 
USE [ems_db]
GO
SELECT name FROM SYS.database_files WHERE type_desc='LOG'
 
 
ems_db是数据库的名称。
ems_db_log是日志名称。在属性_文件里

 
(责任编辑:IT)