Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

how to shrink logfile ? Expand / Collapse
Author
Message
Posted Monday, December 3, 2012 5:39 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, May 26, 2014 6:02 AM
Points: 93, Visits: 195
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
Post #1391864
Posted Monday, December 3, 2012 5:43 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 24, 2014 11:46 PM
Points: 42, Visits: 290
What is the recovery Model of the database?
What is the size of t-log and growth options?
Post #1391868
Posted Monday, December 3, 2012 5:44 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:10 AM
Points: 5,216, Visits: 5,108
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/





Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1391870
Posted Monday, December 3, 2012 5:47 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, May 26, 2014 6:02 AM
Points: 93, Visits: 195
recovery_model_desc log_reuse_wait_desc
SIMPLE NOTHING
Post #1391872
Posted Monday, December 3, 2012 5:48 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:53 AM
Points: 6,373, Visits: 13,713
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"
Post #1391874
Posted Monday, December 3, 2012 5:50 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:53 AM
Points: 6,373, Visits: 13,713
ravi@sql (12/3/2012)
recovery_model_desc log_reuse_wait_desc
SIMPLE 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"
Post #1391876
Posted Monday, December 3, 2012 5:51 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 24, 2014 11:46 PM
Points: 42, Visits: 290
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.
Post #1391879
Posted Monday, December 3, 2012 5:54 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, May 26, 2014 6:02 AM
Points: 93, Visits: 195
ya maxsize is given for autogrowth
Post #1391882
Posted Monday, December 3, 2012 5:56 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, May 26, 2014 6:02 AM
Points: 93, Visits: 195
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
Post #1391883
Posted Monday, December 3, 2012 6:01 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 24, 2014 11:46 PM
Points: 42, Visits: 290
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

Post #1391886
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse