Latch, mutex and beyond

shared_latch_S.sql

/*
     This file is part of demos for "Contemporary Latch Internals" seminar v.24.08.2010
     Copyright:   (c) Andrey S. Nikolaev (Andrey.Nikolaev@rdtex.ru) RDTEX 
     http://AndreyNikolaev.wordpress.com
*/
connect / as sysdba
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;


col laddr new_value laddr 
set echo on

SELECT addr laddr   FROM v$latch
WHERE NAME='gcs partitioned table hash';

/* get latch in shared mode */

oradebug setmypid
oradebug call &shared_latch_function 0x&laddr 1 4 5 8

host sleep 100
oradebug call kslfre 0x&laddr
exit

2 Comments »

  1. […] incremented to represent the number of holders. To simplify further demonstrations I wrote scripts shared_latch_S.sql and shared_latch_X.sql This scripts acquire the ‘gcs partitioned table hash’ latch in S and X […]

    Pingback by Shared latch behaves like enqueue « Latch, mutex and beyond — November 17, 2010 @ 10:16 pm | Reply

  2. […] is governed by _spin_count value and spins upto four thousand cycles by default. I will use the latch_spin_trace.sql script from my previous post. The script already checks whether the latch is shared and uses […]

    Pingback by Spin tales: Part 2. Shared latches in Oracle 9.2-11g « Latch, mutex and beyond — January 14, 2011 @ 6:23 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.