Latch, mutex and beyond


     This file is part of demos for "Contemporary Latch Internals" seminar v.24.08.2010
     Copyright:   (c) Andrey S. Nikolaev ( RDTEX
     for 32bit Oracle 10g and above
connect / as sysdba
set verify off
set pagesize 0

alter session set max_dump_file_size=0;
   before 11g shared latch get function was named kslgetsl()
   in 11g - kslgetsl_w()
col shared_latch_function new_value shared_latch_function
var db_v varchar2(100);
var db_comp varchar2(100);
begin dbms_utility.db_version(:db_v,:db_comp); end;
select decode(sign(replace(:db_v,'.','')-110000),1,'kslgetsl_w', 'kslgetsl') shared_latch_function
   from dual;

oradebug setmypid
/* try to get latch as shared in S mode */
oradebug call &shared_latch_function &1 1 2 3 8
/* if ORA-00600: [545] was raised in previous statement then latch was exclusive. 
   The error terminates the script 
/* free the latch */
oradebug call kslfre &1
/* if we are here, the latch was shared */
insert into shared_latches(latch#,name,version,shared) 
select latch#,name,version,'Y' from v$latch,v$instance
where latch#=&2;

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: