AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 24.12.2013, 14:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Trace Parser Tip - How to find a SQL statement across all sessions
Источник: http://blogs.msdn.com/b/axsupport/ar...-sessions.aspx
==============

I recently had a trace from a customer that had around 60 different sessions. I was trying to find a specific SQL statement in one of the sessions that I had identified in a SQL blocking trace.

However I didn’t want to manually select each session to look for it, and there is no other way to search across all sessions. So I created the following query you can run against the Trace Parser database to locate the session(s) with the statement in:
--Find SQL in all traces

-- Suggest you create the following to improve performance

--CREATE NONCLUSTERED INDEX IX_USP_QueryStatementHash

--ON [dbo].[TraceLines] ([CallTypeId],[QueryStatementHash])

SELECT [T4].[TraceId], [T6].[TraceName], [T5].[UserName], [T2].Statement

FROM [dbo].[TraceLines] AS [T1]

INNER JOIN [dbo].[QueryStatements] AS [T2] ON [T1].[QueryStatementHash] = [T2].[QueryStatementHash]

INNER JOIN [dbo].[UserSessionProcesses] AS [T3] ON [T1].[UserSessionProcessId] = [T3].[UserSessionProcessId]

INNER JOIN [dbo].[UserSessions] AS [T4] ON [T3].[SessionId] = [T4].[SessionId]

INNER JOIN [dbo].[Users] AS [T5] ON [T4].[UserId] = [T5].[UserId]

INNER JOIN [dbo].[Traces] AS [T6] ON [T4].[TraceId] = [T6].[TraceId]

WHERE ([T2].[Statement] LIKE '%queryhere%') AND ([T1].[CallTypeId] = 64)

Edit the %queryhere% above to be something like:
“SELECT A.SALESID,A.DELIVERYNAME,A.ORDERING,A.SALESNAME%”

I would not recommend you try to find the full statement; only use the start of the statement as in the example above.

Use the results to easily find the session in trace parser you wanted to investigate.




Источник: http://blogs.msdn.com/b/axsupport/ar...-sessions.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: AX 2012 Database: How to enable SQL compression (Enterprise edition) Blog bot DAX Blogs 0 21.10.2012 22:13
daxdilip: Tip - How to avoid Overriding of SQL Indexes from AX when a Full Synchronization is done Blog bot DAX Blogs 0 17.05.2011 11:11
daxdilip: Tip - How to avoid Overriding of SQL Indexes from AX when a Full Synchronization is done Blog bot DAX Blogs 0 12.05.2011 08:11
emeadaxsupport: How to trace AIF Web service SOAP message Blog bot DAX Blogs 0 06.12.2010 16:11
emeadaxsupport: How to fix SQL error: "Too many parameters were provided in this RPC request" Blog bot DAX Blogs 0 01.09.2009 15:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:10.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.