重建数据库日志

 1 USE [master]
 2 GO
 3 
 4 ALTER DATABASE 数据库名称 SET RECOVERY SIMPLE WITH NO_WAIT
 5 GO
 6 
 7 ALTER DATABASE 数据库名称 SET RECOVERY SIMPLE
 8 GO
 9 
10 USE 数据库名称
11 GO
12 
13 declare @dbName nvarchar(100)
14 
15 set @dbName = (SLEECT name FROM sys.database_files WHERE type=1)
16 GO
17 
18 DBCC SHRINKFILE(@dbName,1,TRUNCATEONLY)
19 GO
20 
21 USE [master]
22 GO
23 
24 ALTER DATABASE 数据库名称 SET RECOVERY FULL WITH NO_WAIT
25 GO
26 
27 ALTER DATABASE 数据库名称 SET RECOVERY FULL

 

posted @ 2014-09-28 11:20  star丶清影  阅读(571)  评论(0编辑  收藏  举报