Archivio

Archive for giugno 2010

SQL Server [dba] – Visualizza/Kill connessione attive (tranne la propria)

Stored Procedure:

CREATE  PROCEDURE  usp_UtiNX_DbActiveConn(
 @pDatabaseName nvarchar(50),
 @pAction char(1) = NULL
)
AS
-- Descriz.: UTILITY NX
--           Visualizza/Kill delle connessione attive tranna la propria(@@spid)
--
-- Autore:   NX
-- Utilizzo:
--    (view connections)    exec [usp_UtiNX_DbActiveConn] 'aism_bandi'
--    (kill connections)    exec [usp_UtiNX_DbActiveConn] '_UTI_NX', 'k'
--
--DECLARE @DatabaseName nvarchar(50)
--SET @DatabaseName = N'_UTI_NX'
--
IF @pAction IS NULL
BEGIN
 -- Visualizza Connessioni
 SELECT spid, loginame, login_time, hostname, program_name, cmd  FROM MASTER..SysProcesses
 WHERE DBId = DB_ID(@pDatabaseName) AND SPId <> @@spid
END

IF @pAction = 'k'
BEGIN
 DECLARE @SPId int
 DECLARE @SQLStmt varchar(100)

 -- Gestione cursore/fetch
 DECLARE my_cursor CURSOR FAST_FORWARD FOR
 SELECT SPId FROM MASTER..SysProcesses WHERE DBId = DB_ID(@pDatabaseName) AND SPId <> @@spid

 OPEN my_cursor
 FETCH NEXT FROM my_cursor INTO @SPId

 WHILE @@FETCH_STATUS = 0
 BEGIN
 -- KILL @SPId
 SET @SQLStmt = 'KILL ' + CAST(@SPId AS varchar(100))
 EXEC(@SQLStmt)
 print 'eseguito:' + @SQLStmt

 FETCH NEXT FROM my_cursor INTO @SPId
 END

 CLOSE my_cursor
 DEALLOCATE my_cursor
END
RETURN

SQL Server [dba] – verifica della versione installata e della SP (Service Pack)

per visualizzare Versione SQL Server eseguire la seguente query:

SELECT SERVERPROPERTY ('edition') as edition,
SERVERPROPERTY('productversion') as productversion,
SERVERPROPERTY ('productlevel') as productlevel
Oppure
SELECT @@VERSION
Oppure
sp_server_info
Oppure
master..xp_msver

*** ***

Service Pack Support for SQL Server:
http://blogs.msdn.com/b/sqlreleaseservices/archive/2009/10/08/end-of-service-pack-support-for-sql-server-2005-sp2-and-sql-server-2008-rtm.aspx

Ricerca ciclo di vita prodotti Microsoft
http://support.microsoft.com/lifecycle/search/