【问题标题】:Where are all those SQL Server sessions from?所有这些 SQL Server 会话来自哪里?
【发布时间】:2010-10-26 07:12:24
【问题描述】:

在我的开发机器上启动 SSMS (2008 R2) 后,我使用

"D:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" -nosplash -S localhost -d testdata

什么都不做,
在活动监视器中,我观察到一些会话(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, @previous_collection_time, @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' 

为什么我以前没有它?

【问题讨论】:

    标签: sql-server session ssms


    【解决方案1】:

    这些会话用于将数据拉入活动监视器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-18
      • 2017-07-11
      • 2012-08-08
      • 1970-01-01
      • 1970-01-01
      • 2021-12-14
      • 2019-04-09
      • 2014-02-25
      相关资源
      最近更新 更多