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条回答
Explosion°爆炸
2楼-- · 2019-03-26 01:49

I don't think renaming or moving the log file will work while the database is online.

Easiest thing to do, IMO, is to open the properties for the database and switch it to Simple Recovery Model. then shrink the database and then go back and set the DB to Full Recoery Model (or whatever model you need).

Changing the logging mode forces SQL Server to set a checkpoint in the database, after which shrinking the database will free up the excess space.

查看更多
男人必须洒脱
3楼-- · 2019-03-26 01:50

You have the answer in your question: Backup the log, then it will be shrunk. Make a maintenance plan to regularly backup the database and don't forget to select "Backup the transaction log". That way you'll keep it small.

查看更多
欢心
4楼-- · 2019-03-26 01:55

Well you could take a copy of the transaction log, then truncate the log file, which is what the error message suggests.

If disk space is full and you can't copy the log to another machine over the network, then connect a drive via USB and copy it off that way.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-03-26 01:55

If it's a non production environment use

dump tran <db_name> with no_log;

Once this has completed shrink the log file to free up disk space. Finally switch database recovery mode to simple.

查看更多
劫难
6楼-- · 2019-03-26 01:59

My friend who faced this error in the past recommends:

Try

  • Backing up the DB. The maintenance plan includes truncation of these files.
  • Also try changing the 'recovery mode' for the DB to Simple (instead of Full for instance)

Cause: The transaction log swells up due to events being logged (Maybe you have a number of transactions failing and being rolled back.. or a sudden peaking in transactions on the server )

查看更多
啃猪蹄的小仙女
7楼-- · 2019-03-26 02:00
登录 后发表回答