Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 Performance Tuning
»
How to find the start time of query in the...
12 posts, Page 1 of 2
1
2
»»
How to find the start time of query in the database
Rate Topic
Display Mode
Topic Options
Author
Message
anusharani_c
anusharani_c
Posted Friday, July 24, 2009 2:35 PM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, August 26, 2009 12:01 PM
Points: 8,
Visits: 13
I am creating a stored procedure to identify, and kill a long running Business Objects query in the SQL Server database. I am able to identify the BO SQL iin the database with the BO user id, and also able to check the status "RUNNABLE" in sys_processes table, but last_batch column keeps updating timestamp for EACH REQUEST sent to the DB for the same BO query. Hence, I am unable to identify the start time, and to find out how long the BO SQL has been running. Does anyone know, how can I accomplish this ?
Post #759513
vstitte
vstitte
Posted Saturday, July 25, 2009 1:38 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, January 18, 2012 7:43 AM
Points: 350,
Visits: 406
What version of SQL Server are running?
Post #759586
vstitte
vstitte
Posted Saturday, July 25, 2009 1:43 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, January 18, 2012 7:43 AM
Points: 350,
Visits: 406
Check this article. See if this helps.
http://www.sqlservercentral.com/scripts/T-SQL/66830/
Post #759589
Grant Fritchey
Grant Fritchey
Posted Monday, July 27, 2009 6:54 AM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 9:49 AM
Points: 13,436,
Visits: 25,281
For 2005/2008, take a look at sys.dm_exec_syessions. It will give you a basic breakdown of information for the connections in the system, including start times on the last batch. For more detailed information, take a look at sys.dm_exec_requests. That will give you very specific information about what a process is waiting for, what it's doing, what statement it's on within the batch, etc. In some cases, not all, not even most, it will also show a percent complete, but don't rely on that value in any way. It may or may not be accurate and useful.
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #760017
anusharani_c
anusharani_c
Posted Monday, July 27, 2009 7:50 AM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, August 26, 2009 12:01 PM
Points: 8,
Visits: 13
SQL 2005
Post #760059
anusharani_c
anusharani_c
Posted Monday, July 27, 2009 7:54 AM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, August 26, 2009 12:01 PM
Points: 8,
Visits: 13
This SP gets the start time of the running SQL from system table dm_exec_* and system function dm_exec_sql.
My understanding is ->One SQL sends multiple requests to the db, the start time in dm_* tables all point to the start time of EACH REQUEST, thus at a given point of time, I am unable to determine when the SQL started.
Post #760066
anusharani_c
anusharani_c
Posted Monday, July 27, 2009 7:55 AM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, August 26, 2009 12:01 PM
Points: 8,
Visits: 13
My understanding is ->One SQL sends multiple requests to the db, the start time in dm_exec_* tables all point to the start time of EACH REQUEST, thus at a given point of time, I am unable to determine when the SQL started.
Post #760067
Grant Fritchey
Grant Fritchey
Posted Monday, July 27, 2009 8:25 AM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 9:49 AM
Points: 13,436,
Visits: 25,281
When you say SQL, do you mean an individual SQL statement? One that is currently running? I'm not entirely sure, but you may not be able to drill down to that level without capturing statements in a trace. That's one way of doing it, but you would already have to have the trace in place. You couldn't turn it on in a moment's notice.
I'll have to test the DMV to see if it records a statement or a batch start time.
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #760106
anusharani_c
anusharani_c
Posted Monday, July 27, 2009 9:53 AM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, August 26, 2009 12:01 PM
Points: 8,
Visits: 13
I mean the Report SQL which is running in the db. I am trying to identify the start time of the report SQL.
Post #760197
Grant Fritchey
Grant Fritchey
Posted Monday, July 27, 2009 11:08 AM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 9:49 AM
Points: 13,436,
Visits: 25,281
I'm not trying to be obtuse, I just don't understand what you are referring to. Do you mean queries coming from Reporting Services?
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #760247
« Prev Topic
|
Next Topic »
12 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.