<p>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."</p>

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

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

[{'answer_id': 72984, 'author': 'Fire Lancer', 'author_id': 6266, 'author_profile': 'https://Stackoverflow.com/users/6266', 'pm_score': -1, 'selected': False, 'text': '<p>Rename it it. eg:<br>\nold-log-16-09-08.log</p>\n\n<p>Then the SQL server can use a new empty one.</p>\n'}, {'answer_id': 73023, 'author': 'Marc Gear', 'author_id': 6563, 'author_profile': 'https://Stackoverflow.com/users/6563', 'pm_score': 0, 'selected': False, 'text': "<p>Well you could take a copy of the transaction log, then truncate the log file, which is what the error message suggests.</p>\n\n<p>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.</p>\n"}, {'answer_id': 73027, 'author': 'cori', 'author_id': 8151, 'author_profile': 'https://Stackoverflow.com/users/8151', 'pm_score': 2, 'selected': False, 'text': "<p>I don't think renaming or moving the log file will work while the database is online.</p>\n\n<p>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).  </p>\n\n<p>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.</p>\n"}, {'answer_id': 73036, 'author': 'Miroslav Zadravec', 'author_id': 8239, 'author_profile': 'https://Stackoverflow.com/users/8239', 'pm_score': 0, 'selected': False, 'text': '<p>You have the answer in your question: Backup the log, then it will be shrunk.\nMake 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.</p>\n'}, {'answer_id': 73074, 'author': 'TrevorD', 'author_id': 12492, 'author_profile': 'https://Stackoverflow.com/users/12492', 'pm_score': 4, 'selected': False, 'text': "<p>To just empty it:</p>\n\n<pre><code>backup log &lt;dbname&gt; with truncate_only  \n</code></pre>\n\n<p>To save it somewhere:</p>\n\n<pre><code>backup log &lt;dbname&gt; to disk='c:\\somefile.bak'\n</code></pre>\n\n<p>If you dont really need transactional history, try setting the database recovery mode to simple.</p>\n"}, {'answer_id': 73136, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>If it's a <strong>non</strong> production environment use </p>\n\n<pre><code>dump tran &lt;db_name&gt; with no_log;\n</code></pre>\n\n<p>Once this has completed shrink the log file to free up disk space. Finally switch database recovery mode to simple.</p>\n"}, {'answer_id': 73269, 'author': 'Gishu', 'author_id': 1695, 'author_profile': 'https://Stackoverflow.com/users/1695', 'pm_score': 1, 'selected': False, 'text': "<p>My friend who faced this error in the past recommends:</p>\n\n<p>Try</p>\n\n<ul>\n<li>Backing up the DB. The maintenance plan includes truncation of these files.</li>\n<li>Also try changing the 'recovery mode' for the DB to <em>Simple</em> (instead of <em>Full</em> for instance)</li>\n</ul>\n\n<p>Cause:\nThe 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 )</p>\n"}, {'answer_id': 73421, 'author': 'Mike Dimmick', 'author_id': 6970, 'author_profile': 'https://Stackoverflow.com/users/6970', 'pm_score': 0, 'selected': False, 'text': "<p>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.</p>\n\n<p>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.</p>\n\n<p>If you don't need this feature, set the recovery model to Simple.</p>\n"}, {'answer_id': 74030, 'author': 'kristof', 'author_id': 3241, 'author_profile': 'https://Stackoverflow.com/users/3241', 'pm_score': 1, 'selected': False, 'text': '<p>You may want to check related SO question:</p>\n\n<ul>\n<li><a href="https://stackoverflow.com/questions/56628/how-do-you-clear-the-transaction-log-in-a-sql-server-2005-database#63070">How do you clear the transaction log in a SQL Server 2005 database?</a></li>\n</ul>\n'}, {'answer_id': 74480, 'author': 'Michael K. Campbell', 'author_id': 11191, 'author_profile': 'https://Stackoverflow.com/users/11191', 'pm_score': 3, 'selected': True, 'text': '<p>Scott, as you guessed: truncating the log is a bad move if you care about your data.</p>\n\n<p>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.)</p>\n\n<ul>\n<li><a href="http://www.sqlservervideos.com/sqlserver-backups/backups-demystified" rel="nofollow noreferrer">SQL Server Backups Demystified</a></li>\n<li><a href="http://www.sqlservervideos.com/sqlserver-backups/logging-essentials" rel="nofollow noreferrer">SQL Server Logging Essentials</a></li>\n<li><a href="http://www.sqlservervideos.com/sqlserver-backups/backup-options" rel="nofollow noreferrer">Understanding Backup Options</a></li>\n</ul>\n\n<p>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. </p>\n'}, {'answer_id': 76908, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>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. </p>\n\n<p>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.</p>\n'}, {'answer_id': 10979331, 'author': 'shadab shah', 'author_id': 1429149, 'author_profile': 'https://Stackoverflow.com/users/1429149', 'pm_score': 0, 'selected': False, 'text': "<p>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.</p>\n\n<p>For this purpose you have to periodically take back up so that the logs file would not faced such error.</p>\n\n<p>Other then this the above given suggestion are quite right.</p>\n"}]
['https://Stackoverflow.com/questions/72961', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2863/']