<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Oracle RAC, v$, and gv$</title>
	<link>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv</link>
	<description>News and views from Pythian DBAs</description>
	<pubDate>Fri, 22 Aug 2008 01:30:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: Jag</title>
		<link>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-249117</link>
		<dc:creator>Jag</dc:creator>
		<pubDate>Sat, 02 Aug 2008 00:30:51 +0000</pubDate>
		<guid>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-249117</guid>
		<description>I too would like to know that query, if it is ok for you to send me on my email id.

Thanks in advace.</description>
		<content:encoded><![CDATA[<p>I too would like to know that query, if it is ok for you to send me on my email id.</p>
<p>Thanks in advace.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The_cat</title>
		<link>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-200366</link>
		<dc:creator>The_cat</dc:creator>
		<pubDate>Fri, 16 May 2008 17:18:16 +0000</pubDate>
		<guid>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-200366</guid>
		<description>Hi dash.
I'm having lots of problems with locks en a rac enviroment.
You mencioned your internal script and i agree with you about posting it.
But can you please send it to me directly?

[Email address removed. -Ed.]
Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi dash.<br />
I&#8217;m having lots of problems with locks en a rac enviroment.<br />
You mencioned your internal script and i agree with you about posting it.<br />
But can you please send it to me directly?</p>
<p>[Email address removed. -Ed.]<br />
Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dash</title>
		<link>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-193066</link>
		<dc:creator>dash</dc:creator>
		<pubDate>Tue, 06 May 2008 16:02:54 +0000</pubDate>
		<guid>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-193066</guid>
		<description>Thanks for the feedback Patrick - you are correct with your suggestions.  I was going with simplicity as much as possible to illustrate the difference between the types of views - I should have remembered that my target audience are sticklers for details (keeps me on my toes!).  I'm very glad you made the comments to clarify.

I would have posted our internal script for reference as it is a fantastic one, but I didn't write it and felt uncomfortable posting someone else's intellectual property.  The great thing about the gv$ views is that they can be your best friend and your worst enemy.

Glad that this has helped - that makes my day!</description>
		<content:encoded><![CDATA[<p>Thanks for the feedback Patrick - you are correct with your suggestions.  I was going with simplicity as much as possible to illustrate the difference between the types of views - I should have remembered that my target audience are sticklers for details (keeps me on my toes!).  I&#8217;m very glad you made the comments to clarify.</p>
<p>I would have posted our internal script for reference as it is a fantastic one, but I didn&#8217;t write it and felt uncomfortable posting someone else&#8217;s intellectual property.  The great thing about the gv$ views is that they can be your best friend and your worst enemy.</p>
<p>Glad that this has helped - that makes my day!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-193020</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Tue, 06 May 2008 15:13:30 +0000</pubDate>
		<guid>http://www.pythian.com/blogs/975/oracle-rac-v-and-gv#comment-193020</guid>
		<description>Hi David

Thanks for posting this, which I have already found useful.  I did notice some issues with it and have posted a revised version below.

Firstly your SQL only joined the instance ids between the gv$lock and gv$session views for the blocking session (l1.inst_id = s1.inst_id).  This is also needed for the blocked session (l2.inst_id = s2.inst_id), otherwise it may show too many sessions as blocked.
 
l2.id2 = l2.id2, will always evaluate to true and should be l1.id2 = l2.id2.

On my RAC database I found that the "block" column held a 2 for the blocking session, not a 0 or 1 as stated in the documentation.  I therefore needed to replace l1.BLOCK1=1 with l1.BLOCK1 &#62; 0.


select distinct s1.username &#124;&#124; '@' &#124;&#124; s1.machine 
&#124;&#124; ' ( INST=' &#124;&#124; s1.inst_id &#124;&#124; ' SID=' &#124;&#124; s1.sid &#124;&#124; ' )  is blocking '
&#124;&#124; s2.username &#124;&#124; '@' &#124;&#124; s2.machine &#124;&#124; ' ( INST=' &#124;&#124; s1.inst_id &#124;&#124; ' SID=' &#124;&#124; s2.sid &#124;&#124; ' ) ' 
AS blocking_status
from gv$lock l1, gv$session s1, gv$lock l2, gv$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and s1.inst_id=l1.inst_id and s2.inst_id=l2.inst_id
and l1.block &#62; 0 and l2.request &#62; 0
and l1.id1 = l2.id1 and l1.id2 = l2.id2;</description>
		<content:encoded><![CDATA[<p>Hi David</p>
<p>Thanks for posting this, which I have already found useful.  I did notice some issues with it and have posted a revised version below.</p>
<p>Firstly your SQL only joined the instance ids between the gv$lock and gv$session views for the blocking session (l1.inst_id = s1.inst_id).  This is also needed for the blocked session (l2.inst_id = s2.inst_id), otherwise it may show too many sessions as blocked.</p>
<p>l2.id2 = l2.id2, will always evaluate to true and should be l1.id2 = l2.id2.</p>
<p>On my RAC database I found that the &#8220;block&#8221; column held a 2 for the blocking session, not a 0 or 1 as stated in the documentation.  I therefore needed to replace l1.BLOCK1=1 with l1.BLOCK1 &gt; 0.</p>
<p>select distinct s1.username || &#8216;@&#8217; || s1.machine<br />
|| &#8216; ( INST=&#8217; || s1.inst_id || &#8216; SID=&#8217; || s1.sid || &#8216; )  is blocking &#8216;<br />
|| s2.username || &#8216;@&#8217; || s2.machine || &#8216; ( INST=&#8217; || s1.inst_id || &#8216; SID=&#8217; || s2.sid || &#8216; ) &#8216;<br />
AS blocking_status<br />
from gv$lock l1, gv$session s1, gv$lock l2, gv$session s2<br />
where s1.sid=l1.sid and s2.sid=l2.sid<br />
and s1.inst_id=l1.inst_id and s2.inst_id=l2.inst_id<br />
and l1.block &gt; 0 and l2.request &gt; 0<br />
and l1.id1 = l2.id1 and l1.id2 = l2.id2;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
