加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – 所有那些SQL Server会话来自哪里?

发布时间:2020-12-12 07:08:54 所属栏目:MsSql教程 来源:网络整理
导读:在我启动的开发机器上启动SSMS(2008 R2)之后 "D:Program FilesMicrosoft SQL Server100ToolsBinnVSShellCommon7IDESsms.exe" -nosplash -S localhost -d testdata 什么都不做 在Activity Monitor中我观察了一些会话(TestData是我的默认数据库) 第51
在我启动的开发机器上启动SSMS(2008 R2)之后
"D:Program FilesMicrosoft SQL Server100ToolsBinnVSShellCommon7IDESsms.exe" -nosplash -S localhost -d testdata

什么都不做
在Activity Monitor中我观察了一些会话(TestData是我的默认数据库)

第51场会议详情:

select @@spid;
select SERVERPROPERTY('ProductLevel');

第52场会议详情:

DBCC INPUTBUFFER(52)

第53次会议详情:

SELECT
CAST(serverproperty(N'Servername') AS sysname) AS [Name],'Server[@Name=' + quotename(CAST(
        serverproperty(N'Servername')
       AS sysname),'''') + ']' + '/JobServer' AS [Urn]
ORDER BY
[Name] ASC

会议54的详细信息:

SET NOCOUNT ON;

DECLARE @previous_collection_time datetime;
DECLARE @previous_request_count bigint;
DECLARE @current_collection_time datetime;
DECLARE @current_request_count bigint;
DECLARE @batch_requests_per_sec bigint;
DECLARE @interval_sec bigint;

-- Get the previous snapshot's time and batch request count
SELECT TOP 1 @previous_collection_time = collection_time,@previous_request_count = request_count 
FROM #am_request_count
ORDER BY collection_time DESC;

-- Get the current total time and batch request count
SET @current_collection_time = GETDATE();
SELECT @current_request_count = cntr_value 
FROM sys.sysperfinfo
WHERE counter_name = 'Batch Requests/sec' COLLATE Latin1_General_BIN;

SET @interval_sec = 
    -- Avoid divide-by-zero
    CASE
        WHEN DATEDIFF (second,@previous_collection_time,@current_collection_time) = 0 THEN 1
        ELSE DATEDIFF (second,@current_collection_time)
    END;

-- Calc the Batch Requests/sec rate for the just-completed time interval. 
SET @batch_requests_per_sec = (@current_request_count - @previous_request_count) / @interval_sec;

-- Save off current batch count
INSERT INTO #am_request_count (collection_time,request_count) 
VALUES (@current_collection_time,@current_request_count);

-- Return the batch requests/sec rate for the just-completed time interval. 
SELECT ISNULL (@batch_requests_per_sec,0) AS batch_requests_per_sec;

-- Get rid of all but the most recent snapshot's data
DELETE FROM #am_request_count WHERE collection_time < @current_collection_time;

如果在没有选项的情况下启动SSMS(通过Windows身份验证连接到无名实例),那么我没有对应于上面显示为52的会话

我做了什么才能启动所有这些会议?
我只是不记得我之前在我的开发SQL Server 2008 R2中所做的一切……

更新:
我将相同的选项恢复到SSMS.exe(-nosplash -S localhost -d testdata),重新启动SSMS,现在我有与会话51详细信息对应的不同详细信息:

DECLARE @edition sysname; 
SET @edition = cast(SERVERPROPERTY(N'EDITION') as sysname); 
select case when @edition = N'SQL Azure' then 1 else 0 end as 'IsCloud'

为什么我以前没有呢?

解决方法

这些会话用于将数据提取到活动监视器中.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读