Oracle - For Update

 
Vista:

For Update

Publicado por Hellen Avila Barrantes (2 intervenciones) el 07/04/2006 21:24:38
Hola a todos:

Les comento mi caso. Estoy por ejecutar un proceso y el mismo se queda pensando, me doy cuenta de que la tabla que el proceso quiere actualizar, tiene un for update que otro proceso le hizo y que lo tiene bloqueado, pero no se cual es.

Como puedo saber yo cual proceso o usuario me está haciendo ese For Update y por tanto, tiene "bloqueado" mi proceso.

Gracias de antemano por la ayuda que me puedan brindar.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:For Update

Publicado por Miguel (14 intervenciones) el 10/04/2006 18:35:54
Hola,

Espero que este 'script' te ayude a conseguir la información que deseas.


SET ECHO off
REM Nombre:: bloqueo_de_sesiones.sql
REM USO: SQL> @bloqueo_de_sesiones.sql
REM ------------------------------------------------------------------------
REM REQUERIMINETOS:
REM SELECT on V$LOCK, V$SESSION, SYS.USER$, SYS.OBJ$
REM ------------------------------------------------------------------------
REM PROPOSITO:
REM El reporte generado por este script da información de sesiones que estan
REM manteniendo bloqueos y da la información necesaria para eliminarlos usando
REM la sentencia: ALTER SYSTEM KILL SESSION 'SID,SERIAL#';
REM ------------------------------------------------------------------------
REM Texto principal del script::

set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'SID,Serial#' format a13
column res heading 'Resource Type' format 999
column id1 format 9999990
column id2 format 9999990
column lmode heading 'Tipo de Bloqueo' format a20
column request heading 'Bloqueo Requerido' format a20
column serial# format 99999
column username format a10 heading "Usuario"
column terminal heading Term format a6
column tab format a35 heading "Nombre de tabla"
column owner format a9
column Address format a18
select nvl(S.USERNAME,'Internal') Username,
nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||'.'||substr(T1.NAME,1,20) tab,
decode(L.LMODE,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request
from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2)
and U1.USER# = T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5
/
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar