sqlserver 清空日志
程序员文章站
2022-06-04 17:09:18
...
USE [master]GOALTER DATABASE yourdb SET RECOVERY SIMPLE WITH NO_WAITGOALTER DATABASE yourdb SET RECOVERY SIMPLE --简单模式GOUSE yourdb GODBCC SHRINKFILE (N'yourdb _Log' , 11, TRUNCATEONLY) GOUSE [master]GOALTER DATABASE yourdb SET RECOVERY
USE [master] GO ALTER DATABASE yourdb SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE yourdb SET RECOVERY SIMPLE --简单模式 GO USE yourdb GO DBCC SHRINKFILE (N'yourdb _Log' , 11, TRUNCATEONLY) GO USE [master] GO ALTER DATABASE yourdb SET RECOVERY FULL WITH NO_WAIT GO ALTER DATABASE yourdb SET RECOVERY FULL --还原为完全模式 GO
'这里的yourdb_Log 如果不知道在sys.database_files里是什么名字的话,可以用以下注释的语句进行查询
'USE yourdb
'GO
'SELECT file_id, name FROM sys.database_files;
'GO