所有这些 SQL Server 会话来自哪里? [英] Where are all those SQL Server sessions from?
问题描述
在我的开发机器上启动 SSMS (2008 R2) 后,我用
After launching SSMS (2008 R2) on my dev machine, which I launch with
"D:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" -nosplash -S localhost -d testdata
什么都不做,
在活动监视器中,我观察了一些会话(TestData 是我的默认数据库)
without doing anything,
in Activity Monitor I observe some sessions (TestData is my default database)
第 51 场会议的详细信息:
Details of session 51:
select @@spid;
select SERVERPROPERTY('ProductLevel');
第 52 场会议的详细信息:
Details of session 52:
DBCC INPUTBUFFER(52)
第 53 场会议的详细信息:
Details of session 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 场会议的详细信息:
Details of session 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 的会话
If to launch SSMS (connecting to nameless instance by Windows authentication) without options then I do not have session corresponding to above show as 52
我做了什么才能启动所有这些会话?
我只是不记得我之前在我的开发 SQL Server 2008 R2 中所做的所有事情......
What had I done to have all those sessions to be launched ?
I just do not remember all what I had been doing in my dev SQL Server 2008 R2 before...
更新:
我将相同的选项恢复到 SSMS.exe (-nosplash -S localhost -d testdata),重新启动 SSMS,现在我有与会话 51 详细信息相对应的不同详细信息:
Update:
I restored the same options to SSMS.exe (-nosplash -S localhost -d testdata), relaunched SSMS and now I have different details corresponding to session 51 details:
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'
为什么我以前没有?
推荐答案
这些会话被用于将数据拉入活动监视器.
Those sessions are being used to pull data into the Activity Monitor.
这篇关于所有这些 SQL Server 会话来自哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!