jueves, 8 de septiembre de 2011

SQL ver tablas lockeadas

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

You can use sp_lock (and sp_lock2), but in SQL Server 2005 onwards this is being deprecated in favour of querying sys.dm_tran_locks:
select   
    object_name(P.object_id) as TableName,  
    resource_type, resource_description 
from 
    sys.dm_tran_locks L 
    join sys.partitions P on L.resource_associated_entity_id = p.hobt_id 

sp_lock
When reading sp_lock information, use the OBJECT_NAME( ) function to get the name of a table from its ID number, for example:
SELECT object_name(16003073)
EDIT :
There is another proc provided by microsoft which reports objects without the ID translation : http://support.microsoft.com/kb/q255596/

http://dev.mysql.com/doc/refman/5.0/es/lock-tables.html`

select

object_name(P.object_id) as TableName,

resource_type, resource_description

from

sys.dm_tran_locks L

join sys.partitions P on L.resource_associated_entity_id = p.hobt_id

http://msdn.microsoft.com/es-es/library/ms186301.aspx

SELECT OBJECT_NAME(23007163)

sp_who2

sp_who   http://msdn.microsoft.com/es-es/library/ms174313.aspx

sp_lock

No hay comentarios:

Publicar un comentario