December 3, 2012 at 5:39 am
Hi All,
While running one sp am getting this below error
'The transaction log for database 'testdb' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases'
i tried to dbshrink using dbcc command still no use . i'll get small space but i.e not sufficient for my query or sp so i'll get the same error again.
so i wanted to clear log file completely or i wanted to move it to any other path .
Please provide quick solution for my problem.
Thanks,
Ravi@sql
December 3, 2012 at 5:43 am
What is the recovery Model of the database?
What is the size of t-log and growth options?
December 3, 2012 at 5:44 am
Sounds like you need to do some transaction log management.
What is the output of this query
select recovery_model_desc, log_reuse_wait_desc from sys.databases where name = 'testdb'
And some reading material
Managing Transaction Logs - http://www.sqlservercentral.com/articles/Administration/64582/
Why is my transaction log full - http://www.sqlservercentral.com/articles/Transaction+Logs/72488/
Stairway to Transaction Log Management - http://www.sqlservercentral.com/stairway/73776/
Accidental DBA Guide - Chapter 8 - http://www.sqlservercentral.com/articles/books/76296/
December 3, 2012 at 5:47 am
recovery_model_desclog_reuse_wait_desc
SIMPLE NOTHING
December 3, 2012 at 5:48 am
if your database is using the full or bulk logged recovery model take a transaction log backup using the following
BACKUP LOG [MYDB] TO DISK = 'some drive\some path\mydb.trn'
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
December 3, 2012 at 5:50 am
ravi@sql (12/3/2012)
recovery_model_desclog_reuse_wait_descSIMPLE NOTHING
What size is the transaction log?
Does it have any growth configured?
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
December 3, 2012 at 5:51 am
Space in t-log is made reusable in SIMPLE recovery model as soon as the transaction is Committed/ written to the database. Have you restricted your t-log growth? If you don't have enough space in the drive hosting t-logs consider using smaller transactions and frequent COMMITs.
December 3, 2012 at 5:54 am
ya maxsize is given for autogrowth
December 3, 2012 at 5:56 am
ok cant i point my log file path any other drive ? if yes how can i do that ? pls share the query ?
Thanks
Ravi@sql
December 3, 2012 at 6:01 am
You can try the below options:
Increase the size of 'MAX GROWTH' (If ample space is available in the drive hosting t-log)
If not, you can try this
USE MASTER
GO
DBCC FREESESSIONCACHE WITH NO_INFOMSGS
GO
DBCC FREESYSTEMCACHE 'ALL'
GO
USE (YOURDBNAME)
GO
DBCC SHRINKFILE (N'LOGFILENAME', 0, TRUNCATEONLY)
GO
DBCC SHRINKFILE (N'LOGFILENAME' , 1024)
GO
December 3, 2012 at 6:03 am
ravi@sql (12/3/2012)
ya maxsize is given for autogrowth
What are the size details for the log currently?
Do you have any long running transactions?
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
December 3, 2012 at 6:09 am
Thank you all .
Regards,
Ravi@sql
December 3, 2012 at 6:11 am
ravi@sql (12/3/2012)
ok cant i point my log file path any other drive ? if yes how can i do that ? pls share the query ?Thanks
Ravi@sql
If you want to move the existing t-log file to different location then, follow the below steps:
1. Run ALTER DATABASE command and change location of ldf file
2. Take database offline
3. Move the physical file from old location to new location.
3. Bring database online
You can also try to add second log file to your database
USE [master]
GO
ALTER DATABASE [DB_NAME] ADD LOG FILE ( NAME = N'second_log_file', FILENAME = N'D:\LOG_FILES\second_log_file.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO
December 4, 2012 at 6:57 am
arunyadav007 (12/3/2012)
USE MASTER
GO
DBCC FREESESSIONCACHE WITH NO_INFOMSGS
GO
DBCC FREESYSTEMCACHE 'ALL'
GO
and how does it will help to manage the log space ?
you are just adding trouble to existing issues
-----------------------------------------------------------------------------
संकेत कोकणे
December 4, 2012 at 7:00 am
@OP ,please do check Gail's post for managing log file
http://www.sqlservercentral.com/articles/Administration/64582/
-----------------------------------------------------------------------------
संकेत कोकणे
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply