Monday 17 December 2012

SQL Server Transaction Log Full Error


Error:
"The
transaction log for database "DatabaseName" is full. To find out why space in
the log cannot be reused, see the log_reuse_wait_desc column in Sys.database on
"Source where sql statement is run from the code"

Cause:
SQL
Server trying to log the changes in database to its log file .LDF and the disk
space is out or it hits the limits allowed by SQL Server.
In
Sql Server Management Studio -> Right click on Database -> Select
Properties -> Select Files to find out where the .MDF and .LDF files are
stored
->
Look at the AutoGrouth column
Fix:
Backup
your DB and shrink the log file
USE
YourDatabase;
GO
ALTER
DATABASE YourDatabase SET RECOVERY SIMPLE;
GO
DBCC
SHRINKFILE (YourDatabase_Log, 10); --10MB
GO
ALTER
DATABASE AdventureWorks SET RECOVERY FULL;
GO

Good
Reference Link:
http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/do-not-truncate-your-ldf-files

No comments:

Post a Comment