You are on page 1of 10

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

Skip Navigation

Iniciar sesin

Soporte

Buscar soluciones Preguntar en los foros Obtener ayuda ahora

Seleccione el producto para el cual necesita ayuda

Windows

Internet Explorer

Office

Xbox

Media Player

Skype

Windows Phone

Ms productos

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000


Id. de artculo: 271509 - Ver los productos a los que se aplica este artculo

Seleccione idioma
(

Este artculo se public anteriormente con el nmero E271509 Expandir todo | Contraer todo

Resumen
Este artculo es una actualizacin para Microsoft SQL Server 2000 o las versiones posteriores de SQL Server del siguiente artculo de Microsoft Knowledge Base, que se aplica a Microsoft SQL Server 7.0: 251004 Cmo supervisar el bloqueo en SQL Server 7.0 Este artculo documenta el uso y el diseo de un procedimiento almacenado que puede utilizar para diagnosticar problemas de bloqueo y rendimiento. Para obtener una descripcin acerca de cmo entender y resolver los bloqueos, consulte el siguiente artculo en Microsoft Knowledge Base: 224453 Descripcin y solucin de problemas de bloqueo en SQL Server 7.0 o SQL Server 2000 En Microsoft SQL Server 2005 tambin puede utilizar la clase de eventos Blocked Process Report del Analizador de SQL Server para capturar informacin acerca de una tarea que se ha bloqueado durante ms tiempo del especificado. Para obtener ms informacin acerca de la clase de eventos Blocked Process Report, visite el siguiente sitio Web de Microsoft Developer Network (MSDN): http://msdn2.microsoft.com/es-es/library/ms191168.aspx

Ms informacin
La siguiente descripcin del procedimiento almacenado sp_blocker_pss80 captura esta informacin. Esta informacin tambin es vlida para SQL Server 2005. Hora de inicio (segn el equipo en el que se ejecuta SQL Server) para poder relacionar temporalmente esta muestra de bloqueo con otra informacin de rendimiento, como el registro del Monitor de sistema de Microsoft Windows NT o un registro del Analizador de SQL Server. Informacin acerca de conexiones con SQL Server, para lo que se consulta la tabla del sistema sysprocesses . Informacin acerca de los recursos de bloqueo, para lo que se consulta la tabla del sistema syslockinfo . Informacin acerca de las esperas de los recursos, para lo que se ejecuta DBCC SQLPERF(WAITSTATS). El lote de SQL Server que se ejecuta actualmente para las conexiones bloqueadas por otros o que bloquean a otros, para lo que se ejecuta la instruccin DBCC INPUTBUFFER. Hora de finalizacin, segn el equipo en el que se ejecuta SQL Server. Al crear el procedimiento almacenado se implementaron las siguientes optimizaciones para reducir el efecto que tendra su ejecucin en el rendimiento y en los bloqueos: No se genera ningn resultado si no hay al menos una conexin en espera en un recurso. Se consulta directamente a las tablas del sistema sysprocesses y syslockinfo de la base de datos master para aumentar el rendimiento e impedir que se bloquee este procedimiento almacenado. Por tanto, este procedimiento almacenado es especfico de Microsoft SQL Server 2000 o de versiones posteriores de SQL Server. El cursor crea una pequea tabla de trabajo para obtener el resultado de DBCC INPUTBUFFER; esto no debe tener ningn efecto apreciable sobre el uso de la base de datos tempdb . Como los bloqueos pueden cambiar mientras se recopila la informacin, existe un modo rpido que aumenta el rendimiento, para lo que reduce el nmero de resultados a las filas relevantes de las tablas del sistema sysprocesses y syslockinfo . Si intenta realizar un seguimiento de las esperas de recursos no debidas a bloqueos, existe un modo de pestillo que hace que se omita el resultado del bloqueo. Este procedimiento almacenado resulta til para su ejecucin desde cualquier herramienta de consulta. Sin embargo, Microsoft recomienda seguir estos pasos para realizar un anlisis del bloqueo: 1. Cree el procedimiento almacenado sp_blocker_pss80 , que se incluye al final de este artculo, desde cualquier herramienta de consulta mientras est conectado con un inicio de sesin que tenga privilegios sysadmin en el servidor con SQL Server o en la instancia de SQL Server que desea supervisar.

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

2. Cree un archivo de comandos con la siguiente consulta para ejecutar el procedimiento almacenado en un bucle. Tenga en cuenta que el retardo debe estar entre 5 y 60 segundos: WHILE 1=1 BEGIN EXEC master.dbo.sp_blocker_pss80 -- Or for fast mode -- EXEC master.dbo.sp_blocker_pss80 @fast=1 -- Or for latch mode -- EXEC master.dbo.sp_blocker_pss80 @latch=1 WAITFOR DELAY '00:00:15' END GO 3. Este resultado es muy til cuando se combina con un registro del Monitor de sistema de Microsoft Windows NT y un registro del Analizador de SQL Server, por lo que se recomienda crear ambos al mismo tiempo. Para obtener informacin acerca de los eventos del Analizador y del Monitor de sistema que es necesario capturar, as como acerca de cmo interpretar los resultados, consulte el siguiente artculo en Microsoft Knowledge Base: 224453 Descripcin y solucin de problemas de bloqueo en SQL Server 7.0 o SQL Server 2000 4. Ejecute el archivo de comandos creado en el paso 2 desde Isql.exe, la herramienta de consulta Osql.exe o la utilidad Sqlcmd en un smbolo del sistema de Windows del equipo en el que se ejecuta SQL Server que desea supervisar para evitar que los problemas de red desconecten la herramienta de consulta. A continuacin se muestra una lnea de comandos de ejemplo que puede utilizar para iniciar Osql.exe, que supone que el cliente se ejecuta desde el equipo donde se ejecuta SQL Server y que el nombre del archivo de comandos es Checkblk.sql. Asegrese de corregir el parmetro -S y reemplazar "server" con el nombre del servidor de SQL Server (o "servername\instance" si est supervisando una instancia con nombre). Corrija tambin el parmetro -i y reemplace "checkblk.sql" con la ruta de acceso y el nombre del archivo de comandos creado en el paso 2. osql -E -Sserver -icheckblk.sql -ocheckblk.out -w2000 Tenga en cuenta que debe utilizar los dems modificadores de la lnea de comandos por las razones siguientes: Para evitar el ajuste de lnea en los archivos de salida con el fin de facilitar su lectura. Para enviar el resultado a un archivo, especificado con el parmetro -o, en lugar de a la pantalla, de forma que si la herramienta de consulta tiene problemas siga teniendo la posibilidad de examinar el archivo si se produce un error en la herramienta. A continuacin se muestra el archivo de comandos para crear el procedimiento almacenado sp_blocker_pss80 : use master GO if exists (select * from sysobjects where id = object_id('dbo.sp_blocker_pss80') and sysstat & 0xf = 4) drop procedure dbo.sp_blocker_pss80 GO create procedure dbo.sp_blocker_pss80 (@latch int = 0, @fast int = 1, @appname sysname='PSSDIAG') as --version 17SP3 if is_member('sysadmin')=0 begin print 'Must be a member of the sysadmin group in order to run this procedure' return end set nocount on SET LANGUAGE 'us_english' declare @spid varchar(6) declare @blocked varchar(6) declare @time datetime declare @time2 datetime declare @dbname nvarchar(128) declare @status sql_variant declare @useraccess sql_variant set @time = getdate() declare @probclients table(spid smallint, ecid smallint, blocked smallint, waittype binary(2), dbid smallint, ignore_app tinyint, primary key (blocked, spid, ecid)) insert @probclients select spid, ecid, blocked, waittype, dbid, case when convert(varchar(128),hostname) = @appname then 1 else 0 end from master.dbo.sysprocesses where blocked!=0 or waittype != 0x0000 if exists (select spid from @probclients where ignore_app != 1 or waittype != 0x020B) begin set @time2 = getdate() print '' print '8.2 Start time: ' + convert(varchar(26), @time, 121) + ' ' + convert(varchar(12), datediff(ms,@time,@time2)) insert @probclients select distinct blocked, 0, 0, 0x0000, 0, 0 from @probclients where blocked not in (select spid from @probclients) and blocked != 0 if (@fast = 1) begin print '' print 'SYSPROCESSES ' + ISNULL (@@servername,'(null)') + ' ' + str(@@microsoftversion)

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

select spid, status, blocked, open_tran, waitresource, waittype, waittime, cmd, lastwaittype, cpu, physical_io, memusage, last_batch=convert(varchar(26), last_batch,121), login_time=convert(varchar(26), login_time,121),net_address, net_library, dbid, ecid, kpid, hostname, hostprocess, loginame, program_name, nt_domain, nt_username, uid, sid, sql_handle, stmt_start, stmt_end from master.dbo.sysprocesses where blocked!=0 or waittype != 0x0000 or spid in (select blocked from @probclients where blocked != 0) or spid in (select spid from @probclients where blocked != 0) print 'ESP ' + convert(varchar(12), datediff(ms,@time2,getdate())) print '' print 'SYSPROC FIRST PASS' select spid, ecid, waittype from @probclients where waittype != 0x0000 if exists(select blocked from @probclients where blocked != 0) begin print 'Blocking via locks at ' + convert(varchar(26), @time, 121) print '' print 'SPIDs at the head of blocking chains' select spid from @probclients where blocked = 0 and spid in (select blocked from @probclients where spid != 0) if @latch = 0 begin print 'SYSLOCKINFO' select @time2 = getdate() select spid = convert (smallint, req_spid), ecid = convert (smallint, req_ecid), rsc_dbid As dbid, rsc_objid As ObjId, rsc_indid As IndId, Type = case rsc_type when 1 then 'NUL' when 2 then 'DB' when 3 then 'FIL' when 4 then 'IDX' when 5 then 'TAB' when 6 then 'PAG' when 7 then 'KEY' when 8 then 'EXT' when 9 then 'RID' when 10 then 'APP' end, Resource = substring (rsc_text, 1, 16), Mode = case req_mode + 1 when 1 then NULL when 2 then 'Sch-S' when 3 then 'Sch-M' when 4 then 'S' when 5 then 'U' when 6 then 'X' when 7 then 'IS' when 8 then 'IU' when 9 then 'IX' when 10 then 'SIU' when 11 then 'SIX' when 12 then 'UIX' when 13 then 'BU' when 14 then 'RangeS-S' when 15 then 'RangeS-U' when 16 then 'RangeIn-Null' when 17 then 'RangeIn-S' when 18 then 'RangeIn-U' when 19 then 'RangeIn-X' when 20 then 'RangeX-S' when 21 then 'RangeX-U' when 22 then 'RangeX-X'end, Status = case req_status when 1 then 'GRANT' when 2 then 'CNVT' when 3 then 'WAIT' end, req_transactionID As TransID, req_transactionUOW As TransUOW from master.dbo.syslockinfo s, @probclients p where p.spid = s.req_spid print 'ESL ' + convert(varchar(12), datediff(ms,@time2,getdate())) end -- latch not set end else print 'No blocking via locks at ' + convert(varchar(26), @time, 121) print '' end -- fast set

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

else begin -- Fast not set print '' print 'SYSPROCESSES ' + ISNULL (@@servername,'(null)') + ' ' + str(@@microsoftversion) select spid, status, blocked, open_tran, waitresource, waittype, waittime, cmd, lastwaittype, cpu, physical_io, memusage, last_batch=convert(varchar(26), last_batch,121), login_time=convert(varchar(26), login_time,121),net_address, net_library, dbid, ecid, kpid, hostname, hostprocess, loginame, program_name, nt_domain, nt_username, uid, sid, sql_handle, stmt_start, stmt_end from master.dbo.sysprocesses print 'ESP ' + convert(varchar(12), datediff(ms,@time2,getdate())) print '' print 'SYSPROC FIRST PASS' select spid, ecid, waittype from @probclients where waittype != 0x0000 if exists(select blocked from @probclients where blocked != 0) begin print 'Blocking via locks at ' + convert(varchar(26), @time, 121) print '' print 'SPIDs at the head of blocking chains' select spid from @probclients where blocked = 0 and spid in (select blocked from @probclients where spid != 0) if @latch = 0 begin print 'SYSLOCKINFO' select @time2 = getdate() select spid = convert (smallint, req_spid), ecid = convert (smallint, req_ecid), rsc_dbid As dbid, rsc_objid As ObjId, rsc_indid As IndId, Type = case rsc_type when 1 then 'NUL' when 2 then 'DB' when 3 then 'FIL' when 4 then 'IDX' when 5 then 'TAB' when 6 then 'PAG' when 7 then 'KEY' when 8 then 'EXT' when 9 then 'RID' when 10 then 'APP' end, Resource = substring (rsc_text, 1, 16), Mode = case req_mode + 1 when 1 then NULL when 2 then 'Sch-S' when 3 then 'Sch-M' when 4 then 'S' when 5 then 'U' when 6 then 'X' when 7 then 'IS' when 8 then 'IU' when 9 then 'IX' when 10 then 'SIU' when 11 then 'SIX' when 12 then 'UIX' when 13 then 'BU' when 14 then 'RangeS-S' when 15 then 'RangeS-U' when 16 then 'RangeIn-Null' when 17 then 'RangeIn-S' when 18 then 'RangeIn-U' when 19 then 'RangeIn-X' when 20 then 'RangeX-S' when 21 then 'RangeX-U' when 22 then 'RangeX-X'end, Status = case req_status when 1 then 'GRANT' when 2 then 'CNVT' when 3 then 'WAIT' end, req_transactionID As TransID, req_transactionUOW As TransUOW from master.dbo.syslockinfo print 'ESL ' + convert(varchar(12), datediff(ms,@time2,getdate())) end -- latch not set end else print 'No blocking via locks at ' + convert(varchar(26), @time, 121) print '' end -- Fast not set

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

print 'DBCC SQLPERF(WAITSTATS)' dbcc sqlperf(waitstats) Print Print Print Print '' '*********************************************************************' 'Print out DBCC Input buffer for all blocked or blocking spids.' '*********************************************************************'

declare ibuffer cursor fast_forward for select distinct cast (spid as varchar(6)) as spid from @probclients where (spid <> @@spid) and ((blocked!=0 or (waittype != 0x0000 and ignore_app = 0)) or spid in (select blocked from @probclients where blocked != 0)) open ibuffer fetch next from ibuffer into @spid while (@@fetch_status != -1) begin print '' print 'DBCC INPUTBUFFER FOR SPID ' + @spid exec ('dbcc inputbuffer (' + @spid + ')') fetch next from ibuffer into @spid end deallocate ibuffer Print '' Print '*******************************************************************************' Print 'Print out DBCC OPENTRAN for active databases for all blocked or blocking spids.' Print '*******************************************************************************' declare ibuffer cursor fast_forward for select distinct cast (dbid as varchar(6)) from @probclients where dbid != 0 open ibuffer fetch next from ibuffer into @spid while (@@fetch_status != -1) begin print '' set @dbname = db_name(@spid) set @status = DATABASEPROPERTYEX(@dbname,'Status') set @useraccess = DATABASEPROPERTYEX(@dbname,'UserAccess') print 'DBCC OPENTRAN FOR DBID ' + @spid + ' ['+ @dbname + ']' if @status = N'ONLINE' and @useraccess != N'SINGLE_USER' dbcc opentran(@dbname) else print 'Skipped: Status=' + convert(nvarchar(128),@status) + ' UserAccess=' + convert(nvarchar(128),@useraccess) print '' if @spid = '2' select @blocked = 'Y' fetch next from ibuffer into @spid end deallocate ibuffer if @blocked != 'Y' begin print '' print 'DBCC OPENTRAN FOR DBID 2 [tempdb]' dbcc opentran ('tempdb') end print 'End time: ' + convert(varchar(26), getdate(), 121) end -- All else print '8 No Waittypes: ' + convert(varchar(26), @time, 121) + ' ' + convert(varchar(12), datediff(ms,@time,getdate())) + ' ' + ISNULL (@@servername,'(null)') GO create procedure dbo.sp_blocker_pss80 (@latch int = 0, @fast int = 1, @appname sysname='PSSDIAG') as --version 17 if is_member('sysadmin')=0 begin print 'Must be a member of the sysadmin group in order to run this procedure' return end set nocount on declare @spid varchar(6) declare @blocked varchar(6) declare @time datetime declare @time2 datetime declare @dbname nvarchar(128) declare @status sql_variant declare @useraccess sql_variant

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

set @time = getdate() declare @probclients table(spid smallint, ecid smallint, blocked smallint, waittype binary(2), dbid smallint, ignore_app tinyint, primary key (blocked, spid, ecid)) insert @probclients select spid, ecid, blocked, waittype, dbid, case when convert(varchar(128),hostname) = @appname then 1 else 0 end from master.dbo.sysprocesses where blocked!=0 or waittype != 0x0000 if exists (select spid from @probclients where ignore_app != 1 or waittype != 0x020B) begin set @time2 = getdate() print '' print '8 Start time: ' + convert(varchar(26), @time, 121) + ' ' + convert(varchar(12), datediff(ms,@time,@time2)) insert @probclients select distinct blocked, 0, 0, 0x0000, 0, 0 from @probclients where blocked not in (select spid from @probclients) and blocked != 0 if (@fast = 1) begin print '' print 'SYSPROCESSES ' + ISNULL (@@servername,'(null)') + ' ' + str(@@microsoftversion) select spid, status, blocked, open_tran, waitresource, waittype, waittime, cmd, lastwaittype, cpu, physical_io, memusage,last_batch=convert(varchar(26), last_batch,121), login_time=convert(varchar(26), login_time,121), net_address, net_library, dbid, ecid, kpid, hostname, hostprocess, loginame, program_name, nt_domain, nt_username, uid, sid from master.dbo.sysprocesses where blocked!=0 or waittype != 0x0000 or spid in (select blocked from @probclients where blocked != 0) or spid in (select spid from @probclients where waittype != 0x0000) print 'ESP ' + convert(varchar(12), datediff(ms,@time2,getdate())) print '' print 'SYSPROC FIRST PASS' select spid, ecid, waittype from @probclients where waittype != 0x0000 if exists(select blocked from @probclients where blocked != 0) begin print 'Blocking via locks at ' + convert(varchar(26), @time, 121) print '' print 'SPIDs at the head of blocking chains' select spid from @probclients where blocked = 0 and spid in (select blocked from @probclients where spid != 0) if @latch = 0 begin print 'SYSLOCKINFO' select @time2 = getdate() select spid = convert (smallint, req_spid), ecid = convert (smallint, req_ecid), rsc_dbid As dbid, rsc_objid As ObjId, rsc_indid As IndId, Type = case rsc_type when 1 then 'NUL' when 2 then 'DB' when 3 then 'FIL' when 4 then 'IDX' when 5 then 'TAB' when 6 then 'PAG' when 7 then 'KEY' when 8 then 'EXT' when 9 then 'RID' when 10 then 'APP' end, Resource = substring (rsc_text, 1, 16), Mode = case req_mode + 1 when 1 then NULL when 2 then 'Sch-S' when 3 then 'Sch-M' when 4 then 'S' when 5 then 'U' when 6 then 'X' when 7 then 'IS' when 8 then 'IU' when 9 then 'IX' when 10 then 'SIU' when 11 then 'SIX' when 12 then 'UIX' when 13 then 'BU' when 14 then 'RangeS-S' when 15 then 'RangeS-U' when 16 then 'RangeIn-Null'

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

when 17 then 'RangeIn-S' when 18 then 'RangeIn-U' when 19 then 'RangeIn-X' when 20 then 'RangeX-S' when 21 then 'RangeX-U' when 22 then 'RangeX-X'end, Status = case req_status when 1 then 'GRANT' when 2 then 'CNVT' when 3 then 'WAIT' end, req_transactionID As TransID, req_transactionUOW As TransUOW from master.dbo.syslockinfo s, @probclients p where p.spid = s.req_spid print 'ESL ' + convert(varchar(12), datediff(ms,@time2,getdate())) end -- latch not set end else print 'No blocking via locks at ' + convert(varchar(26), @time, 121) print '' end -- fast set else begin -- Fast not set print '' print 'SYSPROCESSES ' + ISNULL (@@servername,'(null)') + ' ' + str(@@microsoftversion) select spid, status, blocked, open_tran, waitresource, waittype, waittime, cmd, lastwaittype, cpu, physical_io, memusage,last_batch=convert(varchar(26), last_batch,121), login_time=convert(varchar(26), login_time,121), net_address, net_library, dbid, ecid, kpid, hostname, hostprocess, loginame, program_name, nt_domain, nt_username, uid, sid from master.dbo.sysprocesses print 'ESP ' + convert(varchar(12), datediff(ms,@time2,getdate())) print '' print 'SYSPROC FIRST PASS' select spid, ecid, waittype from @probclients where waittype != 0x0000 if exists(select blocked from @probclients where blocked != 0) begin print 'Blocking via locks at ' + convert(varchar(26), @time, 121) print '' print 'SPIDs at the head of blocking chains' select spid from @probclients where blocked = 0 and spid in (select blocked from @probclients where spid != 0) if @latch = 0 begin print 'SYSLOCKINFO' select @time2 = getdate() select spid = convert (smallint, req_spid), ecid = convert (smallint, req_ecid), rsc_dbid As dbid, rsc_objid As ObjId, rsc_indid As IndId, Type = case rsc_type when 1 then 'NUL' when 2 then 'DB' when 3 then 'FIL' when 4 then 'IDX' when 5 then 'TAB' when 6 then 'PAG' when 7 then 'KEY' when 8 then 'EXT' when 9 then 'RID' when 10 then 'APP' end, Resource = substring (rsc_text, 1, 16), Mode = case req_mode + 1 when 1 then NULL when 2 then 'Sch-S' when 3 then 'Sch-M' when 4 then 'S' when 5 then 'U' when 6 then 'X' when 7 then 'IS' when 8 then 'IU' when 9 then 'IX' when 10 then 'SIU' when 11 then 'SIX' when 12 then 'UIX' when 13 then 'BU' when 14 then 'RangeS-S' when 15 then 'RangeS-U' when 16 then 'RangeIn-Null'

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

when 17 then 'RangeIn-S' when 18 then 'RangeIn-U' when 19 then 'RangeIn-X' when 20 then 'RangeX-S' when 21 then 'RangeX-U' when 22 then 'RangeX-X'end, Status = case req_status when 1 then 'GRANT' when 2 then 'CNVT' when 3 then 'WAIT' end, req_transactionID As TransID, req_transactionUOW As TransUOW from master.dbo.syslockinfo print 'ESL ' + convert(varchar(12), datediff(ms,@time2,getdate())) end -- latch not set end else print 'No blocking via locks at ' + convert(varchar(26), @time, 121) print '' end -- Fast not set print 'DBCC SQLPERF(WAITSTATS)' dbcc sqlperf(waitstats) Print Print Print Print '' '*********************************************************************' 'Print out DBCC Input buffer for all blocked or blocking spids.' '*********************************************************************'

declare ibuffer cursor fast_forward for select distinct cast (spid as varchar(6)) as spid from @probclients where (spid <> @@spid) and ((blocked!=0 or (waittype != 0x0000 and ignore_app = 0)) or spid in (select blocked from @probclients where blocked != 0)) open ibuffer fetch next from ibuffer into @spid while (@@fetch_status != -1) begin print '' print 'DBCC INPUTBUFFER FOR SPID ' + @spid exec ('dbcc inputbuffer (' + @spid + ')') fetch next from ibuffer into @spid end deallocate ibuffer Print '' Print '*******************************************************************************' Print 'Print out DBCC OPENTRAN for active databases for all blocked or blocking spids.' Print '*******************************************************************************' declare ibuffer cursor fast_forward for select distinct cast (dbid as varchar(6)) from @probclients where dbid != 0 open ibuffer fetch next from ibuffer into @spid while (@@fetch_status != -1) begin print '' set @dbname = db_name(@spid) set @status = DATABASEPROPERTYEX(@dbname,'Status') set @useraccess = DATABASEPROPERTYEX(@dbname,'UserAccess') print 'DBCC OPENTRAN FOR DBID ' + @spid + ' ['+ @dbname + ']' if @status = N'ONLINE' and @useraccess != N'SINGLE_USER' dbcc opentran(@dbname) else print 'Skipped: Status=' + convert(nvarchar(128),@status) + ' UserAccess=' + convert(nvarchar(128),@useraccess) print '' if @spid = '2' select @blocked = 'Y' fetch next from ibuffer into @spid end deallocate ibuffer if @blocked != 'Y' begin print '' print 'DBCC OPENTRAN FOR DBID 2 [tempdb]' dbcc opentran ('tempdb') end print 'End time: ' + convert(varchar(26), getdate(), 121) end -- All else print '8 No Waittypes: ' + convert(varchar(26), @time, 121) + ' '

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000

GO

+ convert(varchar(12), datediff(ms,@time,getdate())) + ' ' + ISNULL (@@servername,'(null)')

Propiedades
Id. de artculo: 271509 - ltima revisin: viernes, 23 de marzo de 2007 - Versin: 13.1 La informacin de este artculo se refiere a:
Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft SQL SQL SQL SQL SQL SQL SQL SQL SQL Server Server Server Server Server Server Server Server Server 2000 Desktop Engine (Windows) 2000 Developer Edition 2000 Enterprise Edition 2000 Personal Edition 2000 Standard Edition 2005 Standard Edition 2005 Workgroup Edition 2005 Developer Edition 2005 Enterprise Edition

Palabras clave: kbhowto kbinfo KB271509 Volver al principio | Enviar comentarios

Enviar comentarios Fue til esta informacin?


S No Un poco

Cunto esfuerzo ha dedicado personalmente para usar este artculo?


Muy poco Poco Moderado Mucho Muchsimo

Dganos las razones y qu podemos hacer para mejorar esta informacin

Enviar

Volver al principio

Ms sitios de Microsoft Windows Office Windows Phone Xbox Skype Bing

Descargas
Centro de descarga Descargas de Windows Descargas de Office

Soporte
Bsqueda en Soporte (KB) Lista de productos Ciclo de vida de productos Obtener soporte por Twitter Soporte para Profesionales de TI Soporte para Desarrolladores

Recursos populares
Cuenta de Outlook.com (Hotmail) bloqueada Microsoft Fix It Obtener soporte por Twitter Windows Installer: No se tiene acceso al servicio Restaurar sistema: preguntas ms frecuentes Solucionar problemas con Windows Update

Privacidad
Comentarios sobre la privacidad

Acerca
Microsoft Empleo Noticias de la compaa Mapa del sitio Contacte con Microsoft

Seguridad
Soporte para virus y seguridad Seguridad en el hogar Microsoft Update

Chile

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

Cmo supervisar el bloqueo en SQL Server 2005 y SQL Server 2000


Contrato de Servicios Contctenos Trminos de uso Marcas registradas Privacidad y Cookies 2013 Microsoft

http://support.microsoft.com/kb/271509[01-10-2013 18:19:46]

You might also like