Showing posts with label Finding User Sessions from SPID. Show all posts
Showing posts with label Finding User Sessions from SPID. Show all posts

Wednesday, January 21, 2015

Map SQL SPID with AX session ID in Dynamics AX 2012

In Microsoft Dynamics AX 2012 the SPID column is no longer available on the “Online Users” form. However, Information about the user sessions can be directly included in the SQL connection context with a small performance overhead (That is why it is not turned on by default).

To include user session information in the connection context perform the following steps:

1.     Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dynamics Server\6.0\01\Original (installed configuration). Key named "Original" (installed configuration), is the key name for the current server configuration (if original installed configuration is active configuration).
2.     Create a string registry value called ‘connectioncontext’ and set the value to 1.
3.     Restart the AOS.
Now open SQL Server Management Studio and execute following query

select cast(context_info as varchar(128)) as CI,* from sys.dm_exec_sessions where program_name like '%Dynamics%'


For sample example, it will look like


Second item in the CI column is session ID and second column is your SPID. Open Online user form to map these two values and you'll be able to map. Hope this is helpful. Remember to monitor performance impact because of this registry edit. Enable it only if you are having blocking threads and not able to identify the real cause.