jueves, 23 de febrero de 2017

Oracle Database: Blocking Session, Object Name and Object Type

clear screen
set serveroutput on
BEGIN
dbms_output.enable(1000000);

for do_loop in 
(select session_id, a.object_id, xidsqn, oracle_username, b.owner owner,b.object_name object_name, b.object_type object_typeFROM v$locked_object a, dba_objects bWHERE xidsqn != 0and b.object_id = a.object_id)
loop

    dbms_output.put_line('.');
    dbms_output.put_line('Blocking Session   : '||do_loop.session_id);
     dbms_output.put_line('Object (Owner/Name): '||do_loop.owner||'.'||do_loop.object_name);
    dbms_output.put_line('Object Type        : '||do_loop.object_type);

    for next_loop in (select sid from v$lock
                     where id2 = do_loop.xidsqn
                     and sid != do_loop.session_id) loop
dbms_output.put_line('Sessions being blocked : '||next_loop.sid);
end loop;
end loop;
dbms_output.put_line(' ');dbms_output.put_line(' ');dbms_output.put_line('===================================================================');dbms_output.put_line('If the screen is blank, there are no locks on objects');dbms_output.put_line('===================================================================');
END;

/

No hay comentarios:

Publicar un comentario

Te agradezco tus comentarios. Te esperamos de vuelta.

Todos los Sábados a las 8:00PM

Optimismo para una vida Mejor

Optimismo para una vida Mejor
Noticias buenas que comentar