开发者

SQL Server 2005-- How can I detach & attach a DB and not create a T-Log File?

I have a database that is a container for data that is exported nightly from another database. Each night all of the data is deleted and refreshed. We previously migrated this process from SQL 2000 to 2005. The process is causing the associated Tran Log to get out of hand in size.

To fix this problem I've decided to remove the tran log file from the database since the data is re-exported each night.

I found this article and I've been trying to follow step II.

SQL SERVER – Shrinking Truncate Log File – Log Full – Part 2

The problem that I am having is that once I re-attach the database, a new transaction log is being created. To be sure, when I go to attach the mdb file, I see a list of two database files on the attach screen, at which point I remove the log file from the list. Regardless, a new tran log file is created.

The log file is getting out of control. Is there another way that I can remove if from my database or stop it from growing beyond an unreasonable size?

I know that I can set a max tran log file size, but I wasn't sure once that limit was reached if it would automatically shrink the log file or start logging errors? Any tips or pointers would be helpful. I don't mind the existence of the tran log, I just want it to maintain a managea开发者_开发技巧ble size.


If you don't need a transaction history and point-in-time recovery, set the database recovery model to 'Simple'.

The transaction log will then only store enough information to roll back pending transactions, rather than be a complete log of all (most) DB changes..

See also: http://msdn.microsoft.com/en-us/library/ms175987.aspx

That said, if like me you've pressed F5 mid-query, just before you started typing 'WHERE' by mistake:

DELETE FROM OrderLine

....then being able to undo the last 5 minutes' worth of damage is very handy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜