日志文件满而造成SQL数据库无法写入文件时,可用两种方法:
一种方法:清空日志。
1.打开查询分析器,输入命令
DUMPTRANSACTION数据库名WITHNO_LOG
2.再打开企业管理器–右键你要压缩的数据库–所有任务–收缩数据库–收缩文件–选择日志文件–在收缩方式里选择收缩至XXM,这里会给出一个允许收缩到的最小M数,直接输入这个数,确定就可以了。
另一种方法有一定的风险性,因为SQLSERVER的日志文件不是即时写入数据库主文件的,如处理不当,会造成数据的损失。
1:删除LOG
分离数据库企业管理器->服务器->数据库->右键->分离数据库
2:删除LOG文件
附加数据库企业管理器->服务器->数据库->右键->附加数据库
此法生成新的LOG,大小只有500多K。
注意:建议使用第一种方法。
如果以后,不想要它变大。
SQL2000下使用:
在数据库上点右键->属性->选项->故障恢复-模型-选择-简单模型。
或用SQL语句:
alterdatabase数据库名setrecoverysimple
另外,Truncatelogoncheckpoint(此选项用于SQL7.0,SQL2000中即故障恢复模型选择为简单模型)当执行CHECKPOINT命令时如果事务日志文件超过其大小的70%则将其内容清除在开发数据库时时常将此选项设置为TrueAutoshrink定期对数据库进行检查当数据库文件或日志文件的未用空间超过其大小的25%时,系统将会自动缩减文件使其未用空间等于25%当文件大小没有超过其建立时的初始大小时不会缩减文件缩减后的文件也必须大于或等于其初始大小对事务日志文件的缩减只有在对其作备份时或将Truncatelogoncheckpoint选项设为True时才能进行。
注意:一般立成建立的数据库默认属性已设好,但碰到意外情况使数据库属性被更改,请用户清空日志后,检查数据库的以上属性,以防事务日志再次充满。
最新评论
I relish, cause I discovered just what I was taking a look for. You've ended my 4 day long hunt! God Bless you man. Have a nice day. Bye
I am really impressed along with your writing talents as smartly as with the layout in your weblog. Is that this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it is rare to peer a nice weblog like this one today!
I'm really inspired with your writing skills and also with the layout on your weblog. Is this a paid subject or did you modify it your self? Anyway stay up the nice quality writing, it is rare to see a nice weblog like this one these days.
Great article, totally what I wanted to find.
It's going to be finish of mine day, but before ending I am reading this fantastic post to increase my know-how.
vds sunucu kiralama fiyatlariniz uygun gözüküyor
This web site truly has all of the info I needed about this subject and didn't know who to ask.
BWER Company is committed to advancing Iraq’s industrial sector with premium weighbridge systems, tailored designs, and cutting-edge technology to meet the most demanding applications.