For this post we have a guest contributor with some SQL goodness. This will definitely come in handy for us System Center folks as all of the System Center components use SQL. This guest post was written by: Andrew Jackson a SQL expert in the SQL community check him out on the following sites: LinkedIn , google+, his blog. Here is the actual blog post:
In SQL Server, Every database file is associated with a transaction log that contains all the records of transactions and modifications made by each transaction. The log file plays a very important part as it helps in disaster recovery. The transaction log should be truncated or cleared regularly to keep the size of log file from filling up. One of the common error encountered by the users of the SQL Server is when the transaction log is full, which is possible by various reasons. This blog will be discussing about the Transaction Log Full due to Log Backup.
The following error message will be displayed like this “The transaction log for database is full due to Log Backup.” It happens when the user is unable to make data entry due to insufficient space. The transaction log file grows very large and consumes too much space over server restricting addition of any data into SQL Tables. The error message is not because of log backup but it actually means the virtual files with the transaction log could not be reused, as it requires log backup. User need to make sure that Log file growth is unrestricted, Storage of log file should have enough space, and regular log backups should be taken.
There may be several solutions for the situation when the Transaction log file is full such as creating backup or truncate the transaction logs, making the log space available, moving file to another disk drive, increase the log file size or add another log file on different disk.
Since we are talking about the Transaction Log Full Due to Log Backup, we will be performing truncate operation on the transaction log file. Steps that need to be followed to sort the issue are:
- Open Microsoft SQL Server Management Studio in order to connect to the desired SQL server database.
- Select the database, which transaction file needs to be truncated
- Type the T-SQL script below
ALTER DATABASE db_name SET RECOVERY SIMPLE
DBCC SHRINKFILE (db_name_log,5)
ALTER DATABASE db_name SET RECOVERY FULL
- Click on Execute button and run these commands
Another solution is to stop the SQL Server Service and find the location of the transaction file to rename it. When the SQL Service is re-started and logged in to the database, a new log file will be created. If the new log file is not created still and displays the same error user can follow these steps:
- Go to SQL Server Management Studio to connect to the database
- Right-click on the desired database, Go to Tasksà Detachà Browse the location of the file
- Cut the ...