Empty Login Name When Showing sys.processes

﹥>﹥吖頭↗ 提交于 2019-12-11 10:37:05

问题


As per the issue here: SQL Query continues running for a very long time if search term not found

I faced an issue that my Azure website hits 100% DTU very fast as soon as I publish the search feature to the public.

After further investigation, I ran the following query to show all processes on my database:

SELECT 
    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
FROM
    sys.sysprocesses
WHERE 
    dbid > 0
GROUP BY 
    dbid, loginame

The weird thing is that in addition to the row which has my login name used in the connection string in my webapp, I see another line which shows empty login name and it has many connections which increase greatly if I enable the search feature.

Can someone please explain the empty login name?

Thank you

Update: I was also able to run the following query:

    SELECT
    c.session_id, c.net_transport, c.encrypt_option,
    s.status,
    c.auth_scheme, s.host_name, s.program_name,
    s.client_interface_name, s.login_name, s.nt_domain,
    s.nt_user_name, s.original_login_name, c.connect_time,
    s.login_time
FROM sys.dm_exec_connections AS c
JOIN sys.dm_exec_sessions AS s
    ON c.session_id = s.session_id
--WHERE c.session_id = @@SPID;
--WHERE status = 'sleeping'
ORDER BY c.connect_time ASC 

Which gives the following: Please note the empty login name, I get a lot of similar connections...

来源:https://stackoverflow.com/questions/44393287/empty-login-name-when-showing-sys-processes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!