SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Log Growing Pains


Log Growing Pains

Author
Message
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: General Forum Members
Points: 144373 Visits: 18651
Oleg Netchaev (3/11/2010)
This is a very good article Jason, thank you.

When recovery model is full, proper handling of the log file growth is of utmost importance, and your article is going to be a great help. It can be somewhat frustrating to run dbcc loginfo() just to discover that there are thousands of segments in the beast yet the value of the last record's status is 2 and, therefore, it cannot be immediately tamed, so it is nice to have a way to quickly identify who done it.

Oleg



Thanks Oleg.

Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Learn Extended Events

george sibbald
george sibbald
SSC Guru
SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)

Group: General Forum Members
Points: 58532 Visits: 13706
Jason, excellent article, in particular your second method for tracking growth. Thanks for taking the time to develop this and then share it with the community.

In your SQL running code do you feel there is any advantage to be had in trapping the actual SQL running at the time rather than the last batch, which I think yours traps. I am thinking of something like this (I take no credit for this code)

SELECT SDER.[session_id], SDER.[request_id],SDER.[statement_start_offset],   
SDER.[statement_end_offset],
CASE
WHEN SDER.[statement_start_offset] > 0 THEN
--The start of the active command is not at the beginning of the full command text
CASE SDER.[statement_end_offset]
WHEN -1 THEN
--The end of the full command is also the end of the active statement
SUBSTRING(DEST.TEXT, (SDER.[statement_start_offset]/2) + 1, 2147483647)
ELSE
--The end of the active statement is not at the end of the full command
SUBSTRING(DEST.TEXT, (SDER.[statement_start_offset]/2) + 1, (SDER.[statement_end_offset] - SDER.[statement_start_offset])/2)
END
ELSE
--1st part of full command is running
CASE SDER.[statement_end_offset]
WHEN -1 THEN
--The end of the full command is also the end of the active statement
RTRIM(LTRIM(DEST.[text]))
ELSE
--The end of the active statement is not at the end of the full command
LEFT(DEST.TEXT, (SDER.[statement_end_offset]/2) +1)
END
END AS [executing statement],
DEST.[text] AS [full statement code]
FROM sys.[dm_exec_requests] SDER CROSS APPLY sys.[dm_exec_sql_text](SDER.[sql_handle]) DEST
WHERE SDER.session_id > 50
ORDER BY SDER.[session_id], SDER.[request_id]



---------------------------------------------------------------------
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: General Forum Members
Points: 144373 Visits: 18651
george sibbald (3/12/2010)
Jason, excellent article, in particular your second method for tracking growth. Thanks for taking the time to develop this and then share it with the community.

In your SQL running code do you feel there is any advantage to be had in trapping the actual SQL running at the time rather than the last batch, which I think yours traps. I am thinking of something like this (I take no credit for this code)



Yes, it is beneficial to trap the actual running code. I will have to compare and contrast the two.

Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Learn Extended Events

Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (507K reputation)SSC Guru (507K reputation)SSC Guru (507K reputation)SSC Guru (507K reputation)SSC Guru (507K reputation)SSC Guru (507K reputation)SSC Guru (507K reputation)SSC Guru (507K reputation)

Group: General Forum Members
Points: 507225 Visits: 44277
That'll teach me... look at the SSC homepage everyday because I might have missed the email. That's the only excuse I have for not seeing this article until today and I'm sticking to it. :-P

Nice article and methods, Jason.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: General Forum Members
Points: 144373 Visits: 18651
Jeff Moden (5/27/2010)
That'll teach me... look at the SSC homepage everyday because I might have missed the email. That's the only excuse I have for not seeing this article until today and I'm sticking to it. :-P

Nice article and methods, Jason.


Thanks Jeff.

Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Learn Extended Events

Paul White
Paul White
SSC Guru
SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)

Group: General Forum Members
Points: 79694 Visits: 11400
Jeff Moden (5/27/2010)
That's the only excuse I have for not seeing this article until today and I'm sticking to it. :-P

I know this isn't as funny as I think it is, but whenever comes late to something, I always think it's because of Jeff's "300 baud" Modem.



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: General Forum Members
Points: 144373 Visits: 18651
Jack Corbett (3/11/2010)
Nice article Jason. I'll be interested in what you find from Event Notifications.



Wow, this has been some time coming. I have not forgotten about the need to do that article. I was just now reviewing my articles and list of age old to-dos and this one popped back up. It might be as a part of a different project at this point - but it should be coming soon. ;-)

Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Learn Extended Events

fercasas
fercasas
Valued Member
Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)

Group: General Forum Members
Points: 56 Visits: 227
Hello,

Very good article Jason, I will use it to monitor the growth of the tempdb database.

I have a question, for my case should only change the line SET @ instanceName = 'tempdb' in SpaceUsed_perfmon procedure, is this correct?

Regards :-)

Fernando Casas Osorio
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: General Forum Members
Points: 144373 Visits: 18651
fercasas (2/19/2013)
Hello,

Very good article Jason, I will use it to monitor the growth of the tempdb database.

I have a question, for my case should only change the line SET @ instanceName = 'tempdb' in SpaceUsed_perfmon procedure, is this correct?

Regards :-)


Thank you.

Yes, change @instanceName to whichever DB you are monitoring. In hindsight, this really should have been more aptly named @DBName.

Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Learn Extended Events

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search