2010-10-26 17 views
7

Dopo aver lanciato SSMS (2008 R2) sulla mia macchina dev, che mi lancio conDa dove provengono tutte le sessioni di SQL Server?

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

senza fare nulla,
in Activity Monitor osservo alcune sedute (TestData è il mio database predefinito)

alt text

dettagli di sessione 51:

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

dettagli di sessione 52:

DBCC INPUTBUFFER(52) 

dettagli di sessione di 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 

dettagli di sessione di 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; 

Se per lanciare SSMS (connessione a senza nome esempio tramite l'autenticazione di Windows) senza opzioni quindi non ho la sessione corrispondente al precedente show come 52

Che cosa avevo fatto per avviare tutte queste sessioni?
io proprio non mi ricordo tutto quello che avevo fatto nella mia dev SQL Server 2008 R2 prima ...

Aggiornamento:
Ho ripristinato le stesse opzioni per SSMS.exe (-nosplash -S localhost - d testdata), rilanciata SSMS e ora ho diversi dettagli corrispondente alla sessione di 51 dettagli:

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' 

Perché non ho dovuto prima?

risposta

12

Queste sessioni vengono utilizzate per inserire dati nel monitor Attività.

Problemi correlati