<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ora-solutions.net - Martin Decker &#187; SQL</title>
	<atom:link href="http://www.ora-solutions.net/web/category/oracle-database/sql-oracle-database-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ora-solutions.net/web</link>
	<description>Indepented Oracle consultant</description>
	<lastBuildDate>Wed, 14 Jul 2010 17:59:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Formatted SQL Plan Display in Oracle 9i</title>
		<link>http://www.ora-solutions.net/web/2008/10/19/formatted-sql-plan-display-in-oracle-9i/</link>
		<comments>http://www.ora-solutions.net/web/2008/10/19/formatted-sql-plan-display-in-oracle-9i/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 14:34:24 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[9iR2]]></category>
		<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.ora-solutions.net/web/?p=366</guid>
		<description><![CDATA[Tom Kyte has posted a way to display the SQL Explain Plan from v$sql_plan in a formatted way in Oracle 9i on AskTom. Whereas this is easily possible in 10g with DBMS_XPLAN, in 9i this poses a bit of a challenge:

Step 1: Create a view dynamic_plan_table

create or replace view dynamic_plan_table
as
select
rawtohex(address) &#124;&#124; &#8216;_&#8217; &#124;&#124; child_number statement_id,
sysdate [...]]]></description>
			<content:encoded><![CDATA[<p>Tom Kyte has posted a way to display the SQL Explain Plan from v$sql_plan in a formatted way in Oracle 9i on <a href="http://asktom.oracle.com/pls/ask/f?p=4950:8:4653056091156531243::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:10353453905351">AskTom</a>. Whereas this is easily possible in 10g with DBMS_XPLAN, in 9i this poses a bit of a challenge:</p>
<ul>
<li>Step 1: Create a view dynamic_plan_table</li>
</ul>
<blockquote><p>create or replace view dynamic_plan_table<br />
as<br />
select<br />
rawtohex(address) || &#8216;_&#8217; || child_number statement_id,<br />
sysdate timestamp, operation, options, object_node,<br />
object_owner, object_name, 0 object_instance,<br />
optimizer,   search_columns, id, parent_id, position,<br />
cost, cardinality, bytes, other_tag, partition_start,<br />
partition_stop, partition_id, other, distribution,<br />
cpu_cost, io_cost, temp_space, access_predicates,<br />
filter_predicates<br />
from v$sql_plan;</p></blockquote>
<ul>
<li>Step 2: Extract SQL child_number, rawtohex(address) from v$sql for a known SQL hash value:</li>
</ul>
<blockquote><p>SQL&gt; select rawtohex(address) , child_number from v$sql where hash_value = &#8216;4163478529&#8242;;</p></blockquote>
<ul>
<li>Step 3: Query DBMS_XPLAN with created view</li>
</ul>
<blockquote><p>SQL&gt; r    select plan_table_output    from TABLE(        dbms_xplan.display                   ( &#8216;dynamic_plan_table&#8217;,                     (select rawtohex(address)||&#8217;_'||child_number x                             from v$sql                             where hash_value = &#8216;3471874038&#8242; AND                            rawtohex(ADDRESS) = &#8216;00000003A924BBD0&#8242; AND                             child_number = 1 ), &#8216;ALL&#8217; ) )</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.ora-solutions.net/web/2008/10/19/formatted-sql-plan-display-in-oracle-9i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AWR Analysis for IO Reporting</title>
		<link>http://www.ora-solutions.net/web/2008/10/10/awr-analysis-for-io-reporting/</link>
		<comments>http://www.ora-solutions.net/web/2008/10/10/awr-analysis-for-io-reporting/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 07:43:22 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[10g]]></category>
		<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.ora-solutions.net/web/?p=311</guid>
		<description><![CDATA[Oracle gathers a wealth of information in the Automatic Workload Repository (AWR). We can query this data to get very important IO access time information.

Create a working table because depending of the size of the AWR, the queries could take a long time and cause load on the database.

drop table mdecker.filestatistics;
create table mdecker.filestatistics as select [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle gathers a wealth of information in the Automatic Workload Repository (AWR). We can query this data to get very important IO access time information.</p>
<ul>
<li>Create a working table because depending of the size of the AWR, the queries could take a long time and cause load on the database.</li>
</ul>
<blockquote><p><code>drop table mdecker.filestatistics;<br />
create table mdecker.filestatistics as select t.snap_id, t.begin_interval_time, filename, file#, tsname, phyrds, singleblkrds, readtim, singleblkrdtim, phyblkrd from<br />
dba_hist_filestatxs f ,<br />
dba_hist_snapshot t<br />
where<br />
t.snap_id = f.snap_id and (<br />
begin_interval_time between to_date('05.11.2007 09:00','DD.MM.YYYY HH24:MI') and<br />
to_date('09.11.2007 17:00','DD.MM.YYYY HH24:MI')<br />
OR<br />
begin_interval_time between to_date('12.11.2007 09:00','DD.MM.YYYY HH24:MI') and<br />
to_date('16.11.2007 17:00','DD.MM.YYYY HH24:MI') );</code></p></blockquote>
<ul>
<li>Create a summary table</li>
</ul>
<blockquote><p><code>create table mdecker.filestatistics_summary as<br />
select snap_id, begin_interval_time, sum(phyrds) phyrds, sum(singleblkrds) singleblkrds from mdecker.filestatistics<br />
group by snap_id, begin_interval_time<br />
order by snap_id</code></p></blockquote>
<ul>
<li>Query the summary table</li>
</ul>
<blockquote><p><code>select snap_id,<br />
y.begin_interval_time,<br />
phyrds as prev_phyrds,<br />
lead(phyrds) over(order by snap_id) current_physrds,<br />
lead(phyrds) over(order by snap_id) - phyrds,<br />
begin_interval_time as prev_interval_time,<br />
lead(begin_interval_time) over(order by snap_id) current_time,<br />
lead(begin_interval_time) over(order by snap_id) - begin_interval_time,<br />
extract(second from lead(begin_interval_time) over(order by snap_id) - begin_interval_time) as sec,<br />
extract(minute from lead(begin_interval_time) over(order by snap_id) - begin_interval_time) as min,<br />
(extract(minute from lead(begin_interval_time) over(order by snap_id) - begin_interval_time)*60)+extract(second from lead(begin_interval_time) over(order by snap_id) - begin_interval_time),<br />
(lead(phyrds) over(order by snap_id) - phyrds)/<br />
((extract(minute from lead(begin_interval_time) over(order by snap_id) - begin_interval_time)*60)+extract(second from lead(begin_interval_time) over(order by snap_id) - begin_interval_time))<br />
from filestatistics_summary y</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.ora-solutions.net/web/2008/10/10/awr-analysis-for-io-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
