第一步,首先找到日志文件名,使用下面语句:
USE [LGDB_TBookEditor51]
GO
select name from SYS.database_files where type_desc='LOG'
第二步,新建查询执行下面语句:
USE [master]
GO
ALTER DATABASE LGDB_TBookEditor51 SET RECOVERY SIMPLE WITH NO_WAIT ----LGDB_TBookEditor51为需要清除日志的数据库名称
GO
ALTER DATABASE LGDB_TBookEditor51 SET RECOVERY SIMPLE --简单模式 ----LGDB_TBookEditor51为需要清除日志的数据库名称
GO
USE LGDB_TBookEditor51 ----LGDB_TBookEditor51为需要清除日志的数据库名称
GO
DBCC SHRINKFILE (N'NewTextBookEditor_log' , 11, TRUNCATEONLY) ----NewTextBookEditor_log为需要清除日志的数据库名日志名称
GO
USE [master]
GO
ALTER DATABASE LGDB_TBookEditor51 SET RECOVERY FULL WITH NO_WAIT ----LGDB_TBookEditor51为需要清除日志的数据库名称
GO
ALTER DATABASE LGDB_TBookEditor51 SET RECOVERY FULL --还原为完全模式 ----LGDB_TBookEditor51为需要清除日志的数据库名称