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 ««123»»

Full Transaction log Expand / Collapse
Author
Message
Posted Wednesday, March 18, 2009 7:59 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, October 17, 2014 7:48 AM
Points: 2,040, Visits: 1,667
See Kimberly's blog post 8 Steps to better Transaction Log throughput and my blogs
Search Engine Q&A #1: Running out of transaction log space and
Search Engine Q&A #23: My transaction log is full - now what?

Thanks


Paul Randal
CEO, SQLskills.com: Check out SQLskills online training!
Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005
Post #678489
Posted Wednesday, March 18, 2009 8:14 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:25 AM
Points: 40,172, Visits: 36,566
Your first suggestion for a full tran log is to shrink it. Maybe I'm missing something, but that's completely the opposite of what's needed.

The log is full, ie, there is no free space within the log file. Since there is no free space within the log file, a shrink will find no space to release to the OS. Even if the shrink did find some free space, that'll just make the situation worse.

If the log file is full you need to either reduce the amount of data inside it by either backing the log up or switching to simple recovery, or you need to grow the log file to give it more space.




Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #678509
Posted Wednesday, March 18, 2009 8:21 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, October 17, 2014 6:32 AM
Points: 141, Visits: 422
Can we discuss truncate trans. log in replication environment?

Here we have publisher database having tran. log with large size even though we have log backup and full backup in place. What is the best practice to truncate trans. log on publisher database?

I'm looking for step by step instruction here.

thanks

Post #678523
Posted Wednesday, March 18, 2009 9:04 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 12:10 PM
Points: 1,414, Visits: 4,541
most of my full log issues have been because of replication. for some reason it didn't truncate the log. so the solution is to reinitialize the publication and it almost always works. once or twice we had to delete and rebuild the publication.

on db's where we don't run log backups, we do backup log with no_log on a regular schedule and keep the db's in simple recovery mode


https://plus.google.com/100125998302068852885/posts?hl=en
http://twitter.com/alent1234
x-box live gamertag: i am null
[url=http://live.xbox.com/en-US/MyXbox/Profile[/url]
Post #678588
Posted Wednesday, March 18, 2009 9:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 26, 2012 3:23 PM
Points: 8, Visits: 31
Krishna,

I thought I'd post another alternative which I didn't see in your article. I've used this in the past, with good results. This method allows me to run it on a live database without causing issues. At the same time, I have had issues where the log file never seemed to decrease after a shrinkdatabase...this has had 100% good results. Of course, the disclaimer would be that you are definitely purging the log file(s), so there is no going back if you didn't back them up.

USE [AdventureWorks]
DUMP TRAN [AdventureWorks] WITH NO_LOG
GO
DBCC SHRINKDATABASE ('AdventureWorks', 1)
Post #678605
Posted Wednesday, March 18, 2009 9:27 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:25 AM
Points: 40,172, Visits: 36,566
GNUZEN (3/18/2009)
Here we have publisher database having tran. log with large size even though we have log backup and full backup in place. What is the best practice to truncate trans. log on publisher database?


The best practice, in any environment is not to ever truncate the transaction log. That means none of the following:
BACKUP LOG MyImportantDB WITH NO_LOG
BACKUP LOG MyImportantDB WITH TRUNCATE_ONLY
DUMP TRAN MyImportantDB WITH NO_LOG

All of those break the log chain. That means no log backups and no point in time restores after that until a full backup is run.

With replication, a full log is often the result of the log reader not running or running slowly. Either way, the solution is to fix the problem with the log reader. The inactive log entries cannot be removed until the log reader has processed them.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #678622
Posted Wednesday, March 18, 2009 9:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 26, 2012 3:23 PM
Points: 8, Visits: 31
Gail,

In response to your post, let me add that I believe a backup should be done in conjunction with the DUMP TRAN, when used. There are a number of methods that should probably be addressed prior to a DUMP TRAN WITH NO_LOG or some such. However, I would hesitate to say never, after all there is a time and place for anything.

So, I would say the best practices would include addressing issues based on their merits and using the tools required to accomplish the job at hand in the most effective and efficient way within a given time frame.

This is definitely a moot point and there are a varied number of arguments to be made for which methods to use when. I will have to stand by what I said that I thought this method should have been included (perhaps with a bit more detail and disclaimer).

-Joseph Foster
Post #678648
Posted Wednesday, March 18, 2009 10:02 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:25 AM
Points: 40,172, Visits: 36,566
BACKUP LOG MyImportantDB WITH NO_LOG
BACKUP LOG MyImportantDB WITH TRUNCATE_ONLY
DUMP TRAN MyImportantDB WITH NO_LOG



Just an additional point. All three of those were deprecated in SQL 2005 and removed in SQL 2008. From 2008 onwards the only way to remove inactive entries from the log is to either back it up or set the database to simple recovery.

BACKUP LOG AdventureWorks WITH NO_LOG

Msg 3032, Level 16, State 2, Line 1
One or more of the options (no_log) are not supported for this statement. Review the documentation for supported options.

BACKUP LOG AdventureWorks WITH TRUNCATE_ONLY

Msg 155, Level 15, State 1, Line 1
'TRUNCATE_ONLY' is not a recognized BACKUP option.

DUMP TRAN AdventureWorks WITH NO_LOG

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'TRAN'.




Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #678668
Posted Wednesday, March 18, 2009 10:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 26, 2012 3:23 PM
Points: 8, Visits: 31
Gail,

Good point and well taken.

That should probably go along with the best practices: keep an eye out to upcoming versions.

For those using pre-SQL 2008 servers, this would still be in the toolbox if needed and should be used with their scope in mind.
Post #678690
Posted Wednesday, March 18, 2009 1:51 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:25 AM
Points: 40,172, Visits: 36,566
jfoster (3/18/2009)
For those using pre-SQL 2008 servers, this would still be in the toolbox if needed and should be used with their scope in mind.


I'd say no, even pre-2008, either back the log up to disk or switch (temporarily) to simple recovery. Both will result in exactly the same log truncation that backup ... with truncate_only does, the first doesn't break the log chain, the second does but at least it's pretty obvious what's actually happening.

The problem I have with backup ... with truncate only is that it's used and recommended without people realising what it actually does. ALTER DATABASE ... SET RECOVERY SIMPLE makes it pretty clear that you're not in full recovery any longer



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #678868
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse