Home > Database > Mysql Tutorial > 如何获取SQLServer数据库的连接数

如何获取SQLServer数据库的连接数

WBOY
Release: 2016-06-07 15:46:14
Original
1528 people have browsed it

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入 1: V_SYS_CONTRACTIONS (获取系统连接数) SELECT COUNT(*) AS CONNECTIONS FROM master.sys.sysprocesses 2: V_SYS_DB_CONTRACTIONS(获取某数据的连接数) SELECT hostname, program_name, ho

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入

  1: V_SYS_CONTRACTIONS (获取系统连接数)

  SELECT COUNT(*) AS CONNECTIONS  FROM  master.sys.sysprocesses

  2: V_SYS_DB_CONTRACTIONS(获取某数据的连接数)

  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(获取网路地址连接数)

  SELECT    COUNT(DISTINCT net_address) - 1 AS connectnum  FROM master.sys.sysprocesses

  4: V_SYS_USER_CONTRACTIONS(获取用户连接数)

  SELECT    cntr_value AS User_Connections

  FROM        master.sys.sysperfinfo AS p

  WHERE    (object_name = 'SQLServer:General Statistics')

  AND (counter_name = 'User Connections')

如何获取SQLServer数据库的连接数

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template