<?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>dbaStreet</title>
	<atom:link href="http://dbastreet.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://dbastreet.com/blog</link>
	<description>Oracle, Linux, Open Source and Stuff in General...Experiment, Fail, Learn, Repeat...</description>
	<lastBuildDate>Thu, 07 Mar 2013 14:50:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Ubuntu 12.10 start hangs after checking battery state</title>
		<link>http://dbastreet.com/blog/?p=972</link>
		<comments>http://dbastreet.com/blog/?p=972#comments</comments>
		<pubDate>Mon, 03 Dec 2012 00:33:31 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu 12.10 checking battery state]]></category>
		<category><![CDATA[ubuntu quantal quetzal checking battery state]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=972</guid>
		<description><![CDATA[I have been running ubuntu 12.10, 64 bit for over a month now on my Lenovo T430. Intermittently as i startup, it would go through the startup process and get to a message &#8220;Checking Battery Sate&#8221; and then hang (It just looks like it is hanging, in fact what is happening is that, X seems [...]]]></description>
				<content:encoded><![CDATA[<p>I have been running ubuntu 12.10, 64 bit for over a month now on my Lenovo T430. Intermittently as i startup, it would go through the startup process and get to a message &#8220;Checking Battery Sate&#8221; and then hang (It just looks like it is hanging, in fact what is happening is that, X seems to be crashing). When this happens i do not get a Desktop window and hence i could not  login.</p>
<p>There seems to be some bugs on launchpad (1061149,834592), which do not seem to be conclusive on the fix. Looks like an option is to login and then do a startx. Other solutions talk about using a lower version of lightdm. Not entirely sure what the fix is. Running startx is not working for me.</p>
<p>Here is what i have been doing.</p>
<p>Once i get the message &#8220;Checking battery state&#8221; and it hangs, i do &lt;Ctrl&gt;&lt;Alt&gt;&lt;F2&gt;, get a login screen. Login, then switch to root. Then</p>
<p>pkill X</p>
<p>This leads to x restarting  and gives me the login screen.</p>
<p>Update Dec 12 2012 : Today once this happened, and i did a pkill and got my GUI login screen, even though i was typing in my password, it just kept coming back to this Login screen (Would not login to my desktop). To fix this, i had to do &lt;Cntrl&gt;&lt;Alt&gt;&lt;F1&gt; get a login screen, login, mv .Xauthority .Xauthority-original, and then rebooted again. Once i got my login screen again i was able to log back in. So somewhere along the line, looks like, something corrupted my .Xauthority file.</p>
<p>Hope this will be helpful to someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=972</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Plotting AWR database metrics using R</title>
		<link>http://dbastreet.com/blog/?p=946</link>
		<comments>http://dbastreet.com/blog/?p=946#comments</comments>
		<pubDate>Wed, 28 Nov 2012 21:14:11 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[awr plot metrics]]></category>
		<category><![CDATA[awr plot R]]></category>
		<category><![CDATA[awr R]]></category>
		<category><![CDATA[awr R ggplot]]></category>
		<category><![CDATA[plot awr metrics using R]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=946</guid>
		<description><![CDATA[In a previous post i showed how you can connect from R to the oracle database using the R driver. In this post i will explain how we can run queries against the AWR history tables and gather data that can be plotted using ggplot. When you install R on linux, like i outlined in [...]]]></description>
				<content:encoded><![CDATA[<p>In a <a href="http://dbastreet.com/blog/?p=913">previous post</a> i showed how you can connect from R to the oracle database using the R driver. In this post i will explain how we can run queries against the AWR history tables and gather data that can be plotted using ggplot.</p>
<p>When you install R on linux, like i outlined in the above post, you get an executable named Rscript. Rscript is a NonInteractive variant of the R command, so you can run a R batch file from the linux shell (Like running a bash shell script). I am using Rscript as the interpreter in my script (First line).</p>
<p>ggplot2 is a R library that can be used for plotting in R programs. There is native plotting capability in R and there is another library named lattice. ggplot2 is much more robust and is based on the grammar of graphics. You have to install ggplot2 (install.packages(&#8220;ggplot2&#8243;)) in R before you can use this.</p>
<blockquote style="background: #F8F8FF;"><p>#!/usr/bin/Rscript<br />
library(ROracle)<br />
library(ggplot2)</p></blockquote>
<p>&nbsp;</p>
<p>Process command line arguments. This script expects 3 commandline arguments. Copy each argument to a R variable.</p>
<blockquote style="background: #F8F8FF;"><p>args &lt;- commandArgs(TRUE)<br />
l_dbid &lt;- as.double(args[1])<br />
l_bsnap &lt;- as.double(args[2])<br />
l_esnap &lt;- as.double(args[3])</p></blockquote>
<p>Connect to Oracle</p>
<blockquote style="background: #F8F8FF;"><p>drv &lt;- dbDriver(&#8220;Oracle&#8221;)<br />
con &lt;- dbConnect(drv,username=&#8221;system&#8221;,password=&#8221;manager&#8221;,dbname=&#8221;burl5vb1:1521/rk01&#8243;)</p></blockquote>
<p>Popluate a data frame with the values you will need for bind variables in the query you will be submitting.</p>
<blockquote style="background: #F8F8FF;"><p>my.data = data.frame(dbid = l_dbid, bsnap =l_bsnap,esnap=l_esnap)</p></blockquote>
<p>Prepare and Execute the query</p>
<blockquote style="background: #F8F8FF;"><p>res &lt;- dbSendQuery(con,&#8221;select dhss.instance_number,dhss.snap_id,dhs.end_interval_time et,<br />
round(sum(decode(dhss.metric_name,&#8217;User Transaction Per Sec&#8217;,dhss.average,0))) utps,<br />
round(sum(decode(dhss.metric_name,&#8217;Average Active Sessions&#8217;,dhss.average,0))) aas,<br />
round(sum(decode(dhss.metric_name,&#8217;Host CPU Utilization (%)&#8217;,dhss.average,0))) hcpu,<br />
round(sum(decode(dhss.metric_name,&#8217;Buffer Cache Hit Ratio&#8217;,dhss.average,0))) bchr,<br />
round(sum(decode(dhss.metric_name,&#8217;Logical Reads Per Sec&#8217;,dhss.average,0))) lr,<br />
round(sum(decode(dhss.metric_name,&#8217;I/O Megabytes per Second&#8217;,dhss.average,0))) iombps,<br />
round(sum(decode(dhss.metric_name,&#8217;I/O Requests per Second&#8217;,dhss.average,0))) iops,<br />
round(sum(decode(dhss.metric_name,&#8217;Redo Generated Per Sec&#8217;,dhss.average,0))) rg,<br />
round(sum(decode(dhss.metric_name,&#8217;Temp Space Used&#8217;,dhss.average,0))) ts,<br />
round(sum(decode(dhss.metric_name,&#8217;Physical Write Total IO Requests Per Sec&#8217;,dhss.average,0))) pw,<br />
round(sum(decode(dhss.metric_name,&#8217;Physical Read Total IO Requests Per Sec&#8217;,dhss.average,0))) pr<br />
from dba_hist_sysmetric_summary dhss,dba_hist_snapshot dhs<br />
where<br />
dhss.dbid = :1<br />
and dhss.snap_id between :2 and :3<br />
and dhss.metric_name in (<br />
&#8216;User Transaction Per Sec&#8217;,<br />
&#8216;Average Active Sessions&#8217;,<br />
&#8216;Host CPU Utilization (%)&#8217;,<br />
&#8216;Buffer Cache Hit Ratio&#8217;,<br />
&#8216;Logical Reads Per Sec&#8217;,<br />
&#8216;I/O Megabytes per Second&#8217;,<br />
&#8216;I/O Requests per Second&#8217;,<br />
&#8216;Redo Generated Per Sec&#8217;,<br />
&#8216;Temp Space Used&#8217;,<br />
&#8216;Physical Write Total IO Requests Per Sec&#8217;,<br />
&#8216;Physical Read Total IO Requests Per Sec&#8217;)<br />
and dhss.dbid = dhs.dbid<br />
and dhs.instance_number=1<br />
and dhss.snap_id = dhs.snap_id<br />
group by dhss.instance_number,dhss.snap_id,dhs.end_interval_time<br />
order by 1,2&#8243;,data=my.data<br />
)</p></blockquote>
<p>Fetch the rows, and disconnect from the db.</p>
<blockquote style="background: #F8F8FF;"><p>data &lt;- fetch(res)<br />
dbDisconnect(con)</p></blockquote>
<p>Open a pdf file to save the graphs to.<br />
Generate the graphs using ggplot.<br />
print the graphs to the pdf file<br />
Close the pdf file.</p>
<p>In the ggplot function call, ET and INSTANCE_NUMBER represent the End Snap Time and Instance Number columns output from the query, and AAS, UTPS, HCPU, PW and PR represent the AverageActiveSessions, UserTransactionPerSecond, HostCpu, PhysicalWrites and PhysicalReads columns from the query.</p>
<blockquote style="background: #F8F8FF;"><p>pdf(&#8220;plotstat.pdf&#8221;, onefile = TRUE)<br />
p1&lt;-ggplot(data,aes(strptime(ET,format=&#8221;%Y-%m-%d %H:%M:%S&#8221;),AAS,group=INSTANCE_NUMBER,color=INSTANCE_NUMBER))+geom_point()+geom_line()+ggtitle(&#8220;Average Active S<br />
essions&#8221;)+labs(x=&#8221;Time of Day&#8221;,y=&#8221;Average Active Sessions&#8221;)<br />
p2&lt;-ggplot(data,aes(strptime(ET,format=&#8221;%Y-%m-%d %H:%M:%S&#8221;),UTPS,group=INSTANCE_NUMBER,color=INSTANCE_NUMBER))+geom_point()+geom_line()+ggtitle(&#8220;Transactions Pe<br />
r Second&#8221;)+labs(x=&#8221;Time of Day&#8221;,y=&#8221;Transactions Per Second&#8221;)<br />
p3&lt;-ggplot(data,aes(strptime(ET,format=&#8221;%Y-%m-%d %H:%M:%S&#8221;),HCPU,group=INSTANCE_NUMBER,color=INSTANCE_NUMBER))+geom_point()+geom_line()+ggtitle(&#8220;CPU Usage&#8221;)+lab<br />
s(x=&#8221;Time of Day&#8221;,y=&#8221;Cpu Usage&#8221;)<br />
p4&lt;-ggplot(data,aes(strptime(ET,format=&#8221;%Y-%m-%d %H:%M:%S&#8221;),PW,group=INSTANCE_NUMBER,color=INSTANCE_NUMBER))+geom_point()+geom_line()+ggtitle(&#8220;Physical Writes&#8221;)<br />
+labs(x=&#8221;Time of Day&#8221;,y=&#8221;Phywical Writes&#8221;)<br />
p5&lt;-ggplot(data,aes(strptime(ET,format=&#8221;%Y-%m-%d %H:%M:%S&#8221;),PR,group=INSTANCE_NUMBER,color=INSTANCE_NUMBER))+geom_point()+geom_line()+ggtitle(&#8220;Physical Reads&#8221;)+<br />
labs(x=&#8221;Time of Day&#8221;,y=&#8221;Physical Reads&#8221;)<br />
print(p1)<br />
print(p2)<br />
print(p3)<br />
print(p4)<br />
print(p5)<br />
dev.off()</p></blockquote>
<p>You can run this script as follows from the Linux Command Line. The first argument is the dbid, the second argument is the begin snap id and the last argument is the end snap id.</p>
<blockquote style="background: #F8F8FF;"><p>./plotstat.R 220594996 5205 5217</p></blockquote>
<p>You will then see a pdf document named plotstat.pdf in your directory that has 5 separate graphs in it.<br />
Click on the link below to see a sample file. This is plotting awr data from a 4 node Oracle Rac Database.</p>
<p><a href="http://dbastreet.com/blog/wp-content/uploads/2012/11/plotstat.pdf">plotstat</a></p>
<p>Click <a href="http://dbastreet.com/utils/plotstat.R">Here</a> to download the whole script, plotstat.R</p>
<p><a href="http://www.amazon.com/ggplot2-Elegant-Graphics-Data-Analysis/dp/0387981403/ref=la_B002BOA9GI_1_1?ie=UTF8&amp;qid=1354137009&amp;sr=1-1">ggplot2 : Elegant Graphics for Data Analysis</a> is a great book to learn about ggplot2.</p>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=946</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script to create a tar archive of oracle trace files.</title>
		<link>http://dbastreet.com/blog/?p=938</link>
		<comments>http://dbastreet.com/blog/?p=938#comments</comments>
		<pubDate>Sat, 10 Nov 2012 18:59:46 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[oracleGeneral]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[oracle backup trace file]]></category>
		<category><![CDATA[oracle backup tracefile for My Oracle Support]]></category>
		<category><![CDATA[oracle trace file backup for Support]]></category>
		<category><![CDATA[oracle trace files tar]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=938</guid>
		<description><![CDATA[Whenever you have an oracle database problem and Oracle support asks you to upload the related trace files, the best option is to use the oracle Incident Packaging service to create an archive file that has all the necessary info to be uploaded to oracle. If you just want to upload all the .trc files [...]]]></description>
				<content:encoded><![CDATA[<p>Whenever you have an oracle database problem and Oracle support asks you to upload the related trace files, the best option is to use the oracle Incident Packaging service to create an archive file that has all the necessary info to be uploaded to oracle.</p>
<p>If you just want to upload all the .trc files generated in the diagnostics trace directory (including but not limited to pmon traces), you can use the following script to generate such an archive file.</p>
<p>The following script accepts</p>
<ul>
<li>The directory name (The location of your trace files)</li>
<li>The backup destination directory (The directory where you want the archive to be created. Ensure you have enough space here)</li>
<li>The date of the trace files (DD-MON-YYYY)</li>
<li>The begin time (HH24MI)</li>
<li>The end time (HH24MI)</li>
</ul>
<p>Then it finds all .trc files that falls in between those begin and end times for the date you specified, from the directory you specified and creates a tar.gz archive file in the destination directory you specified. It creates a directory named trcbakMonDD in your destination directory and places the file in that dir. You can download this file and upload it to oracle.</p>
<p>Usage Example :. /backtraces.sh /u01/11gr2/diag/rdbms/rk01/rk01/trace /tmp &#8217;11-Sep-2012&#8242; 1315 1340</p>
<p>The abov ecommand will backup all .trc files, from the directory  /u01/11gr2/diag/rdbms/rk01/rk01/trace, that have a timestamp between 13:15 and 13:40 on 11th Sep 2012 to a tar Archive in the directory /tmp</p>
<p>I have only tested it on Oracle Enterprise Linux 5. (It is likely that the syntax for the Tar and date commands might be different on different platforms)</p>
<p>Find the script code below</p>
<p>&nbsp;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p938code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9382"><td class="code" id="p938code2"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#This script can be used to create a tar archive of trace files created in </span>
<span style="color: #666666; font-style: italic;">#The database diagnostics trace directory between a given time period</span>
<span style="color: #666666; font-style: italic;">#Author : Rajeev Ramdas</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">5</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> .<span style="color: #000000; font-weight: bold;">/</span>backtraces.sh tracefiledir backupdir DD-Mon-YYYY HH24MI HH24MI
   <span style="color: #7a0874; font-weight: bold;">echo</span> .<span style="color: #000000; font-weight: bold;">/</span>backtraces.sh <span style="color: #000000; font-weight: bold;">/</span>u01<span style="color: #000000; font-weight: bold;">/</span>Rk<span style="color: #000000; font-weight: bold;">/</span>Docs<span style="color: #000000; font-weight: bold;">/</span>11g<span style="color: #000000; font-weight: bold;">/</span>Scripts2 <span style="color: #000000; font-weight: bold;">/</span>tmp <span style="color: #ff0000;">'09-Nov-2012'</span> 0900 <span style="color: #000000;">1332</span>
   <span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">l_backup_base</span>=<span style="color: #007800;">$2</span>
<span style="color: #007800;">l_backdir</span>=trcbak<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #660033;">--date</span>=<span style="color: #800000;">${3}</span> +<span style="color: #000000; font-weight: bold;">%</span>b<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">l_backdest</span>=<span style="color: #800000;">${l_backup_base}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${l_backdir}</span>
<span style="color: #007800;">l_startdate</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #660033;">--date</span>=<span style="color: #800000;">${3}</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">l_enddate</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #660033;">--date</span>=<span style="color: #800000;">${3}</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">l_starttime</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${l_startdate}</span><span style="color: #007800;">${4}</span>&quot;</span>
<span style="color: #007800;">l_endtime</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${l_enddate}</span><span style="color: #007800;">${5}</span>&quot;</span>
<span style="color: #007800;">l_backfile</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${l_backdest}</span>/tracebak-<span style="color: #007800;">${l_starttime}</span>-<span style="color: #007800;">${l_endtime}</span>.tar.gz&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${1}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> Wrong Backup Dir
   <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${2}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> Wrong Backup Dest
   <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${l_backdest}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> Directory Exists
<span style="color: #000000; font-weight: bold;">else</span>
   <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #800000;">${l_backdest}</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #800000;">${l_backfile}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #800000;">${l_backfile}</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$l_starttime</span>&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tmpoldfile
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$l_endtime</span>&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tmpnewfile
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$1</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-newer</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tmpoldfile <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-newer</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tmpnewfile <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.trc'</span> <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-czvf</span> - <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #800000;">${l_backfile}</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> Your backup <span style="color: #c20cb9; font-weight: bold;">file</span> is <span style="color: #800000;">${l_backfile}</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=938</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the R Language with an Oracle Database.</title>
		<link>http://dbastreet.com/blog/?p=913</link>
		<comments>http://dbastreet.com/blog/?p=913#comments</comments>
		<pubDate>Fri, 02 Nov 2012 21:00:07 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[oracleGeneral]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[r connect to oracle]]></category>
		<category><![CDATA[r dbi roracle]]></category>
		<category><![CDATA[r language connect to oracle]]></category>
		<category><![CDATA[r language oracle]]></category>
		<category><![CDATA[r language query oracle]]></category>
		<category><![CDATA[r oracle]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=913</guid>
		<description><![CDATA[R Programming Language Connectivity to Oracle. R is an open source programming language and software environment for statistical computing and graphics. It is a fully functional programming language, widely used by statisticians to perform data analysis. It can also be a neat tool for Oracle DBA&#8217;s to graph and analyse database performance metrics. If you [...]]]></description>
				<content:encoded><![CDATA[<h1>R Programming Language Connectivity to Oracle.</h1>
<p><a href="http://en.wikipedia.org/wiki/R_(programming_language)">R is an open source programming language</a> and software environment for statistical computing and graphics. It is a fully functional programming language, widely used by statisticians to perform data analysis. It can also be a neat tool for Oracle DBA&#8217;s to graph and analyse database performance metrics. If you intend to embark on developing a sizable R+Oracle project, i&#8217;d encourage you to use <a href="http://www.oracle.com/technetwork/database/options/advanced-analytics/r-enterprise/index.html">Oracle Enterprise R</a> and/or the <a href="http://www.oracle.com/us/products/database/options/advanced-analytics/overview/index.html">Oracle Advanced Analytics</a>.</p>
<p>Below are the steps on how to install and configure the R language on Ubuntu Linux with connectivity to Oracle.</p>
<p>These steps assume that you have an already installed and running Oracle 11gR2 database.</p>
<p>The high level steps are as follows</p>
<p>1) Install the R programming language environment<br />
2) Download and install the oracle instant client<br />
3) Download and install the following R packages<br />
- DBI<br />
- ROracle<br />
4) Start using R with Oracle.</p>
<h1>Install the R programming language environment</h1>
<p>Refer to the installation instructions at www.r-project.org for your platform.<br />
If you are installing this on Ubuntu Linux (As I have on Ubuntu 12.10), open the &#8220;Ubuntu Software Center&#8221; and install the following packages.<br />
- R-base<br />
- R-base-dev</p>
<h1>Download and install the oracle instant Client</h1>
<p>As your regular o/s user, download and install (Installation is nothing other than unzipping the downloaded file) the oracle instant client.<br />
Download The instant client for your o/s platform from http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html.<br />
You need to download<br />
- Instant Client package &#8211; Basic<br />
- Instant Client package &#8211; SDK</p>
<p>For the purpose of this installation, we are going to assume that the instant client has been installed into /u01/Rk/Apps/oracle/instantclient_11_2.</p>
<h1> Download and install the R packages</h1>
<h2>DBI</h2>
<p>- Download DBI from http://cran.r-project.org/web/packages/DBI/index.html. (Download the package source)<br />
- sudo su -<br />
- cd &lt;To the directory where DBI_0.2-5.tar.gz&gt;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p913code7'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9137"><td class="code" id="p913code7"><pre class="bash" style="font-family:monospace;">root<span style="color: #666666; font-style: italic;"># R CMD INSTALL DBI_0.2-5.tar.gz</span>
<span style="color: #000000; font-weight: bold;">*</span> installing to library ‘<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>site-library’
<span style="color: #000000; font-weight: bold;">*</span> installing <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">source</span><span style="color: #000000; font-weight: bold;">*</span> package ‘DBI’ ...
<span style="color: #000000; font-weight: bold;">**</span> R
<span style="color: #000000; font-weight: bold;">**</span> inst
<span style="color: #000000; font-weight: bold;">**</span> preparing package <span style="color: #000000; font-weight: bold;">for</span> lazy loading
Creating a generic <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #000000; font-weight: bold;">for</span> ‘summary’ from package ‘base’ <span style="color: #000000; font-weight: bold;">in</span> package ‘DBI’
<span style="color: #000000; font-weight: bold;">**</span> <span style="color: #7a0874; font-weight: bold;">help</span>
<span style="color: #000000; font-weight: bold;">***</span> installing <span style="color: #7a0874; font-weight: bold;">help</span> indices
<span style="color: #000000; font-weight: bold;">**</span> building package indices
<span style="color: #000000; font-weight: bold;">**</span> installing vignettes
‘DBI.Rnw’
<span style="color: #000000; font-weight: bold;">**</span> testing <span style="color: #000000; font-weight: bold;">if</span> installed package can be loaded
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span> DONE <span style="color: #7a0874; font-weight: bold;">&#40;</span>DBI<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<h2>ROracle</h2>
<p>- Download the ROracle source from http://cran.r-project.org/web/packages/ROracle/index.html<br />
- sudo su -<br />
- cd</p>
<p>- Set the following environment variables</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p913code8'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9138"><td class="code" id="p913code8"><pre class="bash" style="font-family:monospace;">root<span style="color: #666666; font-style: italic;"># export OCI_LIB=/u01/Rk/Apps/oracle/instantclient_11_2</span>
root<span style="color: #666666; font-style: italic;"># export LD_LIBRARY_PATH=/u01/Rk/Apps/oracle/instantclient_11_2:$LD_LIBRARY_PATH</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p913code9'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9139"><td class="code" id="p913code9"><pre class="bash" style="font-family:monospace;">root<span style="color: #666666; font-style: italic;"># R CMD INSTALL ROracle_1.1-5.tar.gz</span>
<span style="color: #000000; font-weight: bold;">*</span> installing to library ‘<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>site-library’
<span style="color: #000000; font-weight: bold;">*</span> installing <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">source</span><span style="color: #000000; font-weight: bold;">*</span> package ‘ROracle’ ...
<span style="color: #000000; font-weight: bold;">**</span> package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: creating .<span style="color: #000000; font-weight: bold;">/</span>config.status
config.status: creating src<span style="color: #000000; font-weight: bold;">/</span>Makevars
<span style="color: #000000; font-weight: bold;">**</span> libs
<span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-std</span>=gnu99 -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">-DNDEBUG</span> -I<span style="color: #000000; font-weight: bold;">/</span>u01<span style="color: #000000; font-weight: bold;">/</span>Rk<span style="color: #000000; font-weight: bold;">/</span>Apps<span style="color: #000000; font-weight: bold;">/</span>oracle<span style="color: #000000; font-weight: bold;">/</span>instantclient_11_2<span style="color: #000000; font-weight: bold;">/</span>sdk<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">-fpic</span> <span style="color: #660033;">-O2</span> <span style="color: #660033;">-pipe</span> <span style="color: #660033;">-g</span> <span style="color: #660033;">-c</span> rodbi.c <span style="color: #660033;">-o</span> rodbi.o
<span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-std</span>=gnu99 -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">-DNDEBUG</span> -I<span style="color: #000000; font-weight: bold;">/</span>u01<span style="color: #000000; font-weight: bold;">/</span>Rk<span style="color: #000000; font-weight: bold;">/</span>Apps<span style="color: #000000; font-weight: bold;">/</span>oracle<span style="color: #000000; font-weight: bold;">/</span>instantclient_11_2<span style="color: #000000; font-weight: bold;">/</span>sdk<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">-fpic</span> <span style="color: #660033;">-O2</span> <span style="color: #660033;">-pipe</span> <span style="color: #660033;">-g</span> <span style="color: #660033;">-c</span> rooci.c <span style="color: #660033;">-o</span> rooci.o
<span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-std</span>=gnu99 <span style="color: #660033;">-shared</span> <span style="color: #660033;">-o</span> ROracle.so rodbi.o rooci.o -L<span style="color: #000000; font-weight: bold;">/</span>u01<span style="color: #000000; font-weight: bold;">/</span>Rk<span style="color: #000000; font-weight: bold;">/</span>Apps<span style="color: #000000; font-weight: bold;">/</span>oracle<span style="color: #000000; font-weight: bold;">/</span>instantclient_11_2 <span style="color: #660033;">-lclntsh</span> -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">-lR</span>
installing to <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>site-library<span style="color: #000000; font-weight: bold;">/</span>ROracle<span style="color: #000000; font-weight: bold;">/</span>libs
<span style="color: #000000; font-weight: bold;">**</span> R
<span style="color: #000000; font-weight: bold;">**</span> inst
<span style="color: #000000; font-weight: bold;">**</span> preparing package <span style="color: #000000; font-weight: bold;">for</span> lazy loading
<span style="color: #000000; font-weight: bold;">**</span> <span style="color: #7a0874; font-weight: bold;">help</span>
<span style="color: #000000; font-weight: bold;">***</span> installing <span style="color: #7a0874; font-weight: bold;">help</span> indices
<span style="color: #000000; font-weight: bold;">**</span> building package indices
<span style="color: #000000; font-weight: bold;">**</span> installing vignettes
<span style="color: #000000; font-weight: bold;">**</span> testing <span style="color: #000000; font-weight: bold;">if</span> installed package can be loaded
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span> DONE <span style="color: #7a0874; font-weight: bold;">&#40;</span>ROracle<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<h1>Using The R Language with Oracle</h1>
<p>Now you are ready to Run your first R program, Run a query against the database, and plot the output on a graph.</p>
<p>Invoke the R language command line by typing in the following</p>
<p>$ R</p>
<p>From the R command line use the following commands. (The formatting is a bit messed up, click on &#8220;view code&#8221; to see the actual commands)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p913code10'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p91310"><td class="code" id="p913code10"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&amp;</span>gt; library<span style="color: #7a0874; font-weight: bold;">&#40;</span>ROracle<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt; drv <span style="color: #000000; font-weight: bold;">&amp;</span>lt;- dbDriver<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;Oracle&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt; con <span style="color: #000000; font-weight: bold;">&amp;</span>lt;- dbConnect<span style="color: #7a0874; font-weight: bold;">&#40;</span>drv,<span style="color: #007800;">username</span>=<span style="color: #ff0000;">&quot;sh&quot;</span>,<span style="color: #007800;">password</span>=<span style="color: #ff0000;">&quot;sh&quot;</span>,<span style="color: #007800;">dbname</span>=<span style="color: #ff0000;">&quot;burl5vb1:1521/rk01&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt; res <span style="color: #000000; font-weight: bold;">&amp;</span>lt;- dbSendQuery<span style="color: #7a0874; font-weight: bold;">&#40;</span>con,<span style="color: #ff0000;">&quot;select time_id,sum(quantity_sold) from sales
+ where time_id &amp;gt; to_date('20-DEC-2001','DD-MON-RR')
+ group by time_id&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt; data <span style="color: #000000; font-weight: bold;">&amp;</span>lt;- fetch<span style="color: #7a0874; font-weight: bold;">&#40;</span>res<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt; data
               TIME_ID SUM<span style="color: #7a0874; font-weight: bold;">&#40;</span>QUANTITY_SOLD<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">1</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">20</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">473</span>
<span style="color: #000000;">2</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">21</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">374</span>
<span style="color: #000000;">3</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">22</span> <span style="color: #000000;">23</span>:00:00               <span style="color: #000000;">1034</span>
<span style="color: #000000;">4</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">23</span> <span style="color: #000000;">23</span>:00:00               <span style="color: #000000;">1662</span>
<span style="color: #000000;">5</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">24</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">470</span>
<span style="color: #000000;">6</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">25</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">289</span>
<span style="color: #000000;">7</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">26</span> <span style="color: #000000;">23</span>:00:00               <span style="color: #000000;">1076</span>
<span style="color: #000000;">8</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">27</span> <span style="color: #000000;">23</span>:00:00               <span style="color: #000000;">1196</span>
<span style="color: #000000;">9</span>  <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">28</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">232</span>
<span style="color: #000000;">10</span> <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">29</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">758</span>
<span style="color: #000000;">11</span> <span style="color: #000000;">2001</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">30</span> <span style="color: #000000;">23</span>:00:00                <span style="color: #000000;">786</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&amp;</span>gt; plot<span style="color: #7a0874; font-weight: bold;">&#40;</span>data<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>You will see a plot like the one below</p>
<p><a href="http://dbastreet.com/blog/wp-content/uploads/2012/11/plot.png"><img class="aligncenter size-medium wp-image-928" title="plot" src="http://dbastreet.com/blog/wp-content/uploads/2012/11/plot-288x300.png" alt="" width="288" height="300" /></a></p>
<p>Happy R scripting.</p>
<p>If you want to learn the R Language, i would recommend the book  <a href="http://www.amazon.com/The-Art-Programming-Statistical-Software/dp/1593273843/ref=sr_1_1?ie=UTF8&amp;qid=1351889611&amp;sr=8-1&amp;keywords=The+art+of+R+programming">The Art of R programming</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=913</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle 12c new features</title>
		<link>http://dbastreet.com/blog/?p=908</link>
		<comments>http://dbastreet.com/blog/?p=908#comments</comments>
		<pubDate>Wed, 03 Oct 2012 11:13:47 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[oracleGeneral]]></category>
		<category><![CDATA[consolidated replay]]></category>
		<category><![CDATA[database heatmaps]]></category>
		<category><![CDATA[openworld andy mendelsohn keynote]]></category>
		<category><![CDATA[oracle 12c new features]]></category>
		<category><![CDATA[pluggable databases]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=908</guid>
		<description><![CDATA[In Andy Mendelsohn&#8217;s openworld 2012 keynote presentation, he mentioned 3 key new features of the oracle database 12c. For those of you who were unable to attend the keynote and do not have the 50 minutes to watch the replay, here is the reader&#8217;s digest version of the features. Pluggable Databases In a pluggable database [...]]]></description>
				<content:encoded><![CDATA[<p>In Andy Mendelsohn&#8217;s <a href="http://medianetwork.oracle.com/video/player/1873173833001">openworld 2012 keynote presentation</a>, he mentioned 3 key new features of the oracle database 12c. For those of you who were unable to attend the keynote and do not have the 50 minutes to watch the replay, here is the reader&#8217;s digest version of the features.</p>
<h1>Pluggable Databases</h1>
<p>In a pluggable database environment, you create a single database container, and plug multiple databases into this container. They key design feature here is that, all these databases then share the exact same oracle server processes (aka background processes) and memory (Unlike in the previous versions where each database got its own set of background processes and shared memory allocation).</p>
<p>In oracle versions upto 11gr2, when you used database resource management, you had to setup resource plans per database, and each of the database did not know about the resource utilization of other databases on the same server. So you have to use Instance Caging in order to ensure that database&#8217;s used only their allocated amount of cpu resources. In Oracle 12c, since all the databases use the same container, the container will know about the resource utilization of all the databases and hence can do the database resource management efficiently.</p>
<p>This lends itself well to consolidating into larger databases.</p>
<h1>Database Heatmaps</h1>
<p>In 12c the oracle database keep&#8217;s track of which data in your tables are being selected/updated/deleted/inserted frequently. Then the database can decide what type of compression to apply to data that has different transaction profiles. Oracle 12c will also have the ability to compress the data as per the above tracking and analysis.</p>
<h1>Database consolidated replay</h1>
<p>When you are consolidating multiple databases into a single database (Maybe in the oracle database machine), you can now capture workloads from multiple databases and replay them on a single target database.</p>
<p>This helps with consolidating databases into pluggable databases in 12c.</p>
<p>Andy did not forget to mention that, there are around 500 new features in 12c.</p>
<p>The details on how these features work, will become available, closer to when the database 12c is actually released.</p>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=908</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exadata Deployment Assistant</title>
		<link>http://dbastreet.com/blog/?p=905</link>
		<comments>http://dbastreet.com/blog/?p=905#comments</comments>
		<pubDate>Tue, 02 Oct 2012 18:06:27 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Database Machine]]></category>
		<category><![CDATA[Exadata]]></category>
		<category><![CDATA[exadata configuration worksheet]]></category>
		<category><![CDATA[exadata configuration worksheet replacement]]></category>
		<category><![CDATA[exadata deployment assistant]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=905</guid>
		<description><![CDATA[Previously, for an Oracle database machine installation, customers had to fill out the configuration worksheet, with information regarding the hostnames, ip addresses, how they want the machine configured etc. The file generated from the configuration worksheet served as the input to OneCommand. Now there is a new utility called the &#8220;Exadata Deployment Assistant&#8221;. This is [...]]]></description>
				<content:encoded><![CDATA[<p>Previously, for an Oracle database machine installation, customers had to fill out the configuration worksheet, with information regarding the hostnames, ip addresses, how they want the machine configured etc. The file generated from the configuration worksheet served as the input to OneCommand.</p>
<p>Now there is a new utility called the &#8220;Exadata Deployment Assistant&#8221;. This is a java based, wizard driven configuration file generator, which replaces the configuration worksheet. You can get the utility by downloading the latest OneCommand Patch. As of Oct 2nd 2012, the latest OneCommand patch is 14617927.</p>
<p>Download and unzip the patch. Untar onecmd.tar.</p>
<p>cd Exaconf</p>
<p>./exaconf.sh</p>
<p>The details of the command, and the inputs it looks for are in the chapter titled &#8220;Using Oracle Exadata Deployment Assistant&#8221;, in the latest &#8220;Exadata database machine Owner&#8217;s guide&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=905</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle database machine x3-2</title>
		<link>http://dbastreet.com/blog/?p=895</link>
		<comments>http://dbastreet.com/blog/?p=895#comments</comments>
		<pubDate>Mon, 01 Oct 2012 13:26:54 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Database Machine]]></category>
		<category><![CDATA[Exadata]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database machine x3-2]]></category>
		<category><![CDATA[exadata sandybridge]]></category>
		<category><![CDATA[exadata write-back cache]]></category>
		<category><![CDATA[exadata x3-2]]></category>
		<category><![CDATA[oracle database machine x3-2]]></category>
		<category><![CDATA[oracle exadata x3-2]]></category>
		<category><![CDATA[x3-2 new features]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=895</guid>
		<description><![CDATA[The Oracle database machine, gets a major makeover. As Larry Ellison phrased it in his Openworld 2012 Keynote, &#8220;Thought that the x2-2 was fast ? You Aint seen nothin Yet&#8221;. If you go to http://www.oracle.com/technetwork/server-storage/engineered-systems/exadata/index.html, at the middle of the page, in the section titled &#8220;What&#8217;s New&#8221;, you can see a in depth technical discussion [...]]]></description>
				<content:encoded><![CDATA[<p>The Oracle database machine, gets a major makeover. As Larry Ellison phrased it in his Openworld 2012 Keynote, &#8220;Thought that the x2-2 was fast ? You Aint seen nothin Yet&#8221;.</p>
<p>If you go to http://www.oracle.com/technetwork/server-storage/engineered-systems/exadata/index.html, at the middle of the page, in the section titled &#8220;What&#8217;s New&#8221;, you can see a in depth technical discussion of the changes incorporated in the x3-2.</p>
<p>So without further Ado, let me explain what the changes are, in the x3-2 compared to the x2-2</p>
<h1>Hardware Improvements</h1>
<h2>Faster CPU&#8217;s/More Cores.</h2>
<p>- The Oracle Database Machine x3-2, uses the Intel Xeon E5-2690 Processors (2.9Ghz). 2 Sockets, 8 cores each, total 16 cores in each database node (The x2-2 had 12 cores per node). These are the Sandy bridge processors (x2-2 had the Intel Xeon westmere processors), which have a new micro architecture, and are extremely fast (Comparable in speed to the IBM Power7 cpu&#8217;s).</p>
<p>So now in the full Rack of x3-2, the database machine has 128 CPU Cores (The x2-2 had 96 Cores).</p>
<p>- The CPU&#8217;s on the exadata cells have been upgraded to use the Intel Xeon E5-2630L (2.0Ghz) Sandybridge processors. The Cpu&#8217;s are 6 cores each.</p>
<h2>More Physical Memory (DRAM)</h2>
<p>- The Oracle Database Machine x3-2 has 128Gb of DRAM memory per database server. This is expandable to 256Gb of Memory. So in the Full Rack you can have upto 2048Gb (2Tb) of physical memory.</p>
<p>- The physical memory on the x3-2 exadata cells, has been upgraded to have 64Gbytes of Ram.</p>
<h2>More 10GigE networking ports</h2>
<p>- The 4 Networking ports on the database server, mother board are now 1/10Gbe. They are autosensing,and are copper only. The remaining 2 Network ports are 10Gbe and can be connected via fiber.</p>
<h2>More Flash Cache.</h2>
<p>- The x3-2 exadata storage servers now use the <a href="http://www.oracle.com/us/products/servers-storage/storage/flash-storage/f40-data-sheet-1733796.pdf">Sun F40 Flash cards</a> instead of the Sun F20 Flash cards used in the x2-2. Each Card is 400Gb. There are 4 PCI-E Flash cards in each cell. So you have 1600Gbytes of Flash cache in each cell. In a full rack x3-2, you get 22.4Tb of Flash cache (The x2-2 had 5Tb of Flash cache in a full rack).</p>
<p>So what does this increased amount of Flash mean in terms of performance ?</p>
<p>On an x3-2 full rack, you can get<br />
- 1.5 Million datatase read iops from the flash cache.<br />
- 1 Million database write iops from flash cache<br />
- 100Gbytes/sec Flash Cache, scan throughput</p>
<h2>New 1/8th Rack</h2>
<p>A new configuration (In addition to the Full, Half &amp; Quarter configurations) of a 1/8th Rack has been announced. So customers can now buy a configuration smaller than the quarter rack. It is really a 1/4th rack with half the cpu&#8217;s, half the flash cards and half the disks turned off. So the hardware price is lower and the software licensing costs are lower.</p>
<p>The other improvements include lower power consumption and improved cabling and airflow.</p>
<p>One notable change is that, the x3-2 now, does not have a KVM. This leaves 2U at the top of the Rack, where customers can deploy their in home switches, for network connectivity.</p>
<p>The number of disks, the type of disks, the disk capacities and speeds, in the exadata x3-2 cells,remain the same as it was in the x2-2 cells.</p>
<h1>Software Improvements</h1>
<h2>Exadata Smart Flash Cache Write-Back</h2>
<p>With the improved write speeds of the new PCI-E flash cards, the flash cache can now used as a write-back cache. This means that as soon as the data is written to flash cache, oracle database considers the write complete (ie it does not have to wait till the data is written to the physical magnetic disk). This helps improve the performance of applications that are currently bottlenecked on database writes.</p>
<p>On the x2-2, the random writes were written to the flash cache too, however it had to be written to disk (Or strictly speaking, to the disk controller cache) before the write was acknowledged by the database as completed. With the write-back cache functionality in x3-2 as soon as the write is persisted in the flash cache the database considers the write as complete. The writes to disk only get done when the ESS software detects that new blocks need to be read from disk to the flash cache and there is no free space in the flash cache. At such times, least frequently used data from the flash cache gets written to physical disk.</p>
<p>The smart flash cache algorithm makes sure that things like backups do not overwrite the entire cache.</p>
<p>The Full Rack x2-2 can do 1 million write iops to flash cache using this new functionality.</p>
<h2>Reduced database brownout time during cell failure/removal.</h2>
<p>In previous versions of the ESS software there could be upto 8 seconds of brown out time, when a cell failed, which has been now reduced to sub second.</p>
<h2>Unbreakable Enterprise Kernel</h2>
<p>- The database servers and Exadata storage servers on the x3-2 now use Oracle Unbreakable Enterprise Kernel 1.</p>
<p>The UEK1 was the operating system on the x2-8&#8242;s for a while now. With the x3-2&#8242;s we now use the UEK Kernel on the x3-2 database and storage server.</p>
<h2>DBFS</h2>
<p>- DBFS now supported on Solaris and Sparc Super Cluster.</p>
<p>The above list of hardware and software changes are just the highlights, not a complete list.</p>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=895</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Consolidated database replay</title>
		<link>http://dbastreet.com/blog/?p=887</link>
		<comments>http://dbastreet.com/blog/?p=887#comments</comments>
		<pubDate>Wed, 23 May 2012 18:07:03 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[consolidated]]></category>
		<category><![CDATA[consolidated database replay]]></category>
		<category><![CDATA[database replay]]></category>
		<category><![CDATA[multiple database replay]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[rat]]></category>
		<category><![CDATA[real application testing]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=887</guid>
		<description><![CDATA[Real Application Testing option has been enhanced to support “Consolidated Database Replay&#8221; functionality to help assess the impact of database and workload consolidation to a single database. Consolidated Database Replay allows concurrent replay of multiple captured production workloads from the same or different systems to a single database. Customers can use this functionality to validate the [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.oracle.com/us/products/database/options/real-application-testing/overview/index.html">Real Application Testing</a> option has been enhanced to support “Consolidated Database Replay&#8221; functionality to help assess the impact of database and workload consolidation to a single database. Consolidated Database Replay allows concurrent replay of multiple captured production workloads from the same or different systems to a single database. Customers can use this functionality to validate the consolidation strategy recommended by <a href="http://docs.oracle.com/cd/E24628_01/doc.121/e28814/consolid_plan.htm">Consolidation Planner</a> and to accurately predict the capacity and sizing of their database infrastructure before production deployment. Here are more details regarding this announcement:</p>
<ul type="disc">
<li>Consolidated Database Replay support starting from Oracle Database Release 11.2.0.2 and above. Multiple workload captures (including from  pre-11.2.0.2 database releases) can be replayed concurrently in database release 11.2.0.2 and above</li>
<li>MOS <a href="https://support.oracle.com/CSP/main/article?cmd=show&amp;type=NOT&amp;doctype=ANNOUNCEMENT&amp;id=1453789.1">Doc ID 1453789.1</a> provides more details on the required patches, how to use this functionality and associated best practices</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=887</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sql to extract awr data for analysis</title>
		<link>http://dbastreet.com/blog/?p=849</link>
		<comments>http://dbastreet.com/blog/?p=849#comments</comments>
		<pubDate>Tue, 15 May 2012 20:00:05 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[awr]]></category>
		<category><![CDATA[awr mining]]></category>
		<category><![CDATA[awr trend analysis]]></category>
		<category><![CDATA[awr trending]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql awr analysis]]></category>
		<category><![CDATA[sql awr data]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=849</guid>
		<description><![CDATA[Awr captures a wealth of database performance statistics and metrics. Enterprise manager is usually the preferred tool to interpret and analyze this data. However lot of times i resort to using sql statements to graph and look for trends in the awr data. Below are some of the sql&#8217;s that i use (Tested only in [...]]]></description>
				<content:encoded><![CDATA[<p>Awr captures a wealth of database performance statistics and metrics. Enterprise manager is usually the preferred tool to interpret and analyze this data. However lot of times i resort to using sql statements to graph and look for trends in the awr data. Below are some of the sql&#8217;s that i use (Tested only in 11gr2) to extract this information. Please keep in mind that you need the &#8220;Database tuning pack&#8221; license to access the dba_hist views.</p>
<p>The full script can be downloaded <a href="http://dbastreet.com/sql/awrsql.sql">here</a>.</p>
<h3>Awr Snapshot info by DbId, by Day</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code19'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84919"><td class="code" id="p849code19"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> d<span style="color: #66cc66;">.</span>dbid<span style="color: #66cc66;">,</span>d<span style="color: #66cc66;">.</span>db_name<span style="color: #66cc66;">,</span>to_char<span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">.</span>begin_interval_time<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-RR'</span><span style="color: #66cc66;">&#41;</span> begintime<span style="color: #66cc66;">,</span>min<span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">&#41;</span> minsnap<span style="color: #66cc66;">,</span>max<span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">&#41;</span>  maxsnap
              <span style="color: #993333; font-weight: bold;">from</span> dba_hist_snapshot s<span style="color: #66cc66;">,</span>dba_hist_database_instance d <span style="color: #993333; font-weight: bold;">where</span> s<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>
              <span style="color: #993333; font-weight: bold;">and</span> s<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span> d<span style="color: #66cc66;">.</span>instance_number <span style="color: #993333; font-weight: bold;">and</span> s<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> d<span style="color: #66cc66;">.</span>dbid
              <span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> d<span style="color: #66cc66;">.</span>dbid<span style="color: #66cc66;">,</span>d<span style="color: #66cc66;">.</span>db_name<span style="color: #66cc66;">,</span>to_char<span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">.</span>begin_interval_time<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-RR'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> <span style="color: #cc66cc;">1</span>
<span style="color: #66cc66;">/</span>
&nbsp;
	       DBID DB_NA BEGINTIME		 MINSNAP   MAXSNAP
<span style="color: #808080; font-style: italic;">------------------- ----- -------------------- --------- ---------</span>
	  <span style="color: #cc66cc;">220594996</span> QAD   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span>		    <span style="color: #cc66cc;">5205</span>      <span style="color: #cc66cc;">5217</span>
	  <span style="color: #cc66cc;">220594996</span> QAD   <span style="color: #cc66cc;">17</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span>		    <span style="color: #cc66cc;">5218</span>      <span style="color: #cc66cc;">5220</span>
	 <span style="color: #cc66cc;">2085202933</span> RK01  <span style="color: #cc66cc;">15</span><span style="color: #66cc66;">-</span>MAY<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">12</span>		       <span style="color: #cc66cc;">3</span>	 <span style="color: #cc66cc;">4</span></pre></td></tr></table></div>

<h3>Database version and platform</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code20'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84920"><td class="code" id="p849code20"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> <span style="color: #993333; font-weight: bold;">distinct</span> version<span style="color: #66cc66;">,</span>platform_name <span style="color: #993333; font-weight: bold;">from</span> dba_hist_database_instance <span style="color: #993333; font-weight: bold;">where</span> dbid<span style="color: #66cc66;">=</span>&amp;amp;dbid
<span style="color: #66cc66;">/</span>
&nbsp;
VERSION           PLATFORM_NAME
<span style="color: #808080; font-style: italic;">----------------- ---------------------------</span>
11<span style="color: #66cc66;">.</span>2<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>2<span style="color: #66cc66;">.</span>0        Linux x86 <span style="color: #cc66cc;">64</span><span style="color: #66cc66;">-</span>bit</pre></td></tr></table></div>

<h3>Cpu&#8217;s/Sockets/Cores/Load Average</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code21'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84921"><td class="code" id="p849code21"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">from</span> <span style="color: #66cc66;">&#40;</span>
                  <span style="color: #993333; font-weight: bold;">select</span>  stat_name<span style="color: #66cc66;">,</span>value
                  <span style="color: #993333; font-weight: bold;">from</span>  dba_hist_osstat
                  <span style="color: #993333; font-weight: bold;">where</span> dbid <span style="color: #66cc66;">=</span> &amp;amp;dbid
                  <span style="color: #993333; font-weight: bold;">and</span> instance_number <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>
                  <span style="color: #993333; font-weight: bold;">and</span> snap_id <span style="color: #66cc66;">=</span> &amp;amp;esnap
                  <span style="color: #66cc66;">&#41;</span>
                  pivot <span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>value<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">for</span> stat_name <span style="color: #993333; font-weight: bold;">in</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'NUM_CPUS'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'NUM_CPU_SOCKETS'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'NUM_CPU_CORES'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'PHYSICAL_MEMORY_BYTES'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'LOAD'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">/</span>
&nbsp;
<span style="color: #ff0000;">'NUM_CPUS'</span> <span style="color: #ff0000;">'NUM_CPU_SOCKETS'</span> <span style="color: #ff0000;">'NUM_CPU_CORES'</span> <span style="color: #ff0000;">'PHYSICAL_MEMORY_BYTES'</span>     <span style="color: #ff0000;">'LOAD'</span>
<span style="color: #808080; font-style: italic;">---------- ----------------- --------------- ----------------------- ----------</span>
        <span style="color: #cc66cc;">24</span>                 <span style="color: #cc66cc;">2</span>              <span style="color: #cc66cc;">12</span>              1<span style="color: #66cc66;">.</span>0122E<span style="color: #66cc66;">+</span>11 <span style="color: #66cc66;">.</span>209960938</pre></td></tr></table></div>

<h3>O/S Cpu Usage</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code22'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84922"><td class="code" id="p849code22"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span>
to_char<span style="color: #66cc66;">&#40;</span>begintime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-YY HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> begintime<span style="color: #66cc66;">,</span>
to_char<span style="color: #66cc66;">&#40;</span>endtime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-YY HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> endtime<span style="color: #66cc66;">,</span>
inst<span style="color: #66cc66;">,</span>
snapid<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>  utpct<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ntdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>  ntpct<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>stdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>  stpct<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>iowtdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>  iowtpct<span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">-</span>
<span style="color: #66cc66;">&#40;</span>
 round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">+</span>
 round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ntdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">+</span>
 round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>stdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">+</span>
 round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>iowtdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>utdiff<span style="color: #66cc66;">+</span>itdiff<span style="color: #66cc66;">+</span>stdiff<span style="color: #66cc66;">+</span>iowtdiff<span style="color: #66cc66;">+</span>ntdiff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> itpct
<span style="color: #993333; font-weight: bold;">from</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">select</span> begintime<span style="color: #66cc66;">,</span>endtime<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>extract<span style="color: #66cc66;">&#40;</span>Minute <span style="color: #993333; font-weight: bold;">from</span> endtime<span style="color: #66cc66;">-</span>begintime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">+</span>extract<span style="color: #66cc66;">&#40;</span>Second <span style="color: #993333; font-weight: bold;">from</span> endtime<span style="color: #66cc66;">-</span>begintime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> secs<span style="color: #66cc66;">,</span>
snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>
ut<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>ut<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> utdiff<span style="color: #66cc66;">,</span>
bt<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>bt<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> btdiff<span style="color: #66cc66;">,</span>
it<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>it<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> itdiff<span style="color: #66cc66;">,</span>
st<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>st<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> stdiff<span style="color: #66cc66;">,</span>
iowt<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>iowt<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> iowtdiff<span style="color: #66cc66;">,</span>
nt<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>nt<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> ntdiff<span style="color: #66cc66;">,</span>
vin<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>vin<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> vindiff<span style="color: #66cc66;">,</span>
vout<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>vout<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> voutdiff
<span style="color: #993333; font-weight: bold;">from</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">select</span> sn<span style="color: #66cc66;">.</span>begin_interval_time begintime<span style="color: #66cc66;">,</span>
     sn<span style="color: #66cc66;">.</span>end_interval_time EndTime<span style="color: #66cc66;">,</span>oss<span style="color: #66cc66;">.</span>snap_id SnapId<span style="color: #66cc66;">,</span>oss<span style="color: #66cc66;">.</span>instance_number Inst<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'USER_TIME'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> ut<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'BUSY_TIME'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> bt<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'IDLE_TIME'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> it<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'SYS_TIME'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> st<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'IOWAIT_TIME'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> iowt<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'NICE_TIME'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> nt<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'VM_IN_BYTES'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> vin<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>oss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'VM_OUT_BYTES'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> vout
<span style="color: #993333; font-weight: bold;">from</span> dba_hist_osstat oss<span style="color: #66cc66;">,</span>dba_hist_snapshot sn
<span style="color: #993333; font-weight: bold;">where</span> oss<span style="color: #66cc66;">.</span>dbid<span style="color: #66cc66;">=</span>&amp;amp;dbid
<span style="color: #993333; font-weight: bold;">and</span>   oss<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>dbid
<span style="color: #993333; font-weight: bold;">and</span>   oss<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span>  sn<span style="color: #66cc66;">.</span>instance_number
<span style="color: #993333; font-weight: bold;">and</span>   oss<span style="color: #66cc66;">.</span>snap_id <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>snap_id
<span style="color: #993333; font-weight: bold;">and</span>   oss<span style="color: #66cc66;">.</span>snap_id <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">and</span>   oss<span style="color: #66cc66;">.</span>stat_name <span style="color: #993333; font-weight: bold;">in</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #ff0000;">'USER_TIME'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'BUSY_TIME'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'IDLE_TIME'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'SYS_TIME'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'IOWAIT_TIME'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'NICE_TIME'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'VM_IN_BYTES'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'VM_OUT_BYTES'</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> sn<span style="color: #66cc66;">.</span>begin_interval_time<span style="color: #66cc66;">,</span>sn<span style="color: #66cc66;">.</span>end_interval_time<span style="color: #66cc66;">,</span>oss<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>oss<span style="color: #66cc66;">.</span>instance_number
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> oss<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>oss<span style="color: #66cc66;">.</span>snap_id
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">where</span> snapid <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid
<span style="color: #66cc66;">/</span>
&nbsp;
BEGINTIME            ENDTIME               <span style="color: #993333; font-weight: bold;">in</span>     SNAPID  UTPCT  NTPCT  STPCT IOWTPCT  ITPCT
<span style="color: #808080; font-style: italic;">-------------------- -------------------- --- ---------- ------ ------ ------ ------- ------</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1.00</span>    <span style="color: #66cc66;">.</span>00    <span style="color: #66cc66;">.</span>00     <span style="color: #66cc66;">.</span>00  <span style="color: #cc66cc;">99.00</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">40</span>:<span style="color: #cc66cc;">12</span>     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5210</span>   <span style="color: #cc66cc;">4.00</span>    <span style="color: #66cc66;">.</span>00   <span style="color: #cc66cc;">1.00</span>     <span style="color: #66cc66;">.</span>00  <span style="color: #cc66cc;">95.00</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">40</span>:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:00:03     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5211</span>  <span style="color: #cc66cc;">31.00</span>    <span style="color: #66cc66;">.</span>00   <span style="color: #cc66cc;">2.00</span>     <span style="color: #66cc66;">.</span>00  <span style="color: #cc66cc;">67.00</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:00:03   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:<span style="color: #cc66cc;">20</span>:05     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5212</span>  <span style="color: #cc66cc;">58.00</span>    <span style="color: #66cc66;">.</span>00   <span style="color: #cc66cc;">2.00</span>     <span style="color: #66cc66;">.</span>00  <span style="color: #cc66cc;">40.00</span></pre></td></tr></table></div>

<h3>Elapsed Time/DB Time/Concurrent Active Users</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code23'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84923"><td class="code" id="p849code23"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span>
to_char<span style="color: #66cc66;">&#40;</span>begintime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-YY HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> begintime<span style="color: #66cc66;">,</span>
to_char<span style="color: #66cc66;">&#40;</span>endtime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-YY HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> endtime<span style="color: #66cc66;">,</span>
inst<span style="color: #66cc66;">,</span>
snapid<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span>dbtdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000000</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> dbt<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span>secs<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span> mins<span style="color: #66cc66;">,</span>
round<span style="color: #66cc66;">&#40;</span>dbtdiff<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000000</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">*</span>round<span style="color: #66cc66;">&#40;</span>secs<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> concactive
<span style="color: #993333; font-weight: bold;">from</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">select</span> begintime<span style="color: #66cc66;">,</span>endtime<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>extract<span style="color: #66cc66;">&#40;</span>Minute <span style="color: #993333; font-weight: bold;">from</span> endtime<span style="color: #66cc66;">-</span>begintime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">+</span>extract<span style="color: #66cc66;">&#40;</span>Second <span style="color: #993333; font-weight: bold;">from</span> endtime<span style="color: #66cc66;">-</span>begintime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> secs<span style="color: #66cc66;">,</span>
snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>
dbt<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>dbt<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> dbtdiff
<span style="color: #993333; font-weight: bold;">from</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">select</span> sn<span style="color: #66cc66;">.</span>begin_interval_time begintime<span style="color: #66cc66;">,</span>
     sn<span style="color: #66cc66;">.</span>end_interval_time EndTime<span style="color: #66cc66;">,</span>tm<span style="color: #66cc66;">.</span>snap_id SnapId<span style="color: #66cc66;">,</span>tm<span style="color: #66cc66;">.</span>instance_number Inst<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>tm<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DB time'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> dbt
<span style="color: #993333; font-weight: bold;">from</span> dba_hist_sys_time_model tm<span style="color: #66cc66;">,</span>dba_hist_snapshot sn
<span style="color: #993333; font-weight: bold;">where</span> tm<span style="color: #66cc66;">.</span>dbid<span style="color: #66cc66;">=</span>&amp;amp;dbid
<span style="color: #993333; font-weight: bold;">and</span>   tm<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>dbid
<span style="color: #993333; font-weight: bold;">and</span>   tm<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span>  sn<span style="color: #66cc66;">.</span>instance_number
<span style="color: #993333; font-weight: bold;">and</span>   tm<span style="color: #66cc66;">.</span>snap_id <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>snap_id
<span style="color: #993333; font-weight: bold;">and</span>   tm<span style="color: #66cc66;">.</span>snap_id <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">and</span>   tm<span style="color: #66cc66;">.</span>stat_name <span style="color: #993333; font-weight: bold;">in</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #ff0000;">'DB time'</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> sn<span style="color: #66cc66;">.</span>begin_interval_time<span style="color: #66cc66;">,</span>sn<span style="color: #66cc66;">.</span>end_interval_time<span style="color: #66cc66;">,</span>tm<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>tm<span style="color: #66cc66;">.</span>instance_number
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> tm<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>tm<span style="color: #66cc66;">.</span>snap_id
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">where</span> snapid <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid
<span style="color: #66cc66;">/</span>
&nbsp;
BEGINTIME            ENDTIME               <span style="color: #993333; font-weight: bold;">in</span>     SNAPID       DBT    MINS CONCACTIVE
<span style="color: #808080; font-style: italic;">-------------------- -------------------- --- ---------- --------- ------- ----------</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5209</span>         <span style="color: #cc66cc;">1</span>      <span style="color: #cc66cc;">20</span>          <span style="color: #cc66cc;">0</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">40</span>:<span style="color: #cc66cc;">12</span>     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5210</span>       <span style="color: #cc66cc;">319</span>      <span style="color: #cc66cc;">20</span>         <span style="color: #cc66cc;">16</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">40</span>:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:00:03     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5211</span>       <span style="color: #cc66cc;">657</span>      <span style="color: #cc66cc;">20</span>         <span style="color: #cc66cc;">33</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:00:03   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:<span style="color: #cc66cc;">20</span>:05     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5212</span>       <span style="color: #cc66cc;">972</span>      <span style="color: #cc66cc;">20</span>         <span style="color: #cc66cc;">49</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:<span style="color: #cc66cc;">20</span>:05   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:<span style="color: #cc66cc;">40</span>:06     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5213</span>       <span style="color: #cc66cc;">457</span>      <span style="color: #cc66cc;">20</span>         <span style="color: #cc66cc;">23</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">22</span>:<span style="color: #cc66cc;">40</span>:06   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">23</span>:00:08     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5214</span>       <span style="color: #cc66cc;">736</span>      <span style="color: #cc66cc;">20</span>         <span style="color: #cc66cc;">37</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">23</span>:00:08   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">23</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">25</span>     <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">5215</span>         <span style="color: #cc66cc;">3</span>      <span style="color: #cc66cc;">20</span>          <span style="color: #cc66cc;">0</span></pre></td></tr></table></div>

<h3>Top 5 Foreground Waits</h3>
<p>The percentages i get here, do not seem to match up exactly, with the percentages you get, when you run awrrpt.sql, to generate the corresponding awr report. However it always seems to be within + or &#8211; 3% of the awrrpt.sql value. I think that the variation is because of the way that the awrrpt.sql might be rounding values, and probably how it accouts for Idle events.</p>
<p>&nbsp;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code24'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84924"><td class="code" id="p849code24"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">with</span> se <span style="color: #993333; font-weight: bold;">as</span> <span style="color: #66cc66;">&#40;</span>
     <span style="color: #993333; font-weight: bold;">select</span> sn<span style="color: #66cc66;">.</span>begin_interval_time begintime<span style="color: #66cc66;">,</span>
        sn<span style="color: #66cc66;">.</span>end_interval_time EndTime<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>snap_id SnapId<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>instance_number Inst<span style="color: #66cc66;">,</span>
        se<span style="color: #66cc66;">.</span>event_name stat<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>time_waited_micro_fg value<span style="color: #66cc66;">,</span>
        nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>se<span style="color: #66cc66;">.</span>time_waited_micro_fg<span style="color: #66cc66;">&#41;</span> over<span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> se<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>event_name
        <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> se<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>event_name<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> prevval<span style="color: #66cc66;">,</span>
        se<span style="color: #66cc66;">.</span>time_waited_micro_fg<span style="color: #66cc66;">-</span>
        nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>se<span style="color: #66cc66;">.</span>time_waited_micro_fg<span style="color: #66cc66;">&#41;</span> over<span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> se<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>event_name
        <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> se<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>event_name<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> valuediff
     <span style="color: #993333; font-weight: bold;">from</span> dba_hist_system_event se<span style="color: #66cc66;">,</span>dba_hist_snapshot sn
     <span style="color: #993333; font-weight: bold;">where</span> se<span style="color: #66cc66;">.</span>dbid<span style="color: #66cc66;">=</span>&amp;amp;dbid
     <span style="color: #993333; font-weight: bold;">and</span>   se<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>dbid
     <span style="color: #993333; font-weight: bold;">and</span>   se<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span>  sn<span style="color: #66cc66;">.</span>instance_number
     <span style="color: #993333; font-weight: bold;">and</span>   se<span style="color: #66cc66;">.</span>snap_id <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>snap_id
     <span style="color: #993333; font-weight: bold;">and</span>   se<span style="color: #66cc66;">.</span>snap_id <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
     <span style="color: #993333; font-weight: bold;">and</span>   se<span style="color: #66cc66;">.</span>wait_class !<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'Idle'</span>
     <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> se<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>se<span style="color: #66cc66;">.</span>event_name
     <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span>
     sdbcpu <span style="color: #993333; font-weight: bold;">as</span> <span style="color: #66cc66;">&#40;</span>
         <span style="color: #993333; font-weight: bold;">select</span> sn<span style="color: #66cc66;">.</span>begin_interval_time begintime<span style="color: #66cc66;">,</span>sn<span style="color: #66cc66;">.</span>end_interval_time EndTime<span style="color: #66cc66;">,</span>
         stm<span style="color: #66cc66;">.</span>snap_id snapid<span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>instance_number inst<span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>stat_name stat
         <span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>value value
         <span style="color: #66cc66;">,</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>stm<span style="color: #66cc66;">.</span>value<span style="color: #66cc66;">&#41;</span> over<span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> stm<span style="color: #66cc66;">.</span>instance_number <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> stm<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> prevval
         <span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>value<span style="color: #66cc66;">-</span>
         nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>stm<span style="color: #66cc66;">.</span>value<span style="color: #66cc66;">&#41;</span> over<span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> stm<span style="color: #66cc66;">.</span>instance_number <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> stm<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> valuediff
         <span style="color: #993333; font-weight: bold;">from</span> dba_hist_sys_time_model stm<span style="color: #66cc66;">,</span>dba_hist_snapshot sn
         <span style="color: #993333; font-weight: bold;">where</span>
         stm<span style="color: #66cc66;">.</span>stat_name <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'DB CPU'</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #993333; font-weight: bold;">and</span> stm<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> &amp;amp;dbid
         <span style="color: #993333; font-weight: bold;">and</span> stm<span style="color: #66cc66;">.</span>snap_id <span style="color: #993333; font-weight: bold;">between</span>  &amp;amp;bsnap<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
         <span style="color: #993333; font-weight: bold;">and</span> stm<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>dbid
         <span style="color: #993333; font-weight: bold;">and</span> stm<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>instance_number
         <span style="color: #993333; font-weight: bold;">and</span> stm<span style="color: #66cc66;">.</span>snap_id <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>snap_id
         <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> stm<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>stm<span style="color: #66cc66;">.</span>instance_number
     <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span>
     sunion <span style="color: #993333; font-weight: bold;">as</span> <span style="color: #66cc66;">&#40;</span>
         <span style="color: #993333; font-weight: bold;">select</span> begintime<span style="color: #66cc66;">,</span>endtime<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>stat<span style="color: #66cc66;">,</span>valuediff <span style="color: #993333; font-weight: bold;">from</span> se
         <span style="color: #993333; font-weight: bold;">union</span> <span style="color: #993333; font-weight: bold;">all</span>
         <span style="color: #993333; font-weight: bold;">select</span> begintime<span style="color: #66cc66;">,</span>endtime<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>stat<span style="color: #66cc66;">,</span>valuediff <span style="color: #993333; font-weight: bold;">from</span> sdbcpu
         <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">4</span>
     <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
     spct <span style="color: #993333; font-weight: bold;">as</span> <span style="color: #66cc66;">&#40;</span>
     <span style="color: #993333; font-weight: bold;">select</span> begintime<span style="color: #66cc66;">,</span>endtime<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>stat<span style="color: #66cc66;">,</span>valuediff<span style="color: #66cc66;">,</span>
     round<span style="color: #66cc66;">&#40;</span>ratio_to_report<span style="color: #66cc66;">&#40;</span>valuediff<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">as</span> pct
     <span style="color: #993333; font-weight: bold;">from</span> sunion
     <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">4</span> <span style="color: #993333; font-weight: bold;">asc</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">7</span>  <span style="color: #993333; font-weight: bold;">desc</span>
     <span style="color: #66cc66;">&#41;</span>
     <span style="color: #993333; font-weight: bold;">select</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">from</span> <span style="color: #66cc66;">&#40;</span>
     <span style="color: #993333; font-weight: bold;">select</span> to_char<span style="color: #66cc66;">&#40;</span>begintime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-RR HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> begintime
     <span style="color: #66cc66;">,</span>to_char<span style="color: #66cc66;">&#40;</span>endtime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-RR HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> endtime<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>stat<span style="color: #66cc66;">,</span>valuediff<span style="color: #66cc66;">,</span>round<span style="color: #66cc66;">&#40;</span>pct<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> pct<span style="color: #66cc66;">,</span>
     row_number<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> snapid<span style="color: #66cc66;">,</span>inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> snapid<span style="color: #66cc66;">,</span>inst <span style="color: #993333; font-weight: bold;">asc</span><span style="color: #66cc66;">,</span>pct <span style="color: #993333; font-weight: bold;">desc</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">as</span> rnum
     <span style="color: #993333; font-weight: bold;">from</span> spct
     <span style="color: #66cc66;">&#41;</span>
     <span style="color: #993333; font-weight: bold;">where</span> rnum &amp;lt; <span style="color: #cc66cc;">6</span> <span style="color: #993333; font-weight: bold;">and</span> snapid <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #66cc66;">/</span>
&nbsp;
BEGINTIME            ENDTIME                  SNAPID  <span style="color: #993333; font-weight: bold;">in</span> STAT                               VALUEDIFF    PCT
<span style="color: #808080; font-style: italic;">-------------------- -------------------- ---------- --- ------------------------------ ------------- ------</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> DB CPU                              <span style="color: #cc66cc;">28856557</span>  <span style="color: #cc66cc;">83.24</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> name<span style="color: #66cc66;">-</span>service call wait               <span style="color: #cc66cc;">2073440</span>   <span style="color: #cc66cc;">5.98</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> control file sequential <span style="color: #993333; font-weight: bold;">read</span>          <span style="color: #cc66cc;">843201</span>   <span style="color: #cc66cc;">2.43</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> enq: PS <span style="color: #66cc66;">-</span> contention                  <span style="color: #cc66cc;">634127</span>   <span style="color: #cc66cc;">1.83</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> undo segment extension                <span style="color: #cc66cc;">423219</span>   <span style="color: #cc66cc;">1.22</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">2</span> DB CPU                              <span style="color: #cc66cc;">34408715</span>  <span style="color: #cc66cc;">89.73</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">2</span> enq: PS <span style="color: #66cc66;">-</span> contention                  <span style="color: #cc66cc;">852207</span>   <span style="color: #cc66cc;">2.22</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">2</span> reliable message                      <span style="color: #cc66cc;">351905</span>    <span style="color: #66cc66;">.</span>92
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">2</span> control file sequential <span style="color: #993333; font-weight: bold;">read</span>          <span style="color: #cc66cc;">323355</span>    <span style="color: #66cc66;">.</span>84
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00:<span style="color: #cc66cc;">12</span>   <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">16</span>         <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">2</span> row cache <span style="color: #993333; font-weight: bold;">lock</span>                        <span style="color: #cc66cc;">286882</span>    <span style="color: #66cc66;">.</span>75</pre></td></tr></table></div>

<h3>Physical and Logical I/O</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code25'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84925"><td class="code" id="p849code25"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> to_char<span style="color: #66cc66;">&#40;</span>begintime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-RR HH24:MI'</span><span style="color: #66cc66;">&#41;</span> begintime<span style="color: #66cc66;">,</span>to_char<span style="color: #66cc66;">&#40;</span>endtime<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'DD-MON-RR HH24:MI'</span><span style="color: #66cc66;">&#41;</span> endtime
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span>extract<span style="color: #66cc66;">&#40;</span>Minute <span style="color: #993333; font-weight: bold;">from</span> endtime<span style="color: #66cc66;">-</span>begintime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">+</span>extract<span style="color: #66cc66;">&#40;</span>Second <span style="color: #993333; font-weight: bold;">from</span> endtime<span style="color: #66cc66;">-</span>begintime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> secs<span style="color: #66cc66;">,</span>
snapid<span style="color: #66cc66;">,</span>inst<span style="color: #66cc66;">,</span>
prd<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>prd<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> prddiff<span style="color: #66cc66;">,</span>
pwrt<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>pwrt<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> pwrtdiff<span style="color: #66cc66;">,</span>
iordreq<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>iordreq<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> iorddiff<span style="color: #66cc66;">,</span>
iowrtreq<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>iowrtreq<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> iowrtdiff<span style="color: #66cc66;">,</span>
prmbr<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>prmbr<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> prmbrdiff<span style="color: #66cc66;">,</span>
cgets<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>cgets<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> cgetsdiff<span style="color: #66cc66;">,</span>
dbgets<span style="color: #66cc66;">-</span>nvl<span style="color: #66cc66;">&#40;</span>lag<span style="color: #66cc66;">&#40;</span>dbgets<span style="color: #66cc66;">&#41;</span> over <span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> inst <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> inst<span style="color: #66cc66;">,</span>snapid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> dbgetsdiff
<span style="color: #993333; font-weight: bold;">from</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">select</span> sn<span style="color: #66cc66;">.</span>begin_interval_time begintime<span style="color: #66cc66;">,</span>
     sn<span style="color: #66cc66;">.</span>end_interval_time EndTime<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>snap_id SnapId<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>instance_number Inst<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'physical read total bytes'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> prd<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'physical write total bytes'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> pwrt<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'physical read total IO requests'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> iordreq<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'physical write total IO requests'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> iowrtreq<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'physical read total multi block requests'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> prmbr<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'consistent gets'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> cgets<span style="color: #66cc66;">,</span>
     sum<span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>stat_name<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'db block gets'</span><span style="color: #66cc66;">,</span>value<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> dbgets
<span style="color: #993333; font-weight: bold;">from</span> dba_hist_sysstat ss<span style="color: #66cc66;">,</span>dba_hist_snapshot sn
<span style="color: #993333; font-weight: bold;">where</span> ss<span style="color: #66cc66;">.</span>dbid<span style="color: #66cc66;">=</span>&amp;amp;dbid
<span style="color: #993333; font-weight: bold;">and</span>   ss<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>dbid
<span style="color: #993333; font-weight: bold;">and</span>   ss<span style="color: #66cc66;">.</span>instance_number <span style="color: #66cc66;">=</span>  sn<span style="color: #66cc66;">.</span>instance_number
<span style="color: #993333; font-weight: bold;">and</span>   ss<span style="color: #66cc66;">.</span>snap_id <span style="color: #66cc66;">=</span> sn<span style="color: #66cc66;">.</span>snap_id
<span style="color: #993333; font-weight: bold;">and</span>   ss<span style="color: #66cc66;">.</span>snap_id <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">and</span>   ss<span style="color: #66cc66;">.</span>stat_name <span style="color: #993333; font-weight: bold;">in</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #ff0000;">'physical read total bytes'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'physical write total bytes'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'physical read total IO requests'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'physical write total IO requests'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'physical read total multi block requests'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'consistent gets'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'db block gets'</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> sn<span style="color: #66cc66;">.</span>begin_interval_time<span style="color: #66cc66;">,</span>sn<span style="color: #66cc66;">.</span>end_interval_time<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>instance_number
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> ss<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>snap_id
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">where</span> snapid <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">5</span>
<span style="color: #66cc66;">/</span>
&nbsp;
BEGINTIME            ENDTIME                    SECS     SNAPID  <span style="color: #993333; font-weight: bold;">in</span>          PRDDIFF         PWRTDIFF         IORDDIFF        IOWRTDIFF        PRMBRDIFF        CGETSDIFF       DBGETSDIFF
<span style="color: #808080; font-style: italic;">-------------------- -------------------- ---------- ---------- --- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ----------------</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">40</span>      <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00        <span style="color: #cc66cc;">1210.766</span>       <span style="color: #cc66cc;">5208</span>   <span style="color: #cc66cc;">1</span>     <span style="color: #cc66cc;">309967486976</span>     <span style="color: #cc66cc;">544388304896</span>         <span style="color: #cc66cc;">17660147</span>         <span style="color: #cc66cc;">36335142</span>          <span style="color: #cc66cc;">1139579</span>       <span style="color: #cc66cc;">4468788730</span>       <span style="color: #cc66cc;">2328671039</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">40</span>      <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00        <span style="color: #cc66cc;">1210.782</span>       <span style="color: #cc66cc;">5208</span>   <span style="color: #cc66cc;">2</span>     <span style="color: #cc66cc;">165472269312</span>     <span style="color: #cc66cc;">510302864896</span>         <span style="color: #cc66cc;">16065810</span>         <span style="color: #cc66cc;">34894618</span>           <span style="color: #cc66cc;">144948</span>       <span style="color: #cc66cc;">4168326257</span>       <span style="color: #cc66cc;">2064355182</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">42</span>      <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00        <span style="color: #cc66cc;">1079.081</span>       <span style="color: #cc66cc;">5208</span>   <span style="color: #cc66cc;">3</span>       <span style="color: #cc66cc;">3122675712</span>        <span style="color: #cc66cc;">153791488</span>            <span style="color: #cc66cc;">56249</span>             <span style="color: #cc66cc;">6006</span>            <span style="color: #cc66cc;">10713</span>          <span style="color: #cc66cc;">1307859</span>            <span style="color: #cc66cc;">60272</span>
<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">20</span>:<span style="color: #cc66cc;">43</span>      <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">-</span>NOV<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">11</span> <span style="color: #cc66cc;">21</span>:00        <span style="color: #cc66cc;">1028.123</span>       <span style="color: #cc66cc;">5208</span>   <span style="color: #cc66cc;">4</span>       <span style="color: #cc66cc;">1318486016</span>         <span style="color: #cc66cc;">59018752</span>            <span style="color: #cc66cc;">26009</span>             <span style="color: #cc66cc;">5436</span>             <span style="color: #cc66cc;">7229</span>          <span style="color: #cc66cc;">1199275</span>            <span style="color: #cc66cc;">56027</span></pre></td></tr></table></div>

<h3>Top 10 sql statements By Elapsed Time</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p849code26'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p84926"><td class="code" id="p849code26"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">from</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">select</span> ss<span style="color: #66cc66;">.</span>snap_id snapid<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>instance_number inst<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>sql_id  sqlid
       <span style="color: #66cc66;">,</span>round<span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>elapsed_time_delta<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> elapsed
       <span style="color: #66cc66;">,</span>nvl<span style="color: #66cc66;">&#40;</span>round<span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>executions_delta<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> execs
       <span style="color: #66cc66;">,</span>round<span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>buffer_gets_delta<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> gets
       <span style="color: #66cc66;">,</span>round<span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>rows_processed_delta<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> rowsp
       <span style="color: #66cc66;">,</span>round<span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>disk_reads_delta<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> reads
       <span style="color: #66cc66;">,</span>dense_rank<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> over<span style="color: #66cc66;">&#40;</span>partition <span style="color: #993333; font-weight: bold;">by</span> snap_id<span style="color: #66cc66;">,</span>instance_number <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> sum<span style="color: #66cc66;">&#40;</span>ss<span style="color: #66cc66;">.</span>elapsed_time_delta<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">desc</span><span style="color: #66cc66;">&#41;</span> sql_rank
<span style="color: #993333; font-weight: bold;">from</span>
dba_hist_sqlstat ss
<span style="color: #993333; font-weight: bold;">where</span>
ss<span style="color: #66cc66;">.</span>dbid <span style="color: #66cc66;">=</span> &amp;amp;dbid  <span style="color: #993333; font-weight: bold;">and</span>
ss<span style="color: #66cc66;">.</span>snap_id <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> ss<span style="color: #66cc66;">.</span>snap_id<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>instance_number<span style="color: #66cc66;">,</span>ss<span style="color: #66cc66;">.</span>sql_id
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">where</span> sql_rank &amp;lt; <span style="color: #cc66cc;">11</span> <span style="color: #993333; font-weight: bold;">and</span> snapid <span style="color: #993333; font-weight: bold;">between</span> &amp;amp;bsnap <span style="color: #993333; font-weight: bold;">and</span> &amp;amp;esnap
<span style="color: #66cc66;">/</span>
&nbsp;
   SNAPID  <span style="color: #993333; font-weight: bold;">in</span> SQLID                                ELAPSED      EXECS           GETS          ROWSP          READS   SQL_RANK
<span style="color: #808080; font-style: italic;">---------- --- ------------------------------ ------------- ---------- -------------- -------------- -------------- ----------</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 1zr2ujm5sa5gc                        <span style="color: #cc66cc;">4547685</span>          <span style="color: #cc66cc;">1</span>         <span style="color: #cc66cc;">224434</span>              <span style="color: #cc66cc;">1</span>              <span style="color: #cc66cc;">0</span>          <span style="color: #cc66cc;">1</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 3g2ugdp1af2h8                        <span style="color: #cc66cc;">4478848</span>         <span style="color: #cc66cc;">13</span>         <span style="color: #cc66cc;">221134</span>             <span style="color: #cc66cc;">13</span>              <span style="color: #cc66cc;">0</span>          <span style="color: #cc66cc;">2</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 5k5v1ah25fb2c                        <span style="color: #cc66cc;">3965629</span>         <span style="color: #cc66cc;">39</span>         <span style="color: #cc66cc;">360232</span>             <span style="color: #cc66cc;">39</span>              <span style="color: #cc66cc;">0</span>          <span style="color: #cc66cc;">3</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 0r1zf55mxaujd                        <span style="color: #cc66cc;">2959144</span>          <span style="color: #cc66cc;">1</span>         <span style="color: #cc66cc;">237437</span>              <span style="color: #cc66cc;">1</span>              <span style="color: #cc66cc;">0</span>          <span style="color: #cc66cc;">4</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 8vwv6hx92ymmm                        <span style="color: #cc66cc;">2633353</span>      <span style="color: #cc66cc;">51062</span>         <span style="color: #cc66cc;">360669</span>          <span style="color: #cc66cc;">51062</span>              <span style="color: #cc66cc;">0</span>          <span style="color: #cc66cc;">5</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 2w1s3wu1zw63a                        <span style="color: #cc66cc;">1958993</span>          <span style="color: #cc66cc;">2</span>         <span style="color: #cc66cc;">153110</span>              <span style="color: #cc66cc;">4</span>              <span style="color: #cc66cc;">0</span>          <span style="color: #cc66cc;">6</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> f1y8kbhh6v9sv                        <span style="color: #cc66cc;">1709282</span>          <span style="color: #cc66cc;">1</span>                                                       <span style="color: #cc66cc;">7</span>
      <span style="color: #cc66cc;">5209</span>   <span style="color: #cc66cc;">1</span> 6pw8uk8k0dv0q                        <span style="color: #cc66cc;">1699402</span>          <span style="color: #cc66cc;">1</span>                                                       <span style="color: #cc66cc;">8</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=849</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Python 3</title>
		<link>http://dbastreet.com/blog/?p=845</link>
		<comments>http://dbastreet.com/blog/?p=845#comments</comments>
		<pubDate>Wed, 09 May 2012 21:25:17 +0000</pubDate>
		<dc:creator>Rajeev</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[cx_oracle]]></category>
		<category><![CDATA[matplotlib]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[python3]]></category>

		<guid isPermaLink="false">http://dbastreet.com/blog/?p=845</guid>
		<description><![CDATA[I have been writing some python scripts for awr analysis and trending. Since python 2.7 is no longer being enhanced, i have now switched to using python 3. Lot of python applications and frameworks still does not support python 3 (Notably the Django framework). Good news is that cx_oracle works with python 3. The steps [...]]]></description>
				<content:encoded><![CDATA[<p>I have been writing some python scripts for awr analysis and trending. Since python 2.7 is no longer being enhanced, i have now switched to using python 3. Lot of python applications and frameworks still does not support python 3 (Notably the Django framework). Good news is that cx_oracle works with python 3.</p>
<p>The steps to install cx_oracle with python 3 are very similar to the steps that i had outlined in my <a href="http://dbastreet.com/blog/?p=527">previous post on installing cx_oracle with python 2.7</a>.</p>
<p>The difference is that</p>
<p>- You have to first install python3 and python3-dev (On ubuntu, you can just use the ubuntu software center to do this)</p>
<p>- Then download the cx_oracle 5.1.1 source code only tar ball from <a href="http://cx-oracle.sourceforge.net/">http://cx-oracle.sourceforge.net/</a></p>
<p>- login as root, untar the tar file, cd to the cx_Oracle-5.1.1 directory</p>
<p>- Then run /usr/bin/python3 setup.py install</p>
<p>That does it and now oracle connectivity is in place.</p>
<p>I&#8217;ve also been using the <a href="http://matplotlib.sourceforge.net/">matplotlib</a> library along with Python to plot graphs with the awr and oswatcher data files. matplotlib also works with python 3.</p>
<p>- You have to first install libpng, libpng-dev, libfreetype6, libfreetype6-dev (Use the ubuntu software center)</p>
<p>- Download the <a href="http://sourceforge.net/projects/numpy/files/NumPy/">numpy source code tar ball</a>.</p>
<p>- Extract the tar file, login as root, cd to the directory and run /usr/bin/python3 setup.py install</p>
<p>- Installing matplotlib Ref :</p>
<div><strong id="internal-source-marker_0.7951428461819887"><a href="http://stackoverflow.com/questions/8605847/how-to-install-matplotlib-with-python3-2">http://stackoverflow.com/questions/8605847/how-to-install-matplotlib-with-python3-2</a></strong></div>
<p>- Download the <a href="https://github.com/matplotlib/matplotlib/tarball/master">matplotlib source code tar file</a></p>
<p>- Login as root, cd to the directory</p>
<p>- /usr/bin/python3 setup.py build</p>
<p>- /usr/bin/python3 setup.py install</p>
<p>Now you should have matplotlib working with python3</p>
<p>Enjoy your python scripting</p>
<div><strong><br />
</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://dbastreet.com/blog/?feed=rss2&#038;p=845</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
