How to obtain the number of connections to the SQLServer Database

Source: Internet
Author: User
Welcome to the Windows community forum and interact with 3 million technical staff to enter 1: V_SYS_CONTRACTIONS (getting System connections) SELECTCOUNT (*) ASCONNECTIONSFROMmaster. sys. sysprocesses2: V_SYS_DB_CONTRACTIONS (number of connections to obtain data) SELECThostname, program_name, ho

Welcome to the Windows community forum and interact with 3 million technical staff> go to 1: V_SYS_CONTRACTIONS (getting System CONNECTIONS) select count (*) as connections from master. sys. sysprocesses 2: V_SYS_DB_CONTRACTIONS (number of connections to obtain data) SELECT hostname, program_name, ho

Welcome to the Windows community forum and interact with 3 million technicians>

1: V_SYS_CONTRACTIONS (getting System connections)

Select count (*) as connections from master. sys. sysprocesses

2: V_SYS_DB_CONTRACTIONS (number of connections to obtain data)

SELECT hostname, program_name, hostprocess, cmd, spid, kpid, blocked, waittype, waittime, lastwaittype, waitresource, dbid, uid, cpu, physical_io, memusage, login_time,

Last_batch, ecid, open_tran, status, sid, nt_domain, nt_username, net_address, net_library, loginame, context_info, SQL _handle, stmt_start, stmt_end, request_id

FROM master. sys. sysprocesses

WHERE (dbid =

(SELECT dbid

FROM master. sys. sysdatabases

WHERE (name = 'xxdbname ')))

3: V_SYS_NET_CONRACTIONS (number of network address connections)

Select count (DISTINCT net_address)-1 AS connectnum FROM master. sys. sysprocesses

4: V_SYS_USER_CONTRACTIONS (getting user connections)

SELECT cntr_value AS User_Connections

FROM master. sys. sysperfinfo AS p

WHERE (object_name = 'sqlserver: General Statistics ')

AND (counter_name = 'user connections ')

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.