The log file for database is full

后端 未结 12 829
时光取名叫无心
时光取名叫无心 2021-02-08 17:15

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

相关标签:
12条回答
  • 2021-02-08 17:54

    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 )

    0 讨论(0)
  • 2021-02-08 17:54

    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.

    0 讨论(0)
  • 2021-02-08 17:56

    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.

    0 讨论(0)
  • 2021-02-08 17:59

    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.)

    • SQL Server Backups Demystified
    • SQL Server Logging Essentials
    • Understanding Backup Options

    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.

    0 讨论(0)
  • 2021-02-08 17:59

    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.

    0 讨论(0)
  • 2021-02-08 18:00

    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.

    0 讨论(0)
提交回复
热议问题