如何在SQL Server 2008中清除数据库事务日志文件 [英] How to Clear Database Transaction Log File in SQL Server 2008

查看:103
本文介绍了如何在SQL Server 2008中清除数据库事务日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的sql server 2008在选择或插入时很慢......发生死锁错误。

如何清除数据库事务日志文件?或压缩?

请帮助我

解决方案

清除事务日志不是正确的方法。也没有压缩它。更糟糕的是,这可能导致您无法恢复数据库,直到下一次完整备份为止。



首先,检查数据库的恢复模型是什么。如果已满,请确保定期进行完整备份和事务日志备份。有关概念,请参阅: http://msdn.microsoft.com/en-us/library/ms189275.aspx [ ^ ]



系统响应时间慢的原因可以说是坦率的。调查工作负载,CPU使用率,内存使用情况,服务器上可能的分页,磁盘队列长度等。当你确定了瓶颈后,就开始调查原因和纠正措施。


我知道这是一个迟到的答案,但我希望它对其他读者有用



我同意Mika并建议您先进行完整备份。



请注意压缩t-log文件,因为如果发生灾难,可能会丢失大量可能作为实时保护程序的数据。



为了指出你正确的方向,我建议你阅读这个帖子:

http://stackoverflow.com/questions/56628/how-do-you-clear-the-sql-server-事务日志

hi,
my sql server 2008 was very slow when select or insert or... and deadlock error occurs.
How to Clear Database Transaction Log File? or compress?
pls help me

解决方案

Clearing the transaction log isn't the right way to go. Nor is compressing it. At worse this can lead to a situation where you cannot restore your database anymore until next full backup is made.

First, check what is the recovery model of the database. If it is full then ensure that you make full and transaction log backups regularly. For the concepts see: http://msdn.microsoft.com/en-us/library/ms189275.aspx[^]

The cause for the system slow response time can be quite frankly anything. Investigate the workload, CPU usage, memory usage, possible paging on the server, disk queue lengths and so on. When you have identified the bottleneck then start investigating the reason and corrective actions.


I am aware this is a late answer, but I hope it will be useful for other readers

I agree with Mika and suggest you take a full backup first.

Be aware when compressing a t-log file as you may lose a ton of data that may come as a live saver in case of disaster.

To point you in the right direction, I recommend reading this thread:
http://stackoverflow.com/questions/56628/how-do-you-clear-the-sql-server-transaction-log


这篇关于如何在SQL Server 2008中清除数据库事务日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆