The log file for database is full

2019-03-26 01:26发布

So our SQL Server 2000 is giving me the error, "The log file for database is full. Back up the transaction log for the database to free up some log space."

How do I go about fixing this without deleting the log like some other sites have mentioned?

Additional Info: Enable AutoGrowth is enabled growing by 10% and is restricted to 40MB.

12条回答
仙女界的扛把子
2楼-- · 2019-03-26 02:01

To just empty it:

backup log <dbname> with truncate_only  

To save it somewhere:

backup log <dbname> to disk='c:\somefile.bak'

If you dont really need transactional history, try setting the database recovery mode to simple.

查看更多
Root(大扎)
3楼-- · 2019-03-26 02:01

ether backup your database logs regularly if you need to recover up to the minute or do other fun stuff like log shipping in the future, or set the database to simple mode and shrink the data file.

DO NOT copy, rename, or delete the .ldf file this will break your database and after you recover from this you may have data in an inconsistent state making it invalid.

查看更多
地球回转人心会变
4楼-- · 2019-03-26 02:02

My dear friend it is vey important for a DBA to check his log file quite frequently. Because if you don't give much attention towards it some day it is going to give this error.

For this purpose you have to periodically take back up so that the logs file would not faced such error.

Other then this the above given suggestion are quite right.

查看更多
贼婆χ
5楼-- · 2019-03-26 02:07

Scott, as you guessed: truncating the log is a bad move if you care about your data.

The following, free, videos will help you see exactly what's going on and will show you how to fix the problem without truncating the logs. (These videos also explain why that's such a dangerous hack and why you are right to look for another solution.)

Together these videos will help you understand exactly what's going on and will show you whether you want to switch to SIMPLE recovery, or look into actually changing your backup routines. There are also some additional 'how-to' videos that will show you exactly how to set up your backups to ensure availability while managing log file sizing and growth.

查看更多
对你真心纯属浪费
6楼-- · 2019-03-26 02:07

Rename it it. eg:
old-log-16-09-08.log

Then the SQL server can use a new empty one.

查看更多
Evening l夕情丶
7楼-- · 2019-03-26 02:09

As soon as you take a full backup of the database, and the database is not using the Simple recovery model, SQL Server keeps a complete record of all transactions ever performed on the database. It does this so that in the event of a catastrophic failure where you lose the data file, you can restore to the point of failure by backing up the log and, once you have restored an old data backup, restore the log to replay the lost transactions.

To prevent this building up, you must back up the transaction log. Or, you can break the chain at the current point using the TRUNCATE_ONLY or NO_LOG options of BACKUP LOG.

If you don't need this feature, set the recovery model to Simple.

查看更多
登录 后发表回答