SQL2000/2005中如何暂时禁用日志?
有没有办法阻止 SQL2000/2005 中的日志文件增长(或至少增长得同样多)?
我正在运行一个非常广泛的过程,其中包含大量的插入物,并且原木正在穿过屋顶。
编辑:请注意,我说的是批量导入过程,而不是实时数据的日常更新。
Is there a way to stop the log file from growing (or at least from growing as much) in SQL2000/2005?
I am running a very extensive process with loads of inserts and the log is going through the roof.
EDIT: please note I am talking about an batch-import process not about everyday update of live-data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您的批处理可能会过多使用临时表。
Your batch may make too much use of temporary tables.
您可以在创建数据库时关闭“自动增长”。
您可以为数据库和/或日志文件单独更改此设置。
更改自动增长设置 SQL Server http://www.server-management。 co.uk/images/library/c1652bc7-.jpg
You can turn 'autogrowth' off when creating a database.
You can change this setting seperately for the database and/or the logfile.
Change Autogrowth setting SQL Server http://www.server-management.co.uk/images/library/c1652bc7-.jpg
将恢复模式更改为 SIMPLE 会导致日志增长得较少。
人们对这个解决方案有何看法?
Changing the recovery mode to SIMPLE causes the log to grow not as much.
What's people opinion about this solution?
您无法禁用日志,但可以批量执行插入并在批次之间备份/截断日志。
如果数据来自数据库外部,您还可以考虑使用 BCP 。
You can't disable the log, but you could perform your inserts in batches and backup/truncate the log in between batches.
If the data originates from outside your database you could also consider using BCP.
请记住,将恢复模式设置为“SIMPLE”仅允许您将数据库恢复到最近备份的点。 创建备份后,尚未提交到数据库的待处理事务将会丢失。
Remember that setting the recovery mode to SIMPLE only allows you to recover the database to the point of your most recent backup. Pending transaction which have not been committed to the database - after the backup has been created - will be lost.
如果您需要恢复,更改恢复模式将导致旧的日志备份毫无用处,因为这会更改日志链。
如果您通常需要完全恢复,您将需要在加载过程中增加日志备份频率。 这可以通过在加载过程之前和之后通过 msdb 数据库中的 sp_update_jobschedule 过程更改日志备份的作业计划来完成。
Changing the recovery model will cause your old log backups to be of no use if you need to restore as this will change the log chain.
If you need full recovery normally you'll want to increase your log backup frequency during the load process. This can be done by changing the job schedule for the log backup via the sp_update_jobschedule procedure in the msdb database both before and after the load process.