IT Tutorial

Oracle Blocking Sessions and Lock Scripts -1

Hi,

While you are using your program which is connected to Oracle database, you can feel slowness on application related with Oracle database. This problem is probably related with blocking session and database lock.

You can find historical blocking session and lock with below scripts. Change date time column which is specified with bold character.

select v.sql_text,v.sql_fulltext,sub.* from v$sql v,
(select sample_time,s.sql_id sql_id, session_state, blocking_session,
owner||'.'||object_name||':'||nvl(subobject_name,'-') obj_name,s.program,s.module,s.machine
from dba_hist_active_sess_history s, dba_objects o
where sample_time between
to_date('27/02/2019 07:30:02','DD/MM/YYYY HH24:MI:SS')
and
to_date('28/02/2019 15:10:02','DD/MM/YYYY HH24:MI:SS')
and event = 'enq: TX - row lock contention'
and o.data_object_id = s.current_obj#
order by 1 desc) sub where sub.sql_id=v.sql_id;

 

 

 

Do you want to learn Oracle Database Performance Tuning detailed, then read the following articles.

https://ittutorial.org/oracle-database-performance-tuning-tutorial-12-what-is-the-automatic-sql-tuning-and-how-to-automated-sql-tuning/ 

 491 views last month,  3 views today

Exit mobile version