sql-server – 如何在SQL Server 2008中阻止日志文件的增长?

在我的应用程序恢复后,我对新创建的数据库执行了许多(> 100,000,000)更新.因此,LOG文件显着增长.

我怎么能阻止它成长?

注意:将恢复模型设置为简单不起作用.

此外,这个问题最初发布在这里https://stackoverflow.com/questions/4400057/how-to-stop-log-file-from-growing-in-sql-server-2008

解决方法

您是否可以将恢复模型更改为简单,足够长以执行收缩,然后将恢复模型设置回来?

就像是:

alter database <mydb> set recovery simple
go
checkpoint
go
alter database <mydb> set recovery full
go
backup database pubs to disk = 'c:\mydb.bak' with init
go
dbcc shrinkfile (N'mydb_log',1)
go

我承认我从http://sql-server-performance.com/Community/forums/p/28345/151682.aspx借来的

链接链接到:http://madhuottapalam.blogspot.com/2008/05/faq-how-to-truncate-and-shrink.html

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 &#39;EastRiver&#39; 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...