Is the SQL Server System Session ID 1-50?

Source: Internet
Author: User
Tags server error log

I saw an article in the forum today asking why the session id of the SQL Server system ranges from 1 to 50. I have read this article before, these sessions are used by SQL Server to run system activities such as (lazy writer, ghost record cleanup, DTC commit/abort). Therefore, 50 Session IDs are reserved for SQL Server, user sessions start from 51.

Query user session usage before 2005:

 

Select * from sysprocesses wherespid <50

However, this restriction is no longer available after SQL Server 2005. I found the following article on MSDN: How It Works: System Sessions

Looking at a SQL Server error log it is formatted withDate,TimeAndSession identifier. Identifier of the identifiers contain the s following the spid value.

2008-01-08 20:03:36.12 spid5s

The s indicates that the session is a system session. prior to SQL Server 2005 all system sessions were limited to session ids less than 50. SQL Server 2005 lifted that restriction. in order identify a session during Ming system actives (lazy writer, ghost record cleanup, DTC commit/abort ,...) the sessions are identified as system sessions.

Instead of the older"Select * from sysprocesses where spid <50"You shoshould use"Select * from sys. dm_exec_sessions where is_user_process = 0"To identify system processes.

According to the preceding method, the Session ID of the system may exceed 50.

Select * from sys. dm_exec_sessionswhereis_user_process = 1

Is_user_process

Bit

If the session is a system session, it is 0. Otherwise, it is 1. Cannot be null

For more information, see http://msdn.microsoft.com/zh-cn/library/ms176013 (v = SQL .90). aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.