<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see [[AdvancedOptions]]
<<importTiddlers>>
http://www.evernote.com/shard/s48/sh/780e7534-cee4-4278-87f7-449e81d2acfc/23124af97669edefaca70c4f6e719426
http://www.evernote.com/shard/s48/sh/c5653239-108b-4515-a19e-d69fa3ad92c1/2476cb2c13785e02a391d05a7daf7507
http://jacobian.org/writing/web-scale/
http://thebuild.com/blog/2010/10/27/things-i-do-not-understand-web-scale/
[[Coderepo]]

[[Awk]], [[grep]], [[sed]], [[sort, uniq]]
[[BashShell]]
[[PowerShell]]
[[Perl]]
[[Python]]

[[PL/SQL]]
[[x R - Datacamp]] [[R maxym]]

[[HTML5]]
[[Javascript]] [[node.js]]
[[GoLang]]

[[Java]]
[[Machine Learning]]

viz and reporting in [[Tableau]]

[[noSQL]]






<<<
0)	It would be ideal if you can create a separate database for your tests

1)	If you really want a quick IO test, then do calibrate_io then the iperf2/netperf
http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_resmgr.htm#ARPLS67598
                                           
2)	If you have a bit of time, then do Orion
You can quickly do a -run dss or -run oltp
But you can also explore the attached oriontoolkit.zip

3)	If you have a lot of time, then do SLOB and test the large IOs 
For OLTP test
http://kevinclosson.net/2012/02/06/introducing-slob-the-silly-little-oracle-benchmark/
If it’s DW, then you need to test the large IOs. See attached IOsaturationtoolkit-v2.tar.bz2
http://karlarao.tiddlyspot.com/#[[cpu%20-%20SillyLittleBenchmark%20-%20SLOB]]

Kyle also has some good reference on making use of FIO https://github.com/khailey/fio_scripts/blob/master/README.md

<<<
http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html
http://superuser.com/questions/45342/when-should-i-use-dev-shm-and-when-should-i-use-tmp
http://download.oracle.com/docs/cd/B28359_01/server.111/b32009/appi_vlm.htm

tanel mentioned he used it as a persistent storage when he was doing a migration on this one database because it needs to do fast writes so he put the redo log on the /dev/shm.. this is dangerous because when the server crash then you have to do a restore/recover.. data residing in /dev/shm is not persistent on OS reboot..
http://learnxinyminutes.com/docs/javascript/
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
turbo mode is disabled 
{{{
          <!-- Turbo Mode -->
          <!-- Description: Turbo Mode. -->
          <!-- Possible Values: "Disabled", "Enabled" -->
          <Turbo_Mode>Disabled</Turbo_Mode>
}}}

! cpu_topology script
{{{
[root@enkx3cel01 ~]# sh cpu_topology
        Product Name: SUN FIRE X4270 M3
        Product Name: ASSY,MOTHERBOARD,2U
model name      : Intel(R) Xeon(R) CPU E5-2630L 0 @ 2.00GHz
processors  (OS CPU count)          0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
physical id (processor socket)      0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1
siblings    (logical CPUs/socket)   12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12
core id     (# assigned to a core)  0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
cpu cores   (physical cores/socket) 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
}}}

! intel cpu topology tool
{{{
[root@enkx3cel01 cpu-topology]# ./cpu_topology64.out


        Advisory to Users on system topology enumeration

This utility is for demonstration purpose only. It assumes the hardware topology
configuration within a coherent domain does not change during the life of an OS
session. If an OS support advanced features that can change hardware topology
configurations, more sophisticated adaptation may be necessary to account for
the hardware configuration change that might have added and reduced the number
of logical processors being managed by the OS.

User should also`be aware that the system topology enumeration algorithm is
based on the assumption that CPUID instruction will return raw data reflecting
the native hardware configuration. When an application runs inside a virtual
machine hosted by a Virtual Machine Monitor (VMM), any CPUID instructions
issued by an app (or a guest OS) are trapped by the VMM and it is the VMM's
responsibility and decision to emulate/supply CPUID return data to the virtual
machines. When deploying topology enumeration code based on querying CPUID
inside a VM environment, the user must consult with the VMM vendor on how an VMM
will emulate CPUID instruction relating to topology enumeration.



        Software visible enumeration in the system:
Number of logical processors visible to the OS: 24
Number of logical processors visible to this process: 24
Number of processor cores visible to this process: 12
Number of physical packages visible to this process: 2


        Hierarchical counts by levels of processor topology:
 # of cores in package  0 visible to this process: 6 .
         # of logical processors in Core 0 visible to this process: 2 .
         # of logical processors in Core  1 visible to this process: 2 .
         # of logical processors in Core  2 visible to this process: 2 .
         # of logical processors in Core  3 visible to this process: 2 .
         # of logical processors in Core  4 visible to this process: 2 .
         # of logical processors in Core  5 visible to this process: 2 .
 # of cores in package  1 visible to this process: 6 .
         # of logical processors in Core 0 visible to this process: 2 .
         # of logical processors in Core  1 visible to this process: 2 .
         # of logical processors in Core  2 visible to this process: 2 .
         # of logical processors in Core  3 visible to this process: 2 .
         # of logical processors in Core  4 visible to this process: 2 .
         # of logical processors in Core  5 visible to this process: 2 .


        Affinity masks per SMT thread, per core, per package:
Individual:
        P:0, C:0, T:0 --> 1
        P:0, C:0, T:1 --> 1z3

Core-aggregated:
        P:0, C:0 --> 1001
Individual:
        P:0, C:1, T:0 --> 2
        P:0, C:1, T:1 --> 2z3

Core-aggregated:
        P:0, C:1 --> 2002
Individual:
        P:0, C:2, T:0 --> 4
        P:0, C:2, T:1 --> 4z3

Core-aggregated:
        P:0, C:2 --> 4004
Individual:
        P:0, C:3, T:0 --> 8
        P:0, C:3, T:1 --> 8z3

Core-aggregated:
        P:0, C:3 --> 8008
Individual:
        P:0, C:4, T:0 --> 10
        P:0, C:4, T:1 --> 1z4

Core-aggregated:
        P:0, C:4 --> 10010
Individual:
        P:0, C:5, T:0 --> 20
        P:0, C:5, T:1 --> 2z4

Core-aggregated:
        P:0, C:5 --> 20020

Pkg-aggregated:
        P:0 --> 3f03f
Individual:
        P:1, C:0, T:0 --> 40
        P:1, C:0, T:1 --> 4z4

Core-aggregated:
        P:1, C:0 --> 40040
Individual:
        P:1, C:1, T:0 --> 80
        P:1, C:1, T:1 --> 8z4

Core-aggregated:
        P:1, C:1 --> 80080
Individual:
        P:1, C:2, T:0 --> 100
        P:1, C:2, T:1 --> 1z5

Core-aggregated:
        P:1, C:2 --> 100100
Individual:
        P:1, C:3, T:0 --> 200
        P:1, C:3, T:1 --> 2z5

Core-aggregated:
        P:1, C:3 --> 200200
Individual:
        P:1, C:4, T:0 --> 400
        P:1, C:4, T:1 --> 4z5

Core-aggregated:
        P:1, C:4 --> 400400
Individual:
        P:1, C:5, T:0 --> 800
        P:1, C:5, T:1 --> 8z5

Core-aggregated:
        P:1, C:5 --> 800800

Pkg-aggregated:
        P:1 --> fc0fc0


        APIC ID listings from affinity masks
OS cpu   0, Affinity mask 00000001 - apic id 0
OS cpu   1, Affinity mask 00000002 - apic id 2
OS cpu   2, Affinity mask 00000004 - apic id 4
OS cpu   3, Affinity mask 00000008 - apic id 6
OS cpu   4, Affinity mask 00000010 - apic id 8
OS cpu   5, Affinity mask 00000020 - apic id a
OS cpu   6, Affinity mask 00000040 - apic id 20
OS cpu   7, Affinity mask 00000080 - apic id 22
OS cpu   8, Affinity mask 00000100 - apic id 24
OS cpu   9, Affinity mask 00000200 - apic id 26
OS cpu  10, Affinity mask 00000400 - apic id 28
OS cpu  11, Affinity mask 00000800 - apic id 2a
OS cpu  12, Affinity mask 00001000 - apic id 1
OS cpu  13, Affinity mask 00002000 - apic id 3
OS cpu  14, Affinity mask 00004000 - apic id 5
OS cpu  15, Affinity mask 00008000 - apic id 7
OS cpu  16, Affinity mask 00010000 - apic id 9
OS cpu  17, Affinity mask 00020000 - apic id b
OS cpu  18, Affinity mask 00040000 - apic id 21
OS cpu  19, Affinity mask 00080000 - apic id 23
OS cpu  20, Affinity mask 00100000 - apic id 25
OS cpu  21, Affinity mask 00200000 - apic id 27
OS cpu  22, Affinity mask 00400000 - apic id 29
OS cpu  23, Affinity mask 00800000 - apic id 2b


Package 0 Cache and Thread details


Box Description:
Cache  is cache level designator
Size   is cache size
OScpu# is cpu # as seen by OS
Core   is core#[_thread# if > 1 thread/core] inside socket
AffMsk is AffinityMask(extended hex) for core and thread
CmbMsk is Combined AffinityMask(extended hex) for hw threads sharing cache
       CmbMsk will differ from AffMsk if > 1 hw_thread/cache
Extended Hex replaces trailing zeroes with 'z#'
       where # is number of zeroes (so '8z5' is '0x800000')
L1D is Level 1 Data cache, size(KBytes)= 32,  Cores/cache= 2, Caches/package= 6
L1I is Level 1 Instruction cache, size(KBytes)= 32,  Cores/cache= 2, Caches/package= 6
L2 is Level 2 Unified cache, size(KBytes)= 256,  Cores/cache= 2, Caches/package= 6
L3 is Level 3 Unified cache, size(KBytes)= 15360,  Cores/cache= 12, Caches/package= 1
      +-------------+-------------+-------------+-------------+-------------+-------------+
Cache |   L1D       |   L1D       |   L1D       |   L1D       |   L1D       |   L1D       |
Size  |   32K       |   32K       |   32K       |   32K       |   32K       |   32K       |
OScpu#|     0     12|     1     13|     2     14|     3     15|     4     16|     5     17|
Core  | c0_t0  c0_t1| c1_t0  c1_t1| c2_t0  c2_t1| c3_t0  c3_t1| c4_t0  c4_t1| c5_t0  c5_t1|
AffMsk|     1    1z3|     2    2z3|     4    4z3|     8    8z3|    10    1z4|    20    2z4|
CmbMsk|  1001       |  2002       |  4004       |  8008       | 10010       | 20020       |
      +-------------+-------------+-------------+-------------+-------------+-------------+

Cache |   L1I       |   L1I       |   L1I       |   L1I       |   L1I       |   L1I       |
Size  |   32K       |   32K       |   32K       |   32K       |   32K       |   32K       |
      +-------------+-------------+-------------+-------------+-------------+-------------+

Cache |    L2       |    L2       |    L2       |    L2       |    L2       |    L2       |
Size  |  256K       |  256K       |  256K       |  256K       |  256K       |  256K       |
      +-------------+-------------+-------------+-------------+-------------+-------------+

Cache |    L3                                                                             |
Size  |   15M                                                                             |
CmbMsk| 3f03f                                                                             |
      +-----------------------------------------------------------------------------------+

Combined socket AffinityMask= 0x3f03f


Package 1 Cache and Thread details


Box Description:
Cache  is cache level designator
Size   is cache size
OScpu# is cpu # as seen by OS
Core   is core#[_thread# if > 1 thread/core] inside socket
AffMsk is AffinityMask(extended hex) for core and thread
CmbMsk is Combined AffinityMask(extended hex) for hw threads sharing cache
       CmbMsk will differ from AffMsk if > 1 hw_thread/cache
Extended Hex replaces trailing zeroes with 'z#'
       where # is number of zeroes (so '8z5' is '0x800000')
      +-------------+-------------+-------------+-------------+-------------+-------------+
Cache |   L1D       |   L1D       |   L1D       |   L1D       |   L1D       |   L1D       |
Size  |   32K       |   32K       |   32K       |   32K       |   32K       |   32K       |
OScpu#|     6     18|     7     19|     8     20|     9     21|    10     22|    11     23|
Core  | c0_t0  c0_t1| c1_t0  c1_t1| c2_t0  c2_t1| c3_t0  c3_t1| c4_t0  c4_t1| c5_t0  c5_t1|
AffMsk|    40    4z4|    80    8z4|   100    1z5|   200    2z5|   400    4z5|   800    8z5|
CmbMsk| 40040       | 80080       |100100       |200200       |400400       |800800       |
      +-------------+-------------+-------------+-------------+-------------+-------------+

Cache |   L1I       |   L1I       |   L1I       |   L1I       |   L1I       |   L1I       |
Size  |   32K       |   32K       |   32K       |   32K       |   32K       |   32K       |
      +-------------+-------------+-------------+-------------+-------------+-------------+

Cache |    L2       |    L2       |    L2       |    L2       |    L2       |    L2       |
Size  |  256K       |  256K       |  256K       |  256K       |  256K       |  256K       |
      +-------------+-------------+-------------+-------------+-------------+-------------+

Cache |    L3                                                                             |
Size  |   15M                                                                             |
CmbMsk|fc0fc0                                                                             |
      +-----------------------------------------------------------------------------------+
}}}


! intel turbostat
{{{
[root@enkx3cel01 ~]# ./turbostat
pkg core CPU   %c0   GHz  TSC   %c1    %c3    %c6    %c7   %pc2   %pc3   %pc6   %pc7
               4.22 2.00 2.00  95.78   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   0   0   3.85 2.00 2.00  96.15   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   0  12   2.74 2.00 2.00  97.26   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   1   1  24.62 2.00 2.00  75.38   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   1  13  26.93 2.00 2.00  73.07   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   2   2   2.68 2.00 2.00  97.32   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   2  14   3.15 2.00 2.00  96.85   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   3   3   2.10 2.00 2.00  97.90   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   3  15   1.44 2.00 2.00  98.56   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   4   4   2.66 2.00 2.00  97.34   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   4  16   1.99 2.00 2.00  98.01   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   5   5   1.88 2.00 2.00  98.12   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   5  17   2.34 2.00 2.00  97.66   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   0   6   3.10 2.00 2.00  96.90   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   0  18   2.28 2.00 2.00  97.72   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   1   7   2.73 2.00 2.00  97.27   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   1  19   2.28 2.00 2.00  97.72   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   2   8   1.94 2.00 2.00  98.06   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   2  20   1.41 2.00 2.00  98.59   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   3   9   2.45 2.00 2.00  97.55   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   3  21   2.26 2.00 2.00  97.74   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   4  10   1.41 2.00 2.00  98.59   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   4  22   1.48 2.00 2.00  98.52   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   5  11   1.59 2.00 2.00  98.41   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   5  23   1.87 2.00 2.00  98.13   0.00   0.00   0.00   0.00   0.00   0.00   0.00
}}}




! cpu_topology script
{{{
[root@enkx3db01 cpu-topology]# sh ~root/cpu_topology
        Product Name: SUN FIRE X4170 M3
        Product Name: ASSY,MOTHERBOARD,1U
model name      : Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
processors  (OS CPU count)          0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
physical id (processor socket)      0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
siblings    (logical CPUs/socket)   16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
core id     (# assigned to a core)  0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
cpu cores   (physical cores/socket) 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
}}}


! intel cpu topology tool
{{{
[root@enkx3db01 cpu-topology]# ./cpu_topology64.out


        Advisory to Users on system topology enumeration

This utility is for demonstration purpose only. It assumes the hardware topology
configuration within a coherent domain does not change during the life of an OS
session. If an OS support advanced features that can change hardware topology
configurations, more sophisticated adaptation may be necessary to account for
the hardware configuration change that might have added and reduced the number
of logical processors being managed by the OS.

User should also`be aware that the system topology enumeration algorithm is
based on the assumption that CPUID instruction will return raw data reflecting
the native hardware configuration. When an application runs inside a virtual
machine hosted by a Virtual Machine Monitor (VMM), any CPUID instructions
issued by an app (or a guest OS) are trapped by the VMM and it is the VMM's
responsibility and decision to emulate/supply CPUID return data to the virtual
machines. When deploying topology enumeration code based on querying CPUID
inside a VM environment, the user must consult with the VMM vendor on how an VMM
will emulate CPUID instruction relating to topology enumeration.



        Software visible enumeration in the system:
Number of logical processors visible to the OS: 32
Number of logical processors visible to this process: 32
Number of processor cores visible to this process: 16
Number of physical packages visible to this process: 2


        Hierarchical counts by levels of processor topology:
 # of cores in package  0 visible to this process: 8 .
         # of logical processors in Core 0 visible to this process: 2 .
         # of logical processors in Core  1 visible to this process: 2 .
         # of logical processors in Core  2 visible to this process: 2 .
         # of logical processors in Core  3 visible to this process: 2 .
         # of logical processors in Core  4 visible to this process: 2 .
         # of logical processors in Core  5 visible to this process: 2 .
         # of logical processors in Core  6 visible to this process: 2 .
         # of logical processors in Core  7 visible to this process: 2 .
 # of cores in package  1 visible to this process: 8 .
         # of logical processors in Core 0 visible to this process: 2 .
         # of logical processors in Core  1 visible to this process: 2 .
         # of logical processors in Core  2 visible to this process: 2 .
         # of logical processors in Core  3 visible to this process: 2 .
         # of logical processors in Core  4 visible to this process: 2 .
         # of logical processors in Core  5 visible to this process: 2 .
         # of logical processors in Core  6 visible to this process: 2 .
         # of logical processors in Core  7 visible to this process: 2 .


        Affinity masks per SMT thread, per core, per package:
Individual:
        P:0, C:0, T:0 --> 1
        P:0, C:0, T:1 --> 1z4

Core-aggregated:
        P:0, C:0 --> 10001
Individual:
        P:0, C:1, T:0 --> 2
        P:0, C:1, T:1 --> 2z4

Core-aggregated:
        P:0, C:1 --> 20002
Individual:
        P:0, C:2, T:0 --> 4
        P:0, C:2, T:1 --> 4z4

Core-aggregated:
        P:0, C:2 --> 40004
Individual:
        P:0, C:3, T:0 --> 8
        P:0, C:3, T:1 --> 8z4

Core-aggregated:
        P:0, C:3 --> 80008
Individual:
        P:0, C:4, T:0 --> 10
        P:0, C:4, T:1 --> 1z5

Core-aggregated:
        P:0, C:4 --> 100010
Individual:
        P:0, C:5, T:0 --> 20
        P:0, C:5, T:1 --> 2z5

Core-aggregated:
        P:0, C:5 --> 200020
Individual:
        P:0, C:6, T:0 --> 40
        P:0, C:6, T:1 --> 4z5

Core-aggregated:
        P:0, C:6 --> 400040
Individual:
        P:0, C:7, T:0 --> 80
        P:0, C:7, T:1 --> 8z5

Core-aggregated:
        P:0, C:7 --> 800080

Pkg-aggregated:
        P:0 --> ff00ff
Individual:
        P:1, C:0, T:0 --> 100
        P:1, C:0, T:1 --> 1z6

Core-aggregated:
        P:1, C:0 --> 1000100
Individual:
        P:1, C:1, T:0 --> 200
        P:1, C:1, T:1 --> 2z6

Core-aggregated:
        P:1, C:1 --> 2000200
Individual:
        P:1, C:2, T:0 --> 400
        P:1, C:2, T:1 --> 4z6

Core-aggregated:
        P:1, C:2 --> 4000400
Individual:
        P:1, C:3, T:0 --> 800
        P:1, C:3, T:1 --> 8z6

Core-aggregated:
        P:1, C:3 --> 8000800
Individual:
        P:1, C:4, T:0 --> 1z3
        P:1, C:4, T:1 --> 1z7

Core-aggregated:
        P:1, C:4 --> 10001z3
Individual:
        P:1, C:5, T:0 --> 2z3
        P:1, C:5, T:1 --> 2z7

Core-aggregated:
        P:1, C:5 --> 20002z3
Individual:
        P:1, C:6, T:0 --> 4z3
        P:1, C:6, T:1 --> 4z7

Core-aggregated:
        P:1, C:6 --> 40004z3
Individual:
        P:1, C:7, T:0 --> 8z3
        P:1, C:7, T:1 --> 8z7

Core-aggregated:
        P:1, C:7 --> 80008z3

Pkg-aggregated:
        P:1 --> ff00ff00


        APIC ID listings from affinity masks
OS cpu   0, Affinity mask 0000000001 - apic id 0
OS cpu   1, Affinity mask 0000000002 - apic id 2
OS cpu   2, Affinity mask 0000000004 - apic id 4
OS cpu   3, Affinity mask 0000000008 - apic id 6
OS cpu   4, Affinity mask 0000000010 - apic id 8
OS cpu   5, Affinity mask 0000000020 - apic id a
OS cpu   6, Affinity mask 0000000040 - apic id c
OS cpu   7, Affinity mask 0000000080 - apic id e
OS cpu   8, Affinity mask 0000000100 - apic id 20
OS cpu   9, Affinity mask 0000000200 - apic id 22
OS cpu  10, Affinity mask 0000000400 - apic id 24
OS cpu  11, Affinity mask 0000000800 - apic id 26
OS cpu  12, Affinity mask 0000001000 - apic id 28
OS cpu  13, Affinity mask 0000002000 - apic id 2a
OS cpu  14, Affinity mask 0000004000 - apic id 2c
OS cpu  15, Affinity mask 0000008000 - apic id 2e
OS cpu  16, Affinity mask 0000010000 - apic id 1
OS cpu  17, Affinity mask 0000020000 - apic id 3
OS cpu  18, Affinity mask 0000040000 - apic id 5
OS cpu  19, Affinity mask 0000080000 - apic id 7
OS cpu  20, Affinity mask 0000100000 - apic id 9
OS cpu  21, Affinity mask 0000200000 - apic id b
OS cpu  22, Affinity mask 0000400000 - apic id d
OS cpu  23, Affinity mask 0000800000 - apic id f
OS cpu  24, Affinity mask 0001000000 - apic id 21
OS cpu  25, Affinity mask 0002000000 - apic id 23
OS cpu  26, Affinity mask 0004000000 - apic id 25
OS cpu  27, Affinity mask 0008000000 - apic id 27
OS cpu  28, Affinity mask 0010000000 - apic id 29
OS cpu  29, Affinity mask 0020000000 - apic id 2b
OS cpu  30, Affinity mask 0040000000 - apic id 2d
OS cpu  31, Affinity mask 0080000000 - apic id 2f


Package 0 Cache and Thread details


Box Description:
Cache  is cache level designator
Size   is cache size
OScpu# is cpu # as seen by OS
Core   is core#[_thread# if > 1 thread/core] inside socket
AffMsk is AffinityMask(extended hex) for core and thread
CmbMsk is Combined AffinityMask(extended hex) for hw threads sharing cache
       CmbMsk will differ from AffMsk if > 1 hw_thread/cache
Extended Hex replaces trailing zeroes with 'z#'
       where # is number of zeroes (so '8z5' is '0x800000')
L1D is Level 1 Data cache, size(KBytes)= 32,  Cores/cache= 2, Caches/package= 8
L1I is Level 1 Instruction cache, size(KBytes)= 32,  Cores/cache= 2, Caches/package= 8
L2 is Level 2 Unified cache, size(KBytes)= 256,  Cores/cache= 2, Caches/package= 8
L3 is Level 3 Unified cache, size(KBytes)= 20480,  Cores/cache= 16, Caches/package= 1
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+
Cache |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |
Size  |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |
OScpu#|       0       16|       1       17|       2       18|       3       19|       4       20|       5       21|       6       22|       7       23|
Core  |   c0_t0    c0_t1|   c1_t0    c1_t1|   c2_t0    c2_t1|   c3_t0    c3_t1|   c4_t0    c4_t1|   c5_t0    c5_t1|   c6_t0    c6_t1|   c7_t0    c7_t1|
AffMsk|       1      1z4|       2      2z4|       4      4z4|       8      8z4|      10      1z5|      20      2z5|      40      4z5|      80      8z5|
CmbMsk|   10001         |   20002         |   40004         |   80008         |  100010         |  200020         |  400040         |  800080         |
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Cache |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |
Size  |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Cache |      L2         |      L2         |      L2         |      L2         |      L2         |      L2         |      L2         |      L2         |
Size  |    256K         |    256K         |    256K         |    256K         |    256K         |    256K         |    256K         |    256K         |
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Cache |      L3                                                                                                                                       |
Size  |     20M                                                                                                                                       |
CmbMsk|  ff00ff                                                                                                                                       |
      +-----------------------------------------------------------------------------------------------------------------------------------------------+

Combined socket AffinityMask= 0xff00ff


Package 1 Cache and Thread details


Box Description:
Cache  is cache level designator
Size   is cache size
OScpu# is cpu # as seen by OS
Core   is core#[_thread# if > 1 thread/core] inside socket
AffMsk is AffinityMask(extended hex) for core and thread
CmbMsk is Combined AffinityMask(extended hex) for hw threads sharing cache
       CmbMsk will differ from AffMsk if > 1 hw_thread/cache
Extended Hex replaces trailing zeroes with 'z#'
       where # is number of zeroes (so '8z5' is '0x800000')
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+
Cache |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |     L1D         |
Size  |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |
OScpu#|       8       24|       9       25|      10       26|      11       27|      12       28|      13       29|      14       30|      15       31|
Core  |   c0_t0    c0_t1|   c1_t0    c1_t1|   c2_t0    c2_t1|   c3_t0    c3_t1|   c4_t0    c4_t1|   c5_t0    c5_t1|   c6_t0    c6_t1|   c7_t0    c7_t1|
AffMsk|     100      1z6|     200      2z6|     400      4z6|     800      8z6|     1z3      1z7|     2z3      2z7|     4z3      4z7|     8z3      8z7|
CmbMsk| 1000100         | 2000200         | 4000400         | 8000800         | 10001z3         | 20002z3         | 40004z3         | 80008z3         |
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Cache |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |     L1I         |
Size  |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |     32K         |
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Cache |      L2         |      L2         |      L2         |      L2         |      L2         |      L2         |      L2         |      L2         |
Size  |    256K         |    256K         |    256K         |    256K         |    256K         |    256K         |    256K         |    256K         |
      +-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Cache |      L3                                                                                                                                       |
Size  |     20M                                                                                                                                       |
CmbMsk|ff00ff00                                                                                                                                       |
      +-----------------------------------------------------------------------------------------------------------------------------------------------+
}}}


! intel turbostat
{{{
[root@enkx3db01 ~]# ./turbostat
pkg core CPU   %c0   GHz  TSC   %c1    %c3    %c6    %c7   %pc2   %pc3   %pc6   %pc7
               0.73 1.99 2.89  99.27   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   0   0   1.71 1.86 2.89  98.29   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   0  16   0.82 1.88 2.89  99.18   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   1   1   3.66 1.60 2.89  96.34   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   1  17   3.34 1.97 2.89  96.66   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   2   2   0.20 2.12 2.89  99.80   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   2  18   0.32 2.68 2.89  99.68   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   3   3   0.43 2.28 2.89  99.57   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   3  19   0.32 1.47 2.89  99.68   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   4   4   0.14 2.61 2.89  99.86   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   4  20   0.14 1.90 2.89  99.86   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   5   5   0.09 1.98 2.89  99.91   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   5  21   0.18 1.80 2.89  99.82   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   6   6   0.14 1.94 2.89  99.86   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   6  22   0.03 2.12 2.89  99.97   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   7   7   0.02 2.28 2.89  99.98   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   7  23   0.02 2.02 2.89  99.98   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   0   8   3.49 2.37 2.89  96.51   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   0  24   1.30 2.48 2.89  98.70   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   1   9   0.85 2.39 2.89  99.15   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   1  25   0.54 2.66 2.89  99.46   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   2  10   0.49 1.92 2.89  99.51   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   2  26   0.23 2.17 2.89  99.77   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   3  11   0.24 2.18 2.89  99.76   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   3  27   0.57 1.65 2.89  99.43   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   4  12   0.22 2.30 2.89  99.78   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   4  28   0.28 2.10 2.89  99.72   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   5  13   0.44 1.79 2.89  99.56   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   5  29   0.10 2.02 2.89  99.90   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   6  14   0.05 2.46 2.89  99.95   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   6  30   0.06 2.44 2.89  99.94   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   7  15   2.24 1.44 2.89  97.76   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   7  31   0.70 2.23 2.89  99.30   0.00   0.00   0.00   0.00   0.00   0.00   0.00
}}}






turbo mode is disabled 
{{{
          <!-- Turbo Mode -->
          <!-- Description: Turbo Mode. -->
          <!-- Possible Values: "Disabled", "Enabled" -->
          <Turbo_Mode>Disabled</Turbo_Mode>
}}}

! cpu_topology script
{{{
[root@enkx3db02 cpu-topology]# sh ~root/cpu_topology
        Product Name: SUN FIRE X4170 M3
        Product Name: ASSY,MOTHERBOARD,1U
model name      : Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
processors  (OS CPU count)          0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
physical id (processor socket)      0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
siblings    (logical CPUs/socket)   8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
core id     (# assigned to a core)  0 1 6 7 0 1 6 7 0 1 6 7 0 1 6 7
cpu cores   (physical cores/socket) 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
}}}


! intel cpu topology tool
{{{
[root@enkx3db02 cpu-topology]# ./cpu_topology64.out


        Advisory to Users on system topology enumeration

This utility is for demonstration purpose only. It assumes the hardware topology
configuration within a coherent domain does not change during the life of an OS
session. If an OS support advanced features that can change hardware topology
configurations, more sophisticated adaptation may be necessary to account for
the hardware configuration change that might have added and reduced the number
of logical processors being managed by the OS.

User should also`be aware that the system topology enumeration algorithm is
based on the assumption that CPUID instruction will return raw data reflecting
the native hardware configuration. When an application runs inside a virtual
machine hosted by a Virtual Machine Monitor (VMM), any CPUID instructions
issued by an app (or a guest OS) are trapped by the VMM and it is the VMM's
responsibility and decision to emulate/supply CPUID return data to the virtual
machines. When deploying topology enumeration code based on querying CPUID
inside a VM environment, the user must consult with the VMM vendor on how an VMM
will emulate CPUID instruction relating to topology enumeration.



        Software visible enumeration in the system:
Number of logical processors visible to the OS: 16
Number of logical processors visible to this process: 16
Number of processor cores visible to this process: 8
Number of physical packages visible to this process: 2


        Hierarchical counts by levels of processor topology:
 # of cores in package  0 visible to this process: 4 .
         # of logical processors in Core 0 visible to this process: 2 .
         # of logical processors in Core  1 visible to this process: 2 .
         # of logical processors in Core  2 visible to this process: 2 .
         # of logical processors in Core  3 visible to this process: 2 .
 # of cores in package  1 visible to this process: 4 .
         # of logical processors in Core 0 visible to this process: 2 .
         # of logical processors in Core  1 visible to this process: 2 .
         # of logical processors in Core  2 visible to this process: 2 .
         # of logical processors in Core  3 visible to this process: 2 .


        Affinity masks per SMT thread, per core, per package:
Individual:
        P:0, C:0, T:0 --> 1
        P:0, C:0, T:1 --> 100

Core-aggregated:
        P:0, C:0 --> 101
Individual:
        P:0, C:1, T:0 --> 2
        P:0, C:1, T:1 --> 200

Core-aggregated:
        P:0, C:1 --> 202
Individual:
        P:0, C:2, T:0 --> 4
        P:0, C:2, T:1 --> 400

Core-aggregated:
        P:0, C:2 --> 404
Individual:
        P:0, C:3, T:0 --> 8
        P:0, C:3, T:1 --> 800

Core-aggregated:
        P:0, C:3 --> 808

Pkg-aggregated:
        P:0 --> f0f
Individual:
        P:1, C:0, T:0 --> 10
        P:1, C:0, T:1 --> 1z3

Core-aggregated:
        P:1, C:0 --> 1010
Individual:
        P:1, C:1, T:0 --> 20
        P:1, C:1, T:1 --> 2z3

Core-aggregated:
        P:1, C:1 --> 2020
Individual:
        P:1, C:2, T:0 --> 40
        P:1, C:2, T:1 --> 4z3

Core-aggregated:
        P:1, C:2 --> 4040
Individual:
        P:1, C:3, T:0 --> 80
        P:1, C:3, T:1 --> 8z3

Core-aggregated:
        P:1, C:3 --> 8080

Pkg-aggregated:
        P:1 --> f0f0


        APIC ID listings from affinity masks
OS cpu   0, Affinity mask   000001 - apic id 0
OS cpu   1, Affinity mask   000002 - apic id 2
OS cpu   2, Affinity mask   000004 - apic id c
OS cpu   3, Affinity mask   000008 - apic id e
OS cpu   4, Affinity mask   000010 - apic id 20
OS cpu   5, Affinity mask   000020 - apic id 22
OS cpu   6, Affinity mask   000040 - apic id 2c
OS cpu   7, Affinity mask   000080 - apic id 2e
OS cpu   8, Affinity mask   000100 - apic id 1
OS cpu   9, Affinity mask   000200 - apic id 3
OS cpu  10, Affinity mask   000400 - apic id d
OS cpu  11, Affinity mask   000800 - apic id f
OS cpu  12, Affinity mask   001000 - apic id 21
OS cpu  13, Affinity mask   002000 - apic id 23
OS cpu  14, Affinity mask   004000 - apic id 2d
OS cpu  15, Affinity mask   008000 - apic id 2f


Package 0 Cache and Thread details


Box Description:
Cache  is cache level designator
Size   is cache size
OScpu# is cpu # as seen by OS
Core   is core#[_thread# if > 1 thread/core] inside socket
AffMsk is AffinityMask(extended hex) for core and thread
CmbMsk is Combined AffinityMask(extended hex) for hw threads sharing cache
       CmbMsk will differ from AffMsk if > 1 hw_thread/cache
Extended Hex replaces trailing zeroes with 'z#'
       where # is number of zeroes (so '8z5' is '0x800000')
L1D is Level 1 Data cache, size(KBytes)= 32,  Cores/cache= 2, Caches/package= 4
L1I is Level 1 Instruction cache, size(KBytes)= 32,  Cores/cache= 2, Caches/package= 4
L2 is Level 2 Unified cache, size(KBytes)= 256,  Cores/cache= 2, Caches/package= 4
L3 is Level 3 Unified cache, size(KBytes)= 20480,  Cores/cache= 8, Caches/package= 1
      +-----------+-----------+-----------+-----------+
Cache |  L1D      |  L1D      |  L1D      |  L1D      |
Size  |  32K      |  32K      |  32K      |  32K      |
OScpu#|    0     8|    1     9|    2    10|    3    11|
Core  |c0_t0 c0_t1|c1_t0 c1_t1|c2_t0 c2_t1|c3_t0 c3_t1|
AffMsk|    1   100|    2   200|    4   400|    8   800|
CmbMsk|  101      |  202      |  404      |  808      |
      +-----------+-----------+-----------+-----------+

Cache |  L1I      |  L1I      |  L1I      |  L1I      |
Size  |  32K      |  32K      |  32K      |  32K      |
      +-----------+-----------+-----------+-----------+

Cache |   L2      |   L2      |   L2      |   L2      |
Size  | 256K      | 256K      | 256K      | 256K      |
      +-----------+-----------+-----------+-----------+

Cache |   L3                                          |
Size  |  20M                                          |
CmbMsk|  f0f                                          |
      +-----------------------------------------------+

Combined socket AffinityMask= 0xf0f


Package 1 Cache and Thread details


Box Description:
Cache  is cache level designator
Size   is cache size
OScpu# is cpu # as seen by OS
Core   is core#[_thread# if > 1 thread/core] inside socket
AffMsk is AffinityMask(extended hex) for core and thread
CmbMsk is Combined AffinityMask(extended hex) for hw threads sharing cache
       CmbMsk will differ from AffMsk if > 1 hw_thread/cache
Extended Hex replaces trailing zeroes with 'z#'
       where # is number of zeroes (so '8z5' is '0x800000')
      +-----------+-----------+-----------+-----------+
Cache |  L1D      |  L1D      |  L1D      |  L1D      |
Size  |  32K      |  32K      |  32K      |  32K      |
OScpu#|    4    12|    5    13|    6    14|    7    15|
Core  |c0_t0 c0_t1|c1_t0 c1_t1|c2_t0 c2_t1|c3_t0 c3_t1|
AffMsk|   10   1z3|   20   2z3|   40   4z3|   80   8z3|
CmbMsk| 1010      | 2020      | 4040      | 8080      |
      +-----------+-----------+-----------+-----------+

Cache |  L1I      |  L1I      |  L1I      |  L1I      |
Size  |  32K      |  32K      |  32K      |  32K      |
      +-----------+-----------+-----------+-----------+

Cache |   L2      |   L2      |   L2      |   L2      |
Size  | 256K      | 256K      | 256K      | 256K      |
      +-----------+-----------+-----------+-----------+

Cache |   L3                                          |
Size  |  20M                                          |
CmbMsk| f0f0                                          |
      +-----------------------------------------------+
}}}


! intel turbostat
{{{
[root@enkx3db02 ~]# ./turbostat
pkg core CPU   %c0   GHz  TSC   %c1    %c3    %c6    %c7   %pc2   %pc3   %pc6   %pc7
               2.05 2.42 2.89  97.95   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   0   0   3.19 1.93 2.89  96.81   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   0   8   2.09 1.93 2.89  97.91   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   1   1   4.14 2.22 2.89  95.86   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   1   9  10.10 2.66 2.89  89.90   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   6   2   0.89 1.98 2.89  99.11   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   6  10   5.12 2.79 2.89  94.88   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   7   3   0.40 2.26 2.89  99.60   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   0   7  11   0.46 2.33 2.89  99.54   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   0   4   1.86 2.07 2.89  98.14   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   0  12   0.53 2.33 2.89  99.47   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   1   5   0.57 2.45 2.89  99.43   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   1  13   0.95 2.55 2.89  99.05   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   6   6   0.58 1.62 2.89  99.42   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   6  14   1.04 2.68 2.89  98.96   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   7   7   0.31 2.18 2.89  99.69   0.00   0.00   0.00   0.00   0.00   0.00   0.00
   1   7  15   0.58 2.75 2.89  99.42   0.00   0.00   0.00   0.00   0.00   0.00   0.00
}}}
http://rnm1978.wordpress.com/2011/02/02/instrumenting-obiee-for-tracing-oracle-db-calls/
http://rnm1978.wordpress.com/2010/01/26/identify-your-users-by-setting-client-id-in-oracle/

http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
http://www.oracle-base.com/articles/10g/PerformanceTuningEnhancements10g.php

http://method-r.com/software/mrtools
http://method-r.com/component/content/article/115 <-- mrls
http://method-r.com/component/content/article/116 <-- mrnl
http://method-r.com/component/content/article/117 <-- mrskew

http://appsdba.com/docs/orcl_event_6340.html <-- trace file event timeline 
http://www.appsdba.com/blog/?category_name=oracle-dba&paged=2
http://www.appsdba.com/blog/?p=109 <-- trace file execution tree
http://appsdba.com/utilities_resource.htm 

http://www.juliandyke.com/Diagnostics/Trace/EnablingTrace.html
http://www.rittmanmead.com/2005/04/tracing-parallel-execution/
http://www.antognini.ch/2012/08/event-10046-full-list-of-levels/
http://www.sagecomputing.com.au/papers_presentations/lostwithoutatrace.pdf   <- good stuff, with sample codes
http://www.oracle-base.com/articles/8i/DBMS_APPLICATION_INFO.php    <- DBMS_APPLICATION_INFO : For Code Instrumentation
http://www.oracle-base.com/articles/misc/DBMS_SESSION.php <- DBMS_SESSION : Managing Sessions From a Connection Pool in Oracle Databases
http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
http://www.petefinnigan.com/ramblings/how_to_set_trace.htm
http://psoug.org/reference/dbms_monitor.html
http://psoug.org/reference/dbms_applic_info.html
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:49818662859946

How to: Trace the SQL executed by SYSMAN Using a Trigger [ID 400937.1]
{{{
CREATE OR REPLACE TRIGGER logontrig AFTER logon ON database 
begin 
if ora_login_user = 'SYSMAN' then 
execute immediate 'alter session set tracefile_identifier = '||'SYSMAN'; 
execute immediate 'Alter session set events ''10046 trace name context forever, level 12'''; 
end if; 
end;
/
}}}


Capture 10046 Traces Upon User Login (without using a trigger) [ID 371678.1]
http://dbmentors.blogspot.com/2011/09/using-dbmsmonitor.html
http://docs.oracle.com/cd/B28359_01/network.111/b28531/app_context.htm <- application context
https://method-r.fogbugz.com/default.asp?method-r.11.139.2 <- hotsos ILO 
http://www.databasejournal.com/features/oracle/article.php/3435431/Oracle-Session-Tracing-Part-I.htm   <- Oracle Session Tracing Part I







''per module''
{{{
exec DBMS_MONITOR.serv_mod_act_trace_enable (service_name => 'FSTSTAH', module_name => 'EX_APPROVAL');
exec DBMS_MONITOR.serv_mod_act_trace_disable (service_name => 'FSTSTAH', module_name => 'EX_APPROVAL');
trcsess output=client.trc module=EX_APPROVAL *.trc
./orasrp --aggregate=no --binds=0 --recognize-idle-events=no --sys=no client.trc fsprd.html
tkprof client.trc client.tkprof sort=exeela 
}}}

''grep tkprof SQLs''
{{{
less client.tkprof-webapp | grep -B3 -A30 "SELECT L2.TREE_NODE_NUM" | egrep "SQL ID|total" | less

SQL ID: 9gxa3r2v0mkzp Plan Hash: 751140913
total       24      3.65       3.65          0       9103          0        4294
SQL ID: 9zssps0292n9m Plan Hash: 2156210208
total       17      2.64       2.64          0     206748          0        2901
SQL ID: 034a6u0h7psb1 Plan Hash: 2156210208
total        3      0.18       0.18          0       8929          0           4
SQL ID: 2yr2m4xfb14z0 Plan Hash: 4136997945
total        3      0.18       0.18          0       9102          0           3
SQL ID: 0rurft7y2paks Plan Hash: 3656446192
total       14      3.62       3.62          0       9102          0        2391
SQL ID: 99ugjzcz1j1r4 Plan Hash: 2156210208
total       24      2.62       2.62          0     206749          0        4337
SQL ID: 5fgb0cvhqy8w2 Plan Hash: 2156210208
total       28      3.26       3.26          0     215957          0        5077
SQL ID: amrb5fkaysu2r Plan Hash: 2156210208
total        3      0.14       0.14          0      11367          0           3
SQL ID: 3d6u5vjh1y5ny Plan Hash: 2156210208
total       20      3.26       3.27          0     215956          0        3450

}}}


{{{
select service_name, module from v$session where module = 'EX_APPROVAL'
 
SERVICE_NAME                                                     MODULE
---------------------------------------------------------------- ----------------------------------------------------------------
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
FSPRDOL                                                          EX_APPROVAL
 
9 rows selected.
 
 
 
SYS@fsprd2> SELECT * FROM DBA_ENABLED_TRACES ;
SYS@fsprd2>
SYS@fsprd2> /
 
no rows selected
 
SYS@fsprd2>
SYS@fsprd2>
SYS@fsprd2> exec DBMS_MONITOR.serv_mod_act_trace_enable (service_name => 'FSPRDOL', module_name => 'EX_APPROVAL');
 
PL/SQL procedure successfully completed.
 
 
SELECT 
TRACE_TYPE,
PRIMARY_ID,
QUALIFIER_ID1,
waits,
binds
FROM DBA_ENABLED_TRACES;
 
 
TRACE_TYPE            PRIMARY_ID                                                       QUALIFIER_ID1                                WAITS BINDS
--------------------- ---------------------------------------------------------------- ------------------------------------------------ ----- -----
SERVICE_MODULE        FSPRDOL                                                          EX_APPROVAL                                  TRUE  FALSE
 


--To disable
 exec DBMS_MONITOR.serv_mod_act_trace_disable (service_name => 'FSPRDOL', module_name => 'EX_APPROVAL');
}}}
11g
http://structureddata.org/2011/08/18/creating-optimizer-trace-files/?utm_source=rss&utm_medium=rss&utm_campaign=creating-optimizer-trace-files

Examining the Oracle Database 10053 Trace Event Dump File
http://www.databasejournal.com/features/oracle/article.php/3894901/article.htm

Don Seiler
http://seilerwerks.wordpress.com/2007/08/17/dr-statslove-or-how-i-learned-to-stop-guessing-and-love-the-10053-trace/
! your own session
{{{
trace the session

ALTER SESSION SET TRACEFILE_IDENTIFIER='LIO_TRACE';
ALTER SESSION SET EVENTS '10200 TRACE NAME CONTEXT FOREVER, LEVEL 1';

Then take the occurrence of the LIO reasons

$ less emrep_ora_9946_WATCH_CONSISTENT.trc | grep "started for block" | awk '{print $1} ' | sort | uniq -c
    324 ktrget2():
     44 ktrgtc2():


I found this too which more on tracking the objects
http://hoopercharles.wordpress.com/2011/01/24/watching-consistent-gets-10200-trace-file-parser/
}}}

! another session
{{{

1) create the files ss.sql and getlio.awk (see below)

2) get the sid and serial# and trace file name

SELECT s.sid, 
s.serial#,
s.server, 
lower( 
CASE 
WHEN s.server IN ('DEDICATED','SHARED') THEN 
i.instance_name || '_' || 
nvl(pp.server_name, nvl(ss.name, 'ora')) || '_' || 
p.spid || '.trc' 
ELSE NULL 
END 
) AS trace_file_name 
FROM v$instance i, 
v$session s, 
v$process p, 
v$px_process pp, 
v$shared_server ss 
WHERE s.paddr = p.addr 
AND s.sid = pp.sid (+) 
AND s.paddr = ss.paddr(+) 
AND s.type = 'USER' 
ORDER BY s.sid;

3) to start trace, set the 10200 event level 1

exec sys.dbms_system.set_ev(200   ,   11667, 10200, 1, '');

4) monitor the file size

while : ; do du -sm dw_ora_18177.trc ; echo "--" ; sleep 2 ; done

5) execute ss.sql on the sid for 5 times

6) to stop trace, set the 10200 event level 0

exec sys.dbms_system.set_ev(200   ,   11667, 10200, 0, '');

7) process the trace file and the oradebug output

-- get the top objects
awk -v trcfile=dw_ora_18177.trc -f getlio.awk

-- get the function names
less dw_ora_18177.trc | grep "started for block" | awk '{print $1} ' | sort | uniq -c

8) SQL to get the object names

	SELECT
	  OBJECT_NAME,
	  DATA_OBJECT_ID,
	  TO_CHAR(DATA_OBJECT_ID, 'XXXXX') HEX_DATA_OBJECT_ID
	FROM
	  DBA_OBJECTS
	WHERE
	  DATA_OBJECT_ID IN(
	    TO_NUMBER('15ced', 'XXXXX'))
	/

	OBJECT_NAME                                                                                                                      DATA_OBJECT_ID HEX_DA
	-------------------------------------------------------------------------------------------------------------------------------- -------------- ------
	OBJ$                                                                                                                                         18     12


	Summary obj for file: dw_ora_18177.trc
	---------------------------------
	0x00000012 2781466


	2781466 ktrget2():



#### ss.sql and getlio.awk scripts below

cat ss.sql
oradebug setospid &spid
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack
oradebug short_stack



$ cat getlio.awk
BEGIN {
   FS ="[ \t<>:]+"
    print "Details for file: " trcfile
   print "---------------------------------"
   while( getline < trcfile != EOF ){
      if ( $0 ~ /started for block/ ) {
      rdba[$6]+=1
      obj[$8]+=1
      both[$6","$8]+=1
      #print $6 " " rdba[$6] ", " $8 " " obj[$8]
      }
   }
   close (trcfile)
   print ""

   print ""
   print "Summary rdba and obj for file: " trcfile
   print "---------------------------------"
   for ( var in both) {
      #print var " " both[var]
   }

   print ""
   print "Summary obj for file: " trcfile
   print "---------------------------------"
   for ( var in obj ) {
      print var " " obj[var]
   }
}

}}}
http://www.freelists.org/post/oracle-l/SQL-High-version-count-because-of-too-many-varchar2-columns,12
http://t31808.db-oracle-general.databasetalk.us/sql-high-version-count-because-of-too-many-varchar2-columns-t31808.html

SQLs With Bind Variable Has Very High Version Count (Doc ID 258742.1)
{{{
event="10503 trace name context forever, level " 

For eg., if the maximum length of a bind variable in the application is 128, then 

event="10503 trace name context forever, level 128" 

The EVENT 10503 was added as a result of BUG:2450264 
This fix introduces the EVENT 10503 which enables users to specify a character bind buffer length. 
Depending on the length used, the character binds in the child cursor can all be created 
using the same bind length; 
skipping bind graduation and keeping the child chain relatively small. 
This helps to alleviate a potential cursor-sharing problem related to graduated binds. 

The level of the event is the bind length to use, in bytes. 
It is relevant for binds of types: 

Character (but NOT ANSI Fixed CHAR (type 96 == DTYAFC)) 
Raw 
Long Raw 
Long 

* There really is no limit for the EVENT 10503 but for the above datatypes. 
For non-PL/SQL calls, the maximum bind buffer size is 4001 (bytes). For PL/SQL, 
the maximum bind buffer size is 32K. 

* Specifying a buffer length which is greater than the pre-set maximum will cause the 
pre-set maximum to be used. To go back to using the pre-set lengths, specify '0' for the buffer 
length. 


Test the patch and event in development environment before implementing in the production environment. 
}}}
! tuning
http://www.redhat.com/promo/summit/2008/downloads/pdf/Thursday/Mark_Wagner.pdf
http://www.oracle.com/technetwork/server-storage/vm/ovm3-10gbe-perf-1900032.pdf
http://dak1n1.com/blog/7-performance-tuning-intel-10gbe
-- this will hog your server's memory in no time
{{{
select count(*) from dual connect by 1=1;
}}}

http://www.pythian.com/news/26003/rdbms-online-patching/

''Online Patching is a new feature introduced in 11.1.0.6. It will be delivered starting with RDBMS 11.2.0.2.0.''

http://goo.gl/2U3H3

http://apex.oracle.com/pls/apex/f?p=44785:24:0:::24:P24_CONTENT_ID,P24_PREV_PAGE:4679,1

RDBMS Online Patching Aka Hot Patching [ID 761111.1]
''Quick guide to package ORA- errors with ADRCI'' http://www.evernote.com/shard/s48/sh/e6086cd4-ab4e-4065-b145-323cfa545f80/a831bef2f6480f43c96bb23749df2710


http://goo.gl/mNnaD

''quick step by step'' https://support.oracle.com/CSP/main/article?cmd=show&type=ATT&id=443529.1:Steps&inline=1
How to Build a Testcase for Oracle Data Server Support to Reproduce ORA-600 and ORA-7445 Errors (Doc ID 232963.1)


To change the ADR base
<<<
ADR base = "/u01/app/oracle/product/11.2.0.3/dbhome_1/log"
adrci>
adrci>
''adrci> set base /u01/app/oracle''
adrci>
adrci> show home
ADR Homes:
diag/asm/+asm/+ASM4
diag/tnslsnr/pd01db04/listener
diag/tnslsnr/pd01db04/listener_fsprd
diag/tnslsnr/pd01db04/listener_temp
diag/tnslsnr/pd01db04/listener_mtaprd11
diag/tnslsnr/pd01db04/listener_scan2
diag/tnslsnr/pd01db04/listener_mvwprd
diag/tnslsnr/pd01db04/stat
diag/rdbms/dbm/dbm4
diag/rdbms/dbfsprd/DBFSPRD4
diag/rdbms/mtaprd11/mtaprd112
diag/rdbms/fsprd/fsprd2
diag/rdbms/fsqacdc/fsqa2
diag/rdbms/fsprddal/fsprd2
diag/rdbms/mtaprd11dal/mtaprd112
diag/rdbms/mvwprd/mvwprd2
diag/rdbms/mvwprddal/mvwprd2
diag/clients/user_oracle/host_783020838_80
diag/clients/user_oracle/host_783020838_11
<<<


{{{
Use ADRCI or SWB steps to create IPS packages
ADRCI
1. Enter ADRCI
# Adrci
2 shows the existence of the ADR home
adrci> show home
4 Setting ADR home
adrci> set home
5 shows all the problems
adrci> show problem
6 show all events
adrci> show incident
7 diagnostic information packed event
adrci> ips pack incident <incident id>
SWB
1 Log in to Enterprise Manager
2 Click the link 'support workbench'
3 Select 'all active' problem
4 Click the 'problem id' to view the corresponding event
5 Select the appropriate event
6 Click the 'quick package'
7 Enter the package name, description, choose whether to upload to oracle support
8 See the information package
9. Select the 'immediate' create the package, and click the button 'submit'

<br /> For more information, please read the following note for more information.
Note 422893.1 - 11g Understanding Automatic Diagnostic Repository.
Note 1091653.1 - "11g Quick Steps - How to create an IPS package using Support Workbench" [Video]
Note 443529.1 - 11g Quick Steps to Package and Send Critical Error Diagnostic Information to Support [Video] 
}}}

11g : Active Database Duplication
 	Doc ID:	Note:568034.1



-- DATABASE REPLAY

Oracle Database Replay Client Provisioning - Platform Download Matrix
  	Doc ID: 	815567.1

How To Find Database Replay Divergence Details [ID 1388309.1]


Oracle Database 11g: Interactive Quick Reference http://goo.gl/rQejT
{{{

New Products Installed in 11g:
------------------------------

1) Oracle APEX
	**- Installed by default

2) Oracle Warehouse Builder
	**- Installed by default

3) Oracle Configuration Manager
	- Offered, not installed by default
		two options:
			connected mode	
			disconnected mode

4) SQL Developer
	- Installed by default with template-based database installations
	- It is also installed with database client

5) Database Vault
	- Installed by default (OPTIONAL component - custom installation)



Changes in Install Options:
---------------------------

1) Oracle Configuration Manager
	- Starting 11g, Integrated with OUI (OPTIONAL component)

2) Oracle Data Mining
	- Selected on Enterprise Edition Installation type

3) Oracle Database Vault
	- Starting 11g, Integrated with OUI (OPTIONAL component - custom installation)

4) Oracle HTTP Server
	- Starting 11g, Available on separate media

5) Oracle Ultra Search
	- Starting 11g, Integrated with the Oracle Database

6) Oracle XML DB
	- Starting 11g, Installed by default



New Parameters:
---------------

MEMORY_TARGET
DIAGNOSTIC_DEST



New in ASM:
-----------

Automatic Storage Management Fast Mirror Resync
	see: Oracle Database Storage Administrator's Guide
SYSASM privilege
OSASM group



New Directories:
----------------

ADR_base/diag	<-- automatic diagnostic repository



Deprecated Components: 
----------------------

iSQL*Plus
Oracle Workflow
Oracle Data Mining Scoring Engine
Oracle Enterprise Manager Java Console




Overview of Installation:
-------------------------

CSS (Cluster Synchronization Services) does the synchronization between ASM and database instance
	for RAC, resides on Clusterware Home
	for Single Node-Single System, resides on home directory of ASM instance


Automatic Storage Management
	can be used starting 10.1.0.3 or later
	also, if you are 11.1 then you could use ASM from 10.1


Database Management Options:
	either you use:
	1) Enterprise Manager Grid Control
		Oracle Management Repository & Service --> Install Management Agent on each computer
	2) Local Database Control


Upgrading the database using RHEL 2.1 OS
	www.oracle.com/technology/tech/linux/pdf/rhel_23_upgrade.pdf



Preinstallation:
----------------


1) Logging In to the System as root

2) Checking the Hardware Requirements
	**NEW-parameters:
		memory_max_target
		memory_target

3) Checking the Software Requirements
	# Operating System Requirements
	# Kernel Requirements
	# Package Requirements
rpm -qa | grep -i "binutils"
rpm -qa | grep -i "compat-libstdc++"
rpm -qa | grep -i "elfutils-libelf"
rpm -qa | grep -i "elfutils-libelf-devel"
rpm -qa | grep -i "glibc"
rpm -qa | grep -i "glibc-common"
rpm -qa | grep -i "glibc-devel"
rpm -qa | grep -i "gcc"
rpm -qa | grep -i "gcc-c++"
rpm -qa | grep -i "libaio"
rpm -qa | grep -i "libaio-devel" 
rpm -qa | grep -i "libgcc"
rpm -qa | grep -i "libstdc++" 
rpm -qa | grep -i "libstdc++-devel"
rpm -qa | grep -i "make"
rpm -qa | grep -i "sysstat"
rpm -qa | grep -i "unixODBC"
rpm -qa | grep -i "unixODBC-devel"


NOT DISCOVERED:
rpm -qa | grep -i "elfutils-libelf-devel"
	dep: elfutils-libelf-devel-static-0.125-3.el5.i386.rpm
rpm -qa | grep -i "libaio-devel"
rpm -qa | grep -i "sysstat"
rpm -qa | grep -i "unixODBC"
rpm -qa | grep -i "unixODBC-devel"

	# Compiler Requirements
	# Additional Software Requirements

4) Preinstallation Requirements for Oracle Configuration Manager

5) Checking the Network Setup
	# Configuring Name Resolution
	# Installing on DHCP Computers
	# Installing on Multihomed Computers
	# Installing on Computers with Multiple Aliases
	# Installing on Non-Networked Computers

6) Creating Required Operating System Groups and Users
	**NEW-group:
		OSASM group...which has a usual name of "ASMADMIN"
		this group is for ASM storage administrators

groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin
useradd -g oinstall -G dba,oper,asmadmin oracle

7) Configuring Kernel Parameters

in /etc/sysctl.conf
	# Controls the maximum shared segment size, in bytes
	kernel.shmmax = 4294967295
	
	# Controls the maximum number of shared memory segments, in pages
	kernel.shmall = 268435456
	
	fs.file-max = 102552
	kernel.shmmni = 4096
	kernel.sem = 250 32000 100 128
	net.ipv4.ip_local_port_range = 1024 65000
	net.core.rmem_default = 4194304
	net.core.rmem_max = 4194304
	net.core.wmem_default = 262144
	net.core.wmem_max = 262144

to increase shell limits:
in /etc/security/limits.conf
	oracle              soft    nproc   2047
	oracle              hard    nproc   16384
	oracle              soft    nofile  1024
	oracle              hard    nofile  65536

in /etc/pam.d/login
	session    required     /lib/security/pam_limits.so
	session    required     pam_limits.so

in /etc/profile
	if [ $USER = "oracle" ]; then
		if [ $SHELL = "/bin/ksh" ]; then
		ulimit -p 16384
		ulimit -n 65536
		else
		ulimit -u 16384 -n 65536
		fi
	fi

8) Identifying Required Software Directories

9) Identifying or Creating an Oracle Base Directory
root@localhost ~]# mkdir -p /u01/app
[root@localhost ~]# chown -R oracle:oinstall /u01/app
[root@localhost ~]# chmod -R 775 /u01/app

10) Choosing a Storage Option for Oracle Database and Recovery Files

11) Creating Directories for Oracle Database or Recovery Files
[root@localhost oracle]# mkdir flash_recovery_area
[root@localhost oracle]# chown oracle:oinstall flash_recovery_area/
[root@localhost oracle]# chmod 775 flash_recovery_area/

12) Preparing Disk Groups for an Automatic Storage Management Installation
13) Stopping Existing Oracle Processes
14) Configuring the oracle User's Environment
umask 022

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=ora11

PATH=$ORACLE_HOME/bin:$PATH


}}}
http://www.oracle-base.com/articles/11g/ACFS_11gR2.php

ACFS Technical Overview and Deployment Guide [ID 948187.1]  ''<-- ACFS now supports RMAN, DataPump on 11.2.0.3 above... BTW, it does not support archivelogs… You still have to have the FRA diskgroup to put your archivelogs/redo. At least you can have the ACFS as container of backupsets and data pump files''

''update''
11.2.0.3 now supports almost everything
http://docs.oracle.com/cd/E11882_01/server.112/e18951/asmfilesystem.htm#CACJFGCD
Starting with Oracle Automatic Storage Management 11g Release 2 (11.2.0.3), Oracle ACFS supports RMAN backups (BACKUPSET file type), archive logs (ARCHIVELOG file type), and Data Pump dumpsets (DUMPSET file type). Note that Oracle ACFS snapshots are not supported with these files.

''update 08/2014''
ACFS supported on Exadata
<<<
Creating AFCS file systems on Exadata storage requires the following:

Oracle Linux
Grid Infrastructure 12.1.0.2
Database files stored in ACFS on Exadata storage are subject to the following guidelines and restrictions:

Supported database versions are 10.2.0.4, 10.2.0.5, 11.2.0.4, and 12.1.
Hybrid Columnar Compression (HCC) support (for 11.2 and 12.1) requires fix for bug 19136936.
Exadata-offload features such as Smart Scan, Storage Indexes, IORM, Network RM, etc. are not supported.
Exadata Smart Flash Cache will cache read operations. Caching of write operations is expected in a later release.
No specialized cache hints are passed from the Database to the Exadata Storage layer, which means the Smart Flash Cache heuristics are based on I/O size, similar to any other block storage caching technology.
Exadata Smart Flash Logging is not supported.
Hardware Assisted Resilient Data (HARD) checks are not performed.
<<<


How To Install/Reinstall Or Deinstall ACFS Modules/Installation Manually? [ID 1371067.1]

http://www.oracle-base.com/articles/11g/DBFS_11gR2.php
http://ronnyegner.wordpress.com/2009/10/08/the-oracle-database-file-system-dbfs/
http://www.pythian.com/news/17849/chopt-utility/
http://perumal.org/enabling-and-disabling-database-options/
http://juliandyke.wordpress.com/2010/10/06/oracle-11-2-0-2-requires-multicasting-on-the-interconnect/
http://dbastreet.com/blog/?p=515
http://blog.ronnyegner-consulting.de/oracle-11g-release-2-install-guide/
{{{
the only difference it would make on the databases that will have the DBV and TDE configured is that when 
DBAs would try to create a user it has to go through the dvadmin user. Other databases that doesn’t have the 
DV schemas created and configured will still behave as is. 

Below is a sample of create a user in a DBV environment

SYS@dbv_1> SYS@dbv_1> select username from dba_users order by 1;

USERNAME
------------------------------
ANONYMOUS
APEX_030200
APEX_PUBLIC_USER
APPQOSSYS
BI
CTXSYS
DBSNMP
DIP
DVADMIN
DVF
DVOWNER
DVSYS

SYS@dbv_1> conn / as sysdba 
SYS@dbv_1> create user karlarao identified by karlarao;


create user karlarao identified by karlarao
                                   *
ERROR at line 1:
ORA-01031: insufficient privileges


SYS@dbv_1> conn dvadmin/<password>
Connected.
DVADMIN@dbv_1> create user karlarao identified by karlarao;

User created.
}}}
http://emarcel.com/upgrade-oracle-database-12c-with-asm-12-1-0-1-to-12-1-0-2/
{{{
LISTENER =
  (ADDRESS_LIST=
        (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
        (ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

SID_LIST_LISTENER=
   (SID_LIST=
        (SID_DESC=
          (GLOBAL_DBNAME=orcl)
          (SID_NAME=orcl)
          (ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)
        )
        (SID_DESC=
          (GLOBAL_DBNAME=noncdb)
          (SID_NAME=noncdb)
          (ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)
        )

      )

SECURE_REGISTER_LISTENER = (IPC)


}}}

https://martincarstenbach.wordpress.com/2012/06/20/little-things-worth-knowing-static-and-dynamic-listener-registration/
Monitoring Business Applications http://docs.oracle.com/cd/E24628_01/install.121/e24215/bussapps.htm#BEIBBHFH

It’s kind of a Service Type that combines information from:
* Systems (PSFT systems for example), 
* Service tests, 
* Real User experience Insight data and 
* Business Transaction Management data. 

http://hemantoracledba.blogspot.sg/2013/07/concepts-features-overturned-in-12c.html

Oracle Database 12c Release 1 Information Center (Doc ID 1595421.2)
Release Schedule of Current Database Releases (Doc ID 742060.1)

Master Note For Oracle Database 12c Release 1 (12.1) Database/Client Installation/Upgrade/Migration Standalone Environment (Non-RAC) (Doc ID 1520299.1)
Master Note of Linux OS Requirements for Database Server (Doc ID 851598.1)
Requirements for Installing Oracle Database 12.1 on RHEL5 or OL5 64-bit (x86-64) (Doc ID 1529433.1)
Requirements for Installing Oracle Database 12.1 on RHEL6 or OL6 64-bit (x86-64) (Doc ID 1529864.1)

Exadata 12.1.1.1.0 release and patch (16980054 ) (Doc ID 1571789.1)
<<showtoc>>

<<<
12c, single instance installation featuring Oracle 12.1.0.2.0 on Oracle Linux 6.6. 
The system is configured with 8 GB of RAM and 2 virtual CPUs. 
The username and password match for the oracle account. Root password is r00t. 
The ORACLE_HOME is in /u01/app/oracle/product/12.1.0.2/dbhome_1
<<<


! LAB X: OEM EXPRESS
{{{
0) create a swingbench schema

method a: lights out using swingbench installation

$> ./oewizard -scale 1 -dbap change_on_install -u soe_master -p soe_master -cl -cs //localhost/NCDB -ts SOE -create
SwingBench Wizard
Author  :	 Dominic Giles
Version :	 2.5.0.949

Running in Lights Out Mode using config file : oewizard.xml

============================================
|           Datagenerator Run Stats        |
============================================
Connection Time                        0:00:00.004
Data Generation Time                   0:00:20.889
DDL Creation Time                      0:00:56.606
Total Run Time                         0:01:17.503
Rows Inserted per sec                      579,546
Data Generated (MB) per sec                   47.2
Actual Rows Generated                   13,007,340


Post Creation Validation Report
===============================
The schema appears to have been created successfully.

Valid Objects
=============
Valid Tables : 'ORDERS','ORDER_ITEMS','CUSTOMERS','WAREHOUSES','ORDERENTRY_METADATA','INVENTORIES','PRODUCT_INFORMATION','PRODUCT_DESCRIPTIONS','ADDRESSES','CARD_DETAILS'
Valid Indexes : 'PRD_DESC_PK','PROD_NAME_IX','PRODUCT_INFORMATION_PK','PROD_SUPPLIER_IX','PROD_CATEGORY_IX','INVENTORY_PK','INV_PRODUCT_IX','INV_WAREHOUSE_IX','ORDER_PK','ORD_SALES_REP_IX','ORD_CUSTOMER_IX','ORD_ORDER_DATE_IX','ORD_WAREHOUSE_IX','ORDER_ITEMS_PK','ITEM_ORDER_IX','ITEM_PRODUCT_IX','WAREHOUSES_PK','WHS_LOCATION_IX','CUSTOMERS_PK','CUST_EMAIL_IX','CUST_ACCOUNT_MANAGER_IX','CUST_FUNC_LOWER_NAME_IX','ADDRESS_PK','ADDRESS_CUST_IX','CARD_DETAILS_PK','CARDDETAILS_CUST_IX'
Valid Views : 'PRODUCTS','PRODUCT_PRICES'
Valid Sequences : 'CUSTOMER_SEQ','ORDERS_SEQ','ADDRESS_SEQ','LOGON_SEQ','CARD_DETAILS_SEQ'
Valid Code : 'ORDERENTRY'
Schema Created

Method b) exp/imp

FYI - the export information

[enkdb03:oracle:MBACH] /home/oracle/mbach/swingbench/bin
> expdp system/manager directory=oradir logfile=exp_soe_master.txt dumpfile=exp_soe_master.dmp schemas=soe_master

Export: Release 12.1.0.2.0 - Production on Mon Jun 8 05:20:55 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** directory=oradir logfile=exp_soe_master.txt dumpfile=exp_soe_master.dmp schemas=soe_master
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 1.219 GB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/FUNCTIONAL_INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "SOE_MASTER"."ORDER_ITEMS"                  228.4 MB 4290312 rows
. . exported "SOE_MASTER"."ADDRESSES"                    110.4 MB 1500000 rows
. . exported "SOE_MASTER"."CUSTOMERS"                    108.0 MB 1000000 rows
. . exported "SOE_MASTER"."ORDERS"                       129.1 MB 1429790 rows
. . exported "SOE_MASTER"."INVENTORIES"                  15.26 MB  901254 rows
. . exported "SOE_MASTER"."CARD_DETAILS"                 63.88 MB 1500000 rows
. . exported "SOE_MASTER"."LOGON"                        51.24 MB 2382984 rows
. . exported "SOE_MASTER"."PRODUCT_DESCRIPTIONS"         216.8 KB    1000 rows
. . exported "SOE_MASTER"."PRODUCT_INFORMATION"          188.1 KB    1000 rows
. . exported "SOE_MASTER"."ORDERENTRY_METADATA"          5.617 KB       4 rows
. . exported "SOE_MASTER"."WAREHOUSES"                   35.70 KB    1000 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /home/oracle/mbach/oradir/exp_soe_master.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Jun 8 05:23:39 2015 elapsed 0 00:02:39


-> this needs to be imported into NCDB, taken from /u01/software

1) enable OEM express if you haven't already with your database.

Check if enabled: 
  select dbms_xdb.getHttpPort() from dual;
  select dbms_xdb_config.getHttpsPort() from dual;

If none returns a result, set it up
  exec dbms_xdb_config.sethttpsport(5500);

2) start charbench on the command line

 create a AWR snapshot (exec dbms_workload_repository.create_snapshot)

 ./charbench -u soe_master -p soe_master -cs //localhost/NCDB -uc 10 -min -10 -max 100 -stats full -rt 0:10 -bs 0:01 -a 

 create another AWR snapshot (exec dbms_workload_repository.create_snapshot)

3) view the activity with your OEM express

if you need to use port-forwarding:
	ssh -L<oem express port>localhost:<oem express port>

Then point your browser to it: https://<VM-IP>:<oem express port>/em

4) explore OEM express

Look at the performance overview page
Review the performance hub and look at the various panes available to you

5) Create an active-html AWR report

Review and admire it
}}}

! LAB X) SQL Monitor reports

{{{
SQL Monitor reports are an very useful performance monitoring and tuning tool. In this lab you will start experimenting with it. In order to do so you need a query. In the first step you'll create one of your own liking based on the SOE schema you imported earlier. Ensure to supply the /*+ monitor */ hint when executing it!

0) run a large query

select /*+ monitor gather_plan_statistics sqlmon001 */
count(*) 
from customers c, 
 addresses a, 
 orders o, 
 order_items oi
where o.order_id = oi.order_id
and o.customer_id = c.customer_id
and a.customer_id = c.customer_id
and c.credit_limit = 
  (select max(credit_limit) from customers);

1) Create a SQL Monitor report from OEM express

Navigate the User Interface and find your monitored query. Take a note of the SQL ID, you will need it in step 3

2) Create a text version of the same SQL report

The graphical monitoring report requires a GUI and once retrieved, also relies on loading data from Oracle's website. In secure environments you may not have access to the Internet. In this step you need to look up the documentation for dbms_sqltune.report_sql_monitor and produce a text version of the report.

select dbms_sqltune.report_sql_monitor('&sqlID') from dual;

Review the reports and have a look around
}}}

! LAB X: OTHER DEVELOPMENT FEATURES

{{{
This is a large-ish lab where you are going to explore various development-related features with the database. 

1) Advanced index compression

The first lab will introduce you to index compression. It's based on a table created as a subset of soe.order_items. Copy the following script and execute it in your environment. 

SET ECHO ON;

DROP TABLE t1 purge;

CREATE TABLE t1 NOLOGGING AS 
SELECT * FROM ORDER_ITEMS WHERE ROWNUM <= 1e6;

CREATE INDEX t1_i1 ON t1 (order_id,line_item_id,product_id);

CREATE INDEX t1_i2 ON t1 (order_id, line_item_id);

CREATE INDEX t1_i3 ON t1 (order_id,line_item_id,product_id,unit_price);

CREATE INDEX t1_i4 ON t1 (order_id);

COL segment_name FOR A5 HEA "INDEX";

SET ECHO OFF;
SPO index.txt;
PRO NO COMPRESS

SELECT segment_name,
       blocks
  FROM user_segments
 WHERE segment_name LIKE 'T1%'
   AND segment_type = 'INDEX'
 ORDER BY
       segment_name;

SPO OFF;

SET ECHO ON;

/*
DROP TABLE t1 purge;

CREATE TABLE t1 NOLOGGING 
AS 
SELECT * FROM ORDER_ITEMS WHERE ROWNUM <= 1e6;
*/

DROP INDEX t1_i1;
DROP INDEX t1_i2;
DROP INDEX t1_i3;
DROP INDEX t1_i4;

CREATE INDEX t1_i1 ON t1 (order_id,line_item_id,product_id) COMPRESS 2;

CREATE INDEX t1_i2 ON t1 (order_id, line_item_id) COMPRESS 1;

CREATE INDEX t1_i3 ON t1 (order_id,line_item_id,product_id,unit_price) COMPRESS 3;

CREATE INDEX t1_i4 ON t1 (order_id) COMPRESS 1;

SET ECHO OFF;
SPO index.txt APP;
PRO PREFIX COMPRESSION

SELECT segment_name,
       blocks
  FROM user_segments
 WHERE segment_name LIKE 'T1%'
   AND segment_type = 'INDEX'
 ORDER BY
       segment_name;

SPO OFF;

SET ECHO ON;

DROP INDEX t1_i1;
DROP INDEX t1_i2;
DROP INDEX t1_i3;
DROP INDEX t1_i4;

CREATE INDEX t1_i1 ON t1 (order_id,line_item_id,product_id) COMPRESS ADVANCED LOW;

CREATE INDEX t1_i2 ON t1 (order_id, line_item_id) COMPRESS ADVANCED LOW;

CREATE INDEX t1_i3 ON t1 (order_id,line_item_id,product_id,unit_price) COMPRESS ADVANCED LOW;

CREATE INDEX t1_i4 ON t1 (order_id) COMPRESS ADVANCED LOW;

SET ECHO OFF;
SPO index.txt APP;
PRO ADVANCED COMPRESSION

SELECT segment_name,
       blocks
  FROM user_segments
 WHERE segment_name LIKE 'T1%'
   AND segment_type = 'INDEX'
 ORDER BY
       segment_name;

SPO OFF;

SET ECHO ON;

Review file index.txt and have a look at the various compression results.


2) Sequences as default values

In this part of the lab you will create two tables and experiment with sequences as default values for surrogate keys. You will need to create the following:

- table the_old_way: make sure it has an "ID" column as primary key
- create a sequence
- create a trigger that populates the ID if not supplied in the insert command 
- insert 100000 rows

One Potential Solution:

Create a sequence to allow the population of the table using default values.

create sequence s cache 10000 noorder;

create a simple table to hold an ID column to be used as a primary key. Add a few random columns such as a timestamp and a vc to store information. Next you need to create a before insert trigger that captures the insert statement and sets the ID's value to sequence.nextval, but only if the ID column is not part of the insert statement! The next step is to create an anonymous PL/SQL block to insert 100000 rows into the table.

create table the_old_way (
  id number primary key,
   d  timestamp not null,
  vc varchar2(50) not null
)
/

create or replace trigger the_old_way_bit
before insert on the_old_way for each row
declare
begin
 if :new.id is null then
  :new.id := s.nextval;
 end if;
end;
/

begin
   for i in 1..100000 loop
    insert into the_old_way (d, vc) values (systimestamp, 'with trigger');
   end loop;
end;
/

Note down the time for the execution of the PL/SQL block

Part two of the lab is a test with sequences as default values for the column. Create another table similar to the first one created but this time without the trigger. Ensure that the ID column is used as a primary key and that it has the sequence's next value as its default value. Then insert 100000 and note the time.

drop sequence s;

create sequence s cache 10000 noorder;

create table the_12c_way (
   id number default s.nextval primary key,
   d  timestamp not null,
   vc varchar2(50) not null
)
/

begin
   for i in 1..100000 loop
    insert into the_12c_way (d, vc) values (systimestamp, 'with trigger');
   end loop;
end;
/

Finally create yet another table, but this time with identity columns. Ensure that the identity column is defined in the same way as the sequence you created earlier. Then insert again and note the time.

create table the_12c_way_with_id (
   id number generated always as identity (
     start with 1 cache 100000),
   d  timestamp not null,
   vc varchar2(50) not null
)
/

begin
   for i in 1..100000 loop
    insert into the_12c_way_with_id (d, vc) values (systimestamp, 'with identity');
   end loop;
end;
/

Before finishing this section review the objects created as part of the identity table's DDL.

col IDENTITY_OPTIONS for a50 wrap
col SEQUENCE_NAME    for a30
col COLUMN_NAME      for a15

select column_name, generation_type, sequence_name, identity_options from USER_TAB_IDENTITY_COLS;

3) Embed a function in the WITH clause

Create a statement that selects from t1 and uses a function declared in the with-clause of the query to return a truncated date.

with
 function silly_little_function (pi_d in date) 
 return date is
 begin 
  return trunc(pi_d); 
 end;
select order_id, silly_little_function(dispatch_date)
 from t1 where rownum < 11
/

4) Automatic gathering of table statistics

create table t2 as select * from t1 and check the table statistics. Are they current? Why are there table statistics during a CTAS statement?

SQL> create table t2 as select * from t1 sample (50);

Table created.

Elapsed: 00:00:00.73
SQL> select table_name, partitioned, num_rows from tabs where table_name = 'T2';

TABLE_NAME                     PAR   NUM_ROWS
------------------------------ --- ----------
T2                             NO      500736

Elapsed: 00:00:00.04

SQL> select count(*) from t2;

  COUNT(*)
----------
    500736

Elapsed: 00:00:00.10
SQL> select sql_id from v$sql where sql_text = 'create table t2 as select * from t1 sample (50)';

SQL_ID
-------------
0h72ryws535xf

SQL> select * from table(dbms_xplan.display_cursor('0h72ryws535xf',null));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
SQL_ID  0h72ryws535xf, child number 0
-------------------------------------
create table t2 as select * from t1 sample (50)

Plan hash value: 2307360015

-----------------------------------------------------------------------------------------
| Id  | Operation                        | Name | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------------
|   0 | CREATE TABLE STATEMENT           |      |       |       |  2780 (100)|          |
|   1 |  LOAD AS SELECT                  |      |       |       |            |          |
|   2 |   OPTIMIZER STATISTICS GATHERING |      |   500K|    24M|  2132   (1)| 00:00:01 |
|   3 |    TABLE ACCESS STORAGE SAMPLE   | T1   |   500K|    24M|  2132   (1)| 00:00:01 |
-----------------------------------------------------------------------------------------

Note
-----
   - automatic DOP: Computed Degree of Parallelism is 1 because of parallel threshold


19 rows selected.

5) Top-N queries and pagination

Top-N queries used to be interesting in Oracle before 12c. In this lab you will appreciate their ease of use.

- list how many rows there are in table t1

select count(*) from t1;

- what are the min and max dispatch dates in the table?

SQL> alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss';

SQL> select min(dispatch_date), max(dispatch_date) from t1;

MIN(DISPATCH_DATE)  MAX(DISPATCH_DATE)
------------------- -------------------
01.01.2012 00:00:00 03.05.2012 00:00:00

- Create a query that orders rows in t1 by dispatch date and shows the first 15 rows only

select order_id, dispatch_date, gift_wrap from t1 order by dispatch_date fetch first 15 rows only;

- create a query that orders rows in t1 by dispatch date and shows rows 150 to 155

select order_id, dispatch_date, gift_wrap from t1 order by dispatch_date offset 150 rows fetch next 5 rows only;

- rewrite the last query with the pre-12c syntax and compare results

http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html

select * 
  from ( select /*+ FIRST_ROWS(n) */ 
  a.*, ROWNUM rnum 
      from ( select order_id, dispatch_date, gift_wrap from t1 order by dispatch_date ) a 
      where ROWNUM <= 155 ) 
where rnum  > 150;

- Compare execution times and plans


SQL> select * from table(dbms_xplan.display_cursor);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
SQL_ID  b20zp6jrn2yag, child number 0
-------------------------------------
select *   from ( select /*+ FIRST_ROWS(n) */   a.*, ROWNUM rnum
from ( select order_id, dispatch_date, gift_wrap from t1 order by
dispatch_date ) a       where ROWNUM <= 155 ) where rnum  > 150

Plan hash value: 2771300550

---------------------------------------------------------------------------------------------------------
| Id  | Operation                                | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                         |      |       |       |       |  8202 (100)|          |
|*  1 |  VIEW                                    |      |   155 |  7285 |       |  8202   (1)| 00:00:01 |
|*  2 |   COUNT STOPKEY                          |      |       |       |       |            |          |
|   3 |    VIEW                                  |      |  1000K|    32M|       |  8202   (1)| 00:00:01 |
|*  4 |     SORT ORDER BY STOPKEY                |      |  1000K|    19M|    30M|  8202   (1)| 00:00:01 |
|   5 |      TABLE ACCESS STORAGE FULL FIRST ROWS| T1   |  1000K|    19M|       |  2134   (1)| 00:00:01 |
---------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("RNUM">150)
   2 - filter(ROWNUM<=155)
   4 - filter(ROWNUM<=155)

Note
-----
   - automatic DOP: Computed Degree of Parallelism is 1 because of parallel threshold

SQL> select * from table(dbms_xplan.display_cursor);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
SQL_ID  0xhpxrmzzbwkp, child number 0
-------------------------------------
select order_id, dispatch_date, gift_wrap from t1 order by
dispatch_date offset 150 rows fetch next 5 rows only

Plan hash value: 2433988517

--------------------------------------------------------------------------------------------
| Id  | Operation                   | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |      |       |       |       |  8202 (100)|          |
|*  1 |  VIEW                       |      |  1000K|    53M|       |  8202   (1)| 00:00:01 |
|*  2 |   WINDOW SORT PUSHED RANK   |      |  1000K|    19M|    30M|  8202   (1)| 00:00:01 |
|   3 |    TABLE ACCESS STORAGE FULL| T1   |  1000K|    19M|       |  2134   (1)| 00:00:01 |
--------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter(("from$_subquery$_002"."rowlimit_$$_rownumber"<=CASE  WHEN (150>=0)
              THEN 150 ELSE 0 END +5 AND "from$_subquery$_002"."rowlimit_$$_rownumber">150))
   2 - filter(ROW_NUMBER() OVER ( ORDER BY "DISPATCH_DATE")<=CASE  WHEN (150>=0)
              THEN 150 ELSE 0 END +5)

Note
-----
   - automatic DOP: Computed Degree of Parallelism is 1 because of parallel threshold
}}}

! LAB X: PLUGGABLE DATABASES

{{{
Unlike the database in-memory option we can use the lab to experiment with Pluggable Databases. 

1) create a CDB

Use dbca in silent mode or any other technique you like to create a CDB with 1 PDB. Specify the data file location to be /u01/oradata and the FRA to go to /u01/fra. It is recommended to use oracle managed files for the database but you are free to chose whichever method you are most comfortable with.

2) log in to the CDB root

Once the CDB is created connect to it as SYSDBA and list all of the PDBs in the database. Where can you find them?

SQL> show pdbs

SQL> select con_id, name, open_mode, total_size from v$pdbs;

SQL> select pdb_id, pdb_name, status, logging, force_logging, force_nologging from dba_pdbs;

3) create a new PDB named MASTER from the seed

 - check if you are using OMF

  SQL> show parameter db_create_file_dest
  SQL> create pluggable database master admin user master_admin identified by secret roles=(dba) 
    2  default tablespace users datafile size 20m;
  SQL> alter pluggable database master open

4) list the MASTER PDBs data files

 - from the root
  SQL> select name from v$datafile where con_id = (select con_id from v$pdbs where name = 'MASTER');

 - from the PDB
  SQL> select name, bytes/power(1024,2) m from v$datafile;

  --> what is odd here? Compare with DBA_DATA_FILES

  SQL> select con_id, name, bytes/power(1024,2) m from v$datafile;

5) get familiar with the new dictionary views

The new architecture introduces new views and columns to existing views. Explore these, focus on the CDB% views and how they differ from the DBA views. Also check how many V$- views have a new column? Can you find evidence for linking packages in the PDB to the Root? 

 SQL> desc cdb_data_files
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FILE_NAME                                          VARCHAR2(513)
 FILE_ID                                            NUMBER
 TABLESPACE_NAME                                    VARCHAR2(30)
 BYTES                                              NUMBER
 BLOCKS                                             NUMBER
 STATUS                                             VARCHAR2(9)
 RELATIVE_FNO                                       NUMBER
 AUTOEXTENSIBLE                                     VARCHAR2(3)
 MAXBYTES                                           NUMBER
 MAXBLOCKS                                          NUMBER
 INCREMENT_BY                                       NUMBER
 USER_BYTES                                         NUMBER
 USER_BLOCKS                                        NUMBER
 ONLINE_STATUS                                      VARCHAR2(7)
 CON_ID                                             NUMBER

SQL> desc dba_data_files
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FILE_NAME                                          VARCHAR2(513)
 FILE_ID                                            NUMBER
 TABLESPACE_NAME                                    VARCHAR2(30)
 BYTES                                              NUMBER
 BLOCKS                                             NUMBER
 STATUS                                             VARCHAR2(9)
 RELATIVE_FNO                                       NUMBER
 AUTOEXTENSIBLE                                     VARCHAR2(3)
 MAXBYTES                                           NUMBER
 MAXBLOCKS                                          NUMBER
 INCREMENT_BY                                       NUMBER
 USER_BYTES                                         NUMBER
 USER_BLOCKS                                        NUMBER
 ONLINE_STATUS                                      VARCHAR2(7)

SQL> desc v$datafile

SQL> desc v$datafile
 Name														   Null?    Type
 ----------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------
 FILE#															    NUMBER
 CREATION_CHANGE#													    NUMBER
 CREATION_TIME														    DATE
 TS#															    NUMBER
 RFILE# 														    NUMBER
 STATUS 														    VARCHAR2(7)
 ENABLED														    VARCHAR2(10)
 CHECKPOINT_CHANGE#													    NUMBER
 CHECKPOINT_TIME													    DATE
 UNRECOVERABLE_CHANGE#													    NUMBER
 UNRECOVERABLE_TIME													    DATE
 LAST_CHANGE#														    NUMBER
 LAST_TIME														    DATE
 OFFLINE_CHANGE#													    NUMBER
 ONLINE_CHANGE# 													    NUMBER
 ONLINE_TIME														    DATE
 BYTES															    NUMBER
 BLOCKS 														    NUMBER
 CREATE_BYTES														    NUMBER
 BLOCK_SIZE														    NUMBER
 NAME															    VARCHAR2(513)
 PLUGGED_IN														    NUMBER
 BLOCK1_OFFSET														    NUMBER
 AUX_NAME														    VARCHAR2(513)
 FIRST_NONLOGGED_SCN													    NUMBER
 FIRST_NONLOGGED_TIME													    DATE
 FOREIGN_DBID														    NUMBER
 FOREIGN_CREATION_CHANGE#												    NUMBER
 FOREIGN_CREATION_TIME													    DATE
 PLUGGED_READONLY													    VARCHAR2(3)
 PLUGIN_CHANGE# 													    NUMBER
 PLUGIN_RESETLOGS_CHANGE#												    NUMBER
 PLUGIN_RESETLOGS_TIME													    DATE
 CON_ID 														    NUMBER

SQL> select object_name, object_type, namespace, sharing, oracle_maintained from dba_objects where object_name = 'DBMS_REPCAT_AUTH';

OBJECT_NAME			 OBJECT_TYPE		  NAMESPACE SHARING	  O
-------------------------------- ----------------------- ---------- ------------- -
DBMS_REPCAT_AUTH		 PACKAGE			  1 METADATA LINK Y
DBMS_REPCAT_AUTH		 PACKAGE BODY			  2 METADATA LINK Y
DBMS_REPCAT_AUTH		 SYNONYM			  1 METADATA LINK Y
DBMS_REPCAT_AUTH		 PACKAGE			  1 METADATA LINK Y
DBMS_REPCAT_AUTH		 PACKAGE BODY			  2 METADATA LINK Y

6) switch to the PDB as root

Explore ways to switch to the newly created PDB from the root without logging in again

  SQL> alter session set container = MASTER;

  SQL> select sys_context('userenv', 'con_name') from dual;

  SQL> select sys_context('userenv', 'con_id') from dual;

7) connect to the PDB using Net*8

Now try to connect to the PDB using Net*8 as MASTER_ADMIN. Ensure that you are connected to the correct container! Can you see that the user has the DBA role granted?

  $ sqlplus master_admin/secret@localhost/MASTER

  SQL> select sys_context('userenv', 'con_name') from dual;

  SQL> select sys_context('userenv', 'con_id') from dual;

  SQL> select * from session_privs;

8) view the privileges granted to MASTER_ADMIN

Now let's look a bit closer at the privileges granted to MASTER_ADMIN. Find the hierarchy of roles and grants. Which is the primary role granted to the user? How are the roles specified in the create pluggable database command linked to this role?

 SQL> select * from dba_role_privs where grantee = user;

GRANTEE                        GRANTED_ROLE                   ADM DEL DEF COM
------------------------------ ------------------------------ --- --- --- ---
MASTER_ADMIN                   PDB_DBA                        YES NO  YES NO

SQL> select * from dba_role_privs where grantee = 'PDB_DBA';

GRANTEE                        GRANTED_ROLE                   ADM DEL DEF COM
------------------------------ ------------------------------ --- --- --- ---
PDB_DBA                        DBA                            NO  NO  YES NO

Is it really the DBA role?

 SQL> select * from dba_sys_privs where grantee = 'DBA'; 

9) view the connection to the PDB from the root

You can see anyone connected to the PDBs from the root. In a separate session, connect to the MASTER PDB and try to identify that particular session from the CDB$ROOT.

  - connect to the PDB
   $ sqlplus master_admin/secret@localhost/MASTER
   SQL> exec dbms_application_info.set_client_info('find me!')

  - in another session, connect to the root
   $ sqlplus / as sysdba
   SQL> select username,sid,serial#,client_info,con_id from v$session where con_id = (select con_id from v$pdbs where name = 'MASTER');
 
USERNAME                              SID    SERIAL# CLIENT_INFO              CON_ID
------------------------------ ---------- ---------- -------------------- ----------
MASTER_ADMIN                           21      26215 find me!                      3

10) limit the maximum size of the PDB to 50M

PDBs are often used for consolidation. When consolidating, users pay for storage. We don't want them to use more than they pay for. Can you think of a way to limit the space available to a PDB? Can you test if that limit is enforced?

 - what is the minimum size you can set it to?

 SQL> alter pluggable database MASTER storage (maxsize 800M);
  
 - what is the PDB_MASTER's default tablespace?

 SQL> select default_tablespace from dba_users where username = user;

DEFAULT_TABLESPACE
------------------------------
USERS

 - check if the limit is enforced

 SQL> grant unlimited tablespace to master_admin;

 SQL> create table t1 nologging as select a.*, rpad(object_name, 200, 'x') large_c from dba_objects a;
 
 (may have to allow users to autoextend)

11) create a PDB from the MASTER

Creating a PDB from the SEED is only one way of creating a PDB. In the next step, create a PDB named PDB1 as a clone of MASTER. But first create a golden image of a database you'd like to use. To do so, create the following accounts in the MASTER PDB:

  + MONITORING
  + BACKUP
  + APPL_USER

Grant whichever privileges you like to grant to them. APPL_USER must have 3 tables in his schema: T1, T2 and T3. While you perform these tasks, tail the alert.log in a different session.

SQL> create user monitoring identified by monitoring;

User created.

SQL> grant select any dictionary to monitoring;

Grant succeeded.

SQL> create user backup identified by backup;

User created.

SQL> grant create session to backup;

Grant succeeded.

SQL> create user appl_user identified by appl_user;

User created.

SQL> alter user appl_user quota unlimited on users;

User altered.

SQL> grant connect , resource to appl_user;

Grant succeeded.

SQL> conn appl_user/appl_user@localhost/MASTER
Connected.

SQL> create table t1 as select * from all_objects ;

Table created.

SQL> select count(*) from t1;

  COUNT(*)
----------
     73704

SQL> create table t2 as select * from all_objects where rownum < 11 ;

Table created.

SQL> c.t2.t3
  1* create table t3 as select * from all_objects where rownum < 11
SQL> r
  1* create table t3 as select * from all_objects where rownum < 11

Table created.

SQL> show user
USER is "APPL_USER"
SQL>

- prepare the PDB for cloning

 alter pluggable database master close immediate;
 alter pluggable database master open read only;

- view the alert log

 adrci> set home CDB1
 adrci> show alert -tail -f

- clone the PDB

 SQL> create pluggable database pdb1 from master;

 (are you still tailing the alert.log?)

 SQL> alter pluggable database PDB1 open;

 + do you see the users you created? Do they have data in the tables?

SQL> conn appl_user/appl_user@localhost/PDB1
Connected.
SQL> select count(*) from t1;

  COUNT(*)
----------
     73704

SQL> select count(*) from t2;

  COUNT(*)
----------
        10

SQL> select count(*) from t3;

  COUNT(*)
----------
        10

 + perform any further validations you like

12) Create a metadata only clone

Since 12.1.0.2 it is possible to perform a metadata only clone. Try to perform one based on MASTER. Ensure that the tables in the new PDB have no data!

 - as SYSDBA
 
 SQL> create pluggable database pdb2 from master no data;

 SQL> alter pluggable database pdb2 open;

SQL> conn appl_user/appl_user@localhost/PDB2
Connected.
SQL> select count(*) from t1;

  COUNT(*)
----------
         0

13) Unplug and plug

In this lab you will unplug a PDB and plug it back in. Usually you'd perform these steps on a different CDB but due to space constraints it'll be the same one you will experiment with. Note that it is crucial to drop the PDB once unplugged. This isn't documented that clear in the official documentation set but nevertheless required. https://blogs.oracle.com/UPGRADE/entry/recent_news_about_pluggable_databases

The steps to perform are:
 a) unplug the PDB
 b) review the metadata file
 c) check for plug-in-compatibility (a formality in our case but important in real life)
 d) drop the PDB _keeping_ data files
 e) create the new PDB by plugging it in

All the while you are tailing the alert.log

- unplug the PDB

SQL> alter pluggable database pdb2 close immediate;

SQL> alter pluggable database pdb2 unplug into '/home/oracle/pdb2.xml';

-> keep tailing the alert.log!

- verify the contents of the XML file 

[oracle@server3 ~]$ cat /home/oracle/pdb2.xml
<?xml version="1.0" encoding="UTF-8"?>
<PDB>
  <xmlversion>1</xmlversion>
  <pdbname>PDB2</pdbname>
  <cid>5</cid>
  <byteorder>1</byteorder>
  <vsn>202375680</vsn>
  <vsns>
    <vsnnum>12.1.0.2.0</vsnnum>
    <cdbcompt>12.1.0.2.0</cdbcompt>
    <pdbcompt>12.1.0.2.0</pdbcompt>
    <vsnlibnum>0.0.0.0.22</vsnlibnum>
    <vsnsql>22</vsnsql>
    <vsnbsv>8.0.0.0.0</vsnbsv>
  </vsns>
  <dbid>1858507191</dbid>
  <ncdb2pdb>0</ncdb2pdb>
  <cdbid>628942599</cdbid>
  <guid>18135BAD243A6341E0530C64A8C0B88F</guid>
  <uscnbas>1675596</uscnbas>
  <uscnwrp>0</uscnwrp>
  <rdba>4194824</rdba>
  <tablespace>
    <name>SYSTEM</name>
    <type>0</type>
    <tsn>0</tsn>
    <status>1</status>
    <issft>0</issft>
    <file>
      <path>/u01/oradata/CDB2/18135BAD243A6341E0530C64A8C0B88F/datafile/o1_mf_system_bqfdbtg0_.dbf</path>
      <afn>17</afn>
      <rfn>1</rfn>
      <createscnbas>1674775</createscnbas>
      <createscnwrp>0</createscnwrp>
      <status>1</status>
      <fileblocks>32000</fileblocks>
      <blocksize>8192</blocksize>
      <vsn>202375680</vsn>
      <fdbid>1858507191</fdbid>
      <fcpsw>0</fcpsw>
      <fcpsb>1675592</fcpsb>
      <frlsw>0</frlsw>
      <frlsb>1594143</frlsb>
      <frlt>881895559</frlt>
    </file>
  </tablespace>
  <tablespace>
    <name>SYSAUX</name>
    <type>0</type>
    <tsn>1</tsn>
    <status>1</status>
    <issft>0</issft>
    <file>
      <path>/u01/oradata/CDB2/18135BAD243A6341E0530C64A8C0B88F/datafile/o1_mf_sysaux_bqfdbtg1_.dbf</path>
      <afn>18</afn>
      <rfn>4</rfn>
      <createscnbas>1674799</createscnbas>
      <createscnwrp>0</createscnwrp>
      <status>1</status>
      <fileblocks>65280</fileblocks>
      <blocksize>8192</blocksize>
      <vsn>202375680</vsn>
      <fdbid>1858507191</fdbid>
      <fcpsw>0</fcpsw>
      <fcpsb>1675592</fcpsb>
      <frlsw>0</frlsw>
      <frlsb>1594143</frlsb>
      <frlt>881895559</frlt>
    </file>
  </tablespace>
  <tablespace>
    <name>TEMP</name>
    <type>1</type>
    <tsn>2</tsn>
    <status>1</status>
    <issft>0</issft>
    <bmunitsize>128</bmunitsize>
    <file>
      <path>/u01/oradata/CDB2/18135BAD243A6341E0530C64A8C0B88F/datafile/o1_mf_temp_bqfdbtg1_.dbf</path>
      <afn>5</afn>
      <rfn>1</rfn>
      <createscnbas>1674776</createscnbas>
      <createscnwrp>0</createscnwrp>
      <status>0</status>
      <fileblocks>2560</fileblocks>
      <blocksize>8192</blocksize>
      <vsn>202375680</vsn>
      <autoext>1</autoext>
      <maxsize>4194302</maxsize>
      <incsize>80</incsize>
    </file>
  </tablespace>
  <tablespace>
    <name>USERS</name>
    <type>0</type>
    <tsn>3</tsn>
    <status>1</status>
    <issft>0</issft>
    <file>
      <path>/u01/oradata/CDB2/18135BAD243A6341E0530C64A8C0B88F/datafile/o1_mf_users_bqfdbtg1_.dbf</path>
      <afn>19</afn>
      <rfn>10</rfn>
      <createscnbas>1674802</createscnbas>
      <createscnwrp>0</createscnwrp>
      <status>1</status>
      <fileblocks>2560</fileblocks>
      <blocksize>8192</blocksize>
      <vsn>202375680</vsn>
      <fdbid>1858507191</fdbid>
      <fcpsw>0</fcpsw>
      <fcpsb>1675592</fcpsb>
      <frlsw>0</frlsw>
      <frlsb>1594143</frlsb>
      <frlt>881895559</frlt>
    </file>
  </tablespace>
  <optional>
    <ncdb2pdb>0</ncdb2pdb>
    <csid>178</csid>
    <ncsid>2000</ncsid>
    <options>
      <option>APS=12.1.0.2.0</option>
      <option>CATALOG=12.1.0.2.0</option>
      <option>CATJAVA=12.1.0.2.0</option>
      <option>CATPROC=12.1.0.2.0</option>
      <option>CONTEXT=12.1.0.2.0</option>
      <option>DV=12.1.0.2.0</option>
      <option>JAVAVM=12.1.0.2.0</option>
      <option>OLS=12.1.0.2.0</option>
      <option>ORDIM=12.1.0.2.0</option>
      <option>OWM=12.1.0.2.0</option>
      <option>SDO=12.1.0.2.0</option>
      <option>XDB=12.1.0.2.0</option>
      <option>XML=12.1.0.2.0</option>
      <option>XOQ=12.1.0.2.0</option>
    </options>
    <olsoid>0</olsoid>
    <dv>0</dv>
    <APEX>4.2.5.00.08:1</APEX>
    <parameters>
      <parameter>processes=300</parameter>
      <parameter>nls_language='ENGLISH'</parameter>
      <parameter>nls_territory='UNITED KINGDOM'</parameter>
      <parameter>sga_target=1073741824</parameter>
      <parameter>db_block_size=8192</parameter>
      <parameter>compatible='12.1.0.2.0'</parameter>
      <parameter>open_cursors=300</parameter>
      <parameter>pga_aggregate_target=536870912</parameter>
      <parameter>enable_pluggable_database=TRUE</parameter>
    </parameters>
    <tzvers>
      <tzver>primary version:18</tzver>
      <tzver>secondary version:0</tzver>
    </tzvers>
    <walletkey>0</walletkey>
    <opatches>
      <opatch>19769480</opatch>
      <opatch>20299022</opatch>
      <opatch>20299023</opatch>
      <opatch>20415564</opatch>
    </opatches>
    <hasclob>1</hasclob>
    <awr>
      <loadprofile>CPU Usage Per Sec=0.000000</loadprofile>
      <loadprofile>DB Block Changes Per Sec=0.000000</loadprofile>
      <loadprofile>Database Time Per Sec=0.000000</loadprofile>
      <loadprofile>Executions Per Sec=0.000000</loadprofile>
      <loadprofile>Hard Parse Count Per Sec=0.000000</loadprofile>
      <loadprofile>Logical Reads Per Sec=0.000000</loadprofile>
      <loadprofile>Logons Per Sec=0.000000</loadprofile>
      <loadprofile>Physical Reads Per Sec=0.000000</loadprofile>
      <loadprofile>Physical Writes Per Sec=0.000000</loadprofile>
      <loadprofile>Redo Generated Per Sec=0.000000</loadprofile>
      <loadprofile>Total Parse Count Per Sec=0.000000</loadprofile>
      <loadprofile>User Calls Per Sec=0.000000</loadprofile>
      <loadprofile>User Rollbacks Per Sec=0.000000</loadprofile>
      <loadprofile>User Transaction Per Sec=0.000000</loadprofile>
    </awr>
    <hardvsnchk>0</hardvsnchk>
  </optional>
</PDB>

- check for compatibility

SQL> drop pluggable database pdb2 keep datafiles;

DECLARE
  compatible CONSTANT VARCHAR2(3) :=
    CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
           pdb_descr_file => '/home/oracle/pdb2.xml',
           pdb_name       => 'PDB2')
    WHEN TRUE THEN 'YES'
    ELSE 'NO'
END;
BEGIN
  DBMS_OUTPUT.PUT_LINE(compatible);
END;
/

- If you get a YES then plug the PDB in 

SQL> create pluggable database pdb2 using '/home/oracle/pdb2.xml' nocopy tempfile reuse;

14) drop a PDB

You use the drop pluggable database command to drop the PDB.

SQL> alter pluggable database PDB2 close immediate;

SQL> drop pluggable database PDB2;

- what happens to its data files? Do you get an error? how do you correct the error?

LAB 5: RMAN and PDBs

1) Connect the the CDB$ROOT as RMAN and "report schema"

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name CDB2

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    780      SYSTEM               YES     /u01/oradata/CDB2/datafile/o1_mf_system_bqf3ktdf_.dbf
3    600      SYSAUX               NO      /u01/oradata/CDB2/datafile/o1_mf_sysaux_bqf3jpvv_.dbf
4    355      UNDOTBS1             YES     /u01/oradata/CDB2/datafile/o1_mf_undotbs1_bqf3lz4q_.dbf
5    250      PDB$SEED:SYSTEM      NO      /u01/oradata/CDB2/datafile/o1_mf_system_bqf3phmo_.dbf
6    5        USERS                NO      /u01/oradata/CDB2/datafile/o1_mf_users_bqf3lxrp_.dbf
7    490      PDB$SEED:SYSAUX      NO      /u01/oradata/CDB2/datafile/o1_mf_sysaux_bqf3ph5z_.dbf
8    250      MASTER:SYSTEM        NO      /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_system_bqf4tntv_.dbf
9    510      MASTER:SYSAUX        NO      /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_sysaux_bqf4tnv2_.dbf
10   20       MASTER:USERS         NO      /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_users_bqf4v3cm_.dbf
14   250      PDB1:SYSTEM          NO      /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_system_bqfd57b5_.dbf
15   510      PDB1:SYSAUX          NO      /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_sysaux_bqfd57b7_.dbf
16   20       PDB1:USERS           NO      /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfd57b8_.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    60       TEMP                 32767       /u01/oradata/CDB2/datafile/o1_mf_temp_bqf3p96h_.tmp
2    20       PDB$SEED:TEMP        32767       /u01/oradata/CDB2/datafile/pdbseed_temp012015-06-09_02-59-59-AM.dbf
3    20       MASTER:TEMP          32767       /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_temp_bqf4tnv3_.dbf
4    20       PDB1:TEMP            32767       /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_temp_bqfd57b8_.dbf

RMAN>

- what do you notice? How is the output different from the Non-CDB

2) Review the configuration settings

Have a look at the RMAN configuration settings. There is one item that is different from non-CDBs. Can you spot it?

RMAN> show all;

RMAN configuration parameters for database with db_unique_name CDB2 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0.2/dbhome_1/dbs/snapcf_CDB2.f'; # default


3) Back up the CDB

It is possible to backup up the CDB, CDB$ROOT, and PDBs. In this step you back up the entire CDB. Always good to have a full backup. If not yet in archivelog mode, change that and perform a full backup (incremental or full does not matter)

RMAN> shutdown immediate

startup mount
database closed
database dismounted
Oracle instance shut down

RMAN>
connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    1073741824 bytes

Fixed Size                     2932632 bytes
Variable Size                377487464 bytes
Database Buffers             687865856 bytes
Redo Buffers                   5455872 bytes

RMAN> alter database archivelog;

Statement processed

RMAN> alter database open;

Statement processed

RMAN> configure channel device type disk format '/u01/oraback/CDB2/%U';

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u01/oraback/CDB2/%U';
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

RMAN> backup database plus archivelog;


Starting backup at 09-JUN-15
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=27 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=18 RECID=1 STAMP=881907051
channel ORA_DISK_1: starting piece 1 at 09-JUN-15
channel ORA_DISK_1: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/01q91lbd_1_1 tag=TAG20150609T061052 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 09-JUN-15

Starting backup at 09-JUN-15
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/oradata/CDB2/datafile/o1_mf_system_bqf3ktdf_.dbf
input datafile file number=00004 name=/u01/oradata/CDB2/datafile/o1_mf_undotbs1_bqf3lz4q_.dbf
channel ORA_DISK_1: starting piece 1 at 09-JUN-15
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/oradata/CDB2/datafile/o1_mf_sysaux_bqf3jpvv_.dbf
input datafile file number=00006 name=/u01/oradata/CDB2/datafile/o1_mf_users_bqf3lxrp_.dbf
channel ORA_DISK_2: starting piece 1 at 09-JUN-15
channel ORA_DISK_1: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/02q91lbf_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_sysaux_bqf4tnv2_.dbf
channel ORA_DISK_1: starting piece 1 at 09-JUN-15
channel ORA_DISK_2: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/03q91lbf_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00015 name=/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_sysaux_bqfd57b7_.dbf
channel ORA_DISK_2: starting piece 1 at 09-JUN-15
channel ORA_DISK_1: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/04q91lc8_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/u01/oradata/CDB2/datafile/o1_mf_sysaux_bqf3ph5z_.dbf
channel ORA_DISK_1: starting piece 1 at 09-JUN-15
channel ORA_DISK_2: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/05q91lc9_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:10
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00008 name=/u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_system_bqf4tntv_.dbf
input datafile file number=00010 name=/u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_users_bqf4v3cm_.dbf
channel ORA_DISK_2: starting piece 1 at 09-JUN-15
channel ORA_DISK_1: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/06q91lcj_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00014 name=/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_system_bqfd57b5_.dbf
input datafile file number=00016 name=/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfd57b8_.dbf
channel ORA_DISK_1: starting piece 1 at 09-JUN-15
channel ORA_DISK_2: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/07q91lcj_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/oradata/CDB2/datafile/o1_mf_system_bqf3phmo_.dbf
channel ORA_DISK_2: starting piece 1 at 09-JUN-15
channel ORA_DISK_1: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/08q91lcr_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_2: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/09q91lcr_1_1 tag=TAG20150609T061054 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:07
Finished backup at 09-JUN-15

Starting backup at 09-JUN-15
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=19 RECID=2 STAMP=881907108
channel ORA_DISK_1: starting piece 1 at 09-JUN-15
channel ORA_DISK_1: finished piece 1 at 09-JUN-15
piece handle=/u01/oraback/CDB2/0aq91ld5_1_1 tag=TAG20150609T061148 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 09-JUN-15

Starting Control File and SPFILE Autobackup at 09-JUN-15
piece handle=/u01/fra/CDB2/autobackup/2015_06_09/o1_mf_s_881907110_bqfgzb3n_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 09-JUN-15

RMAN>


4) Try to cause some trouble and get out unscathed

Assume someone in PDB1 removed an essential file from the database. Time to recover! In this part of the lab you
 a) close PDB1 
 b) remove a data file
 c) perform a full recovery (agree it not strictly speaking needed but a good test)
 d) open the database without data loss 

SQL> set lines 200
SQL> select name from v$datafile where con_id = (select con_id from v$pdbs where name = 'PDB1');

NAME
---------------------------------------------------------------------------------------------------------------------------
/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_system_bqfd57b5_.dbf
/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_sysaux_bqfd57b7_.dbf
/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfd57b8_.dbf

[oracle@server3 ~]$ rm /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfd57b8_.dbf
[oracle@server3 ~]$

SQL> alter pluggable database pdb1 open;
alter pluggable database pdb1 open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 16 - see DBWR trace file
ORA-01110: data file 16:
'/u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfd57b8_.dbf'

- perform full recovery

[oracle@server3 ~]$ rman target sys/change_on_install@localhost/PDB1

Recovery Manager: Release 12.1.0.2.0 - Production on Tue Jun 9 06:48:03 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB2 (DBID=628942599, not open)

RMAN> run {
2> restore database;
3> recover database;
4> alter database open;
5> }

Starting restore at 09-JUN-15
        using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=255 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=269 device type=DISK

skipping datafile 14; already restored to file /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_system_bqfd57b5_.dbf
skipping datafile 15; already restored to file /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_sysaux_bqfd57b7_.dbf
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00016 to /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfd57b8_.dbf
channel ORA_DISK_1: reading from backup piece /u01/oraback/CDB2/08q91lcr_1_1
channel ORA_DISK_1: piece handle=/u01/oraback/CDB2/08q91lcr_1_1 tag=TAG20150609T061054
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 09-JUN-15

Starting recover at 09-JUN-15
using channel ORA_DISK_1
using channel ORA_DISK_2

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 09-JUN-15

Statement processed

RMAN>

- check if that worked

[oracle@server3 ~]$ sqlplus appl_user/appl_user@localhost/pdb1

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 9 06:50:32 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Tue Jun 09 2015 06:50:12 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select count(*) from t1;

  COUNT(*)
----------
     73704

SQL> select tablespace_name from tabs;

TABLESPACE_NAME
------------------------------
USERS
USERS
USERS

SQL>

5) Beware of PDB backups when dropping PDBs!

This is an example about what can be considered a bug, but is expected behaviour. Assume that you dropped a PDB accidentally including data files. How can you get it back? 

- create a PDB we don't really care about with a default tablespace named USERS

SQL> create pluggable database I_AM_AN_EX_PARROT admin user martin identified by secret default tablespace users datafile size 10m;

Pluggable database created.

SQL> alter pluggable database I_AM_AN_EX_PARROT open;

Pluggable database altered.

- create a level 0 backup of the CDB and make sure I_AM_AN_EX_PARRAT has been backed up. Validate both the PDB backup and the archivelogs.

RMAN> backup incremental level 0 database plus archivelog delete all input;

...

RMAN> list backup of pluggable database I_AM_AN_EX_PARROT;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
26      Incr 0  395.59M    DISK        00:00:02     11-JUN-15
        BP Key: 26   Status: AVAILABLE  Compressed: NO  Tag: TAG20150611T060056
        Piece Name: /u01/oraback/CDB2/0pq96tij_1_1
  List of Datafiles in backup set 26
  Container ID: 6, PDB Name: I_AM_AN_EX_PARROT
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  26   0  Incr 2345577    11-JUN-15 /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_sysaux_bqlowk9f_.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
29      Incr 0  203.38M    DISK        00:00:02     11-JUN-15
        BP Key: 29   Status: AVAILABLE  Compressed: NO  Tag: TAG20150611T060056
        Piece Name: /u01/oraback/CDB2/0tq96tjc_1_1
  List of Datafiles in backup set 29
  Container ID: 6, PDB Name: I_AM_AN_EX_PARROT
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  25   0  Incr 2345609    11-JUN-15 /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_system_bqlowk93_.dbf
  27   0  Incr 2345609    11-JUN-15 /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_users_bqloxjmr_.dbf

- the backup exists!

RMAN> restore pluggable database I_AM_AN_EX_PARROT validate;

Starting restore at 11-JUN-15
using channel ORA_DISK_1
using channel ORA_DISK_2

channel ORA_DISK_1: starting validation of datafile backup set
channel ORA_DISK_2: starting validation of datafile backup set
channel ORA_DISK_1: reading from backup piece /u01/oraback/CDB2/0pq96tij_1_1
channel ORA_DISK_2: reading from backup piece /u01/oraback/CDB2/0tq96tjc_1_1
channel ORA_DISK_1: piece handle=/u01/oraback/CDB2/0pq96tij_1_1 tag=TAG20150611T060056
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_2: piece handle=/u01/oraback/CDB2/0tq96tjc_1_1 tag=TAG20150611T060056
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: validation complete, elapsed time: 00:00:01
Finished restore at 11-JUN-15

RMAN> RESTORE ARCHIVELOG ALL VALIDATE;

Starting restore at 11-JUN-15
using channel ORA_DISK_1
using channel ORA_DISK_2

channel ORA_DISK_1: starting validation of archived log backup set
channel ORA_DISK_2: starting validation of archived log backup set
channel ORA_DISK_1: reading from backup piece /u01/oraback/CDB2/0gq96tfe_1_1
channel ORA_DISK_2: reading from backup piece /u01/oraback/CDB2/0hq96tff_1_1
channel ORA_DISK_1: piece handle=/u01/oraback/CDB2/0gq96tfe_1_1 tag=TAG20150611T060013
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archived log backup set
channel ORA_DISK_2: piece handle=/u01/oraback/CDB2/0hq96tff_1_1 tag=TAG20150611T060013
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: validation complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting validation of archived log backup set
channel ORA_DISK_1: reading from backup piece /u01/oraback/CDB2/0iq96tg9_1_1
channel ORA_DISK_2: reading from backup piece /u01/oraback/CDB2/0vq96tjp_1_1
channel ORA_DISK_1: piece handle=/u01/oraback/CDB2/0iq96tg9_1_1 tag=TAG20150611T060013
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_2: piece handle=/u01/oraback/CDB2/0vq96tjp_1_1 tag=TAG20150611T060233
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: validation complete, elapsed time: 00:00:01
Finished restore at 11-JUN-15

- drop the PDB including data files. We have a backup, should be ok even if we made a mistake. Tail the alert.log while executing the steps

RMAN> alter pluggable database I_AM_AN_EX_PARROT close;

Statement processed

RMAN> drop pluggable database I_AM_AN_EX_PARROT including datafiles;

Statement processed

2015-06-11 06:19:47.088000 -04:00
alter pluggable database I_AM_AN_EX_PARROT close
ALTER SYSTEM: Flushing buffer cache inst=0 container=6 local
2015-06-11 06:19:59.242000 -04:00
Pluggable database I_AM_AN_EX_PARROT closed
Completed: alter pluggable database I_AM_AN_EX_PARROT close
2015-06-11 06:20:15.885000 -04:00
drop pluggable database I_AM_AN_EX_PARROT including datafiles
2015-06-11 06:20:20.655000 -04:00
Deleted Oracle managed file /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_users_bqloxjmr_.dbf
Deleted Oracle managed file /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_temp_bqlowk9g_.dbf
Deleted Oracle managed file /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_sysaux_bqlowk9f_.dbf
Deleted Oracle managed file /u01/oradata/CDB2/183BC85FA4F548B1E0530C64A8C04B67/datafile/o1_mf_system_bqlowk93_.dbf
Completed: drop pluggable database I_AM_AN_EX_PARROT including datafiles

- oops, that was a mistake! Call from the users: restore the PDB, it is production critical!

RMAN> report schema;

Report of database schema for database with db_unique_name CDB2

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    780      SYSTEM               YES     /u01/oradata/CDB2/datafile/o1_mf_system_bqf3ktdf_.dbf
3    680      SYSAUX               NO      /u01/oradata/CDB2/datafile/o1_mf_sysaux_bqf3jpvv_.dbf
4    355      UNDOTBS1             YES     /u01/oradata/CDB2/datafile/o1_mf_undotbs1_bqf3lz4q_.dbf
5    250      PDB$SEED:SYSTEM      NO      /u01/oradata/CDB2/datafile/o1_mf_system_bqf3phmo_.dbf
6    5        USERS                NO      /u01/oradata/CDB2/datafile/o1_mf_users_bqf3lxrp_.dbf
7    490      PDB$SEED:SYSAUX      NO      /u01/oradata/CDB2/datafile/o1_mf_sysaux_bqf3ph5z_.dbf
8    250      MASTER:SYSTEM        NO      /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_system_bqf4tntv_.dbf
9    510      MASTER:SYSAUX        NO      /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_sysaux_bqf4tnv2_.dbf
10   20       MASTER:USERS         NO      /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_users_bqf4v3cm_.dbf
14   250      PDB1:SYSTEM          NO      /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_system_bqfd57b5_.dbf
15   520      PDB1:SYSAUX          NO      /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_sysaux_bqfd57b7_.dbf
16   20       PDB1:USERS           NO      /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_users_bqfk42sq_.dbf
23   260      PDBSBY:SYSTEM        NO      /u01/oradata/CDB2/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_system_bqfmtn2d_.dbf
24   520      PDBSBY:SYSAUX        NO      /u01/oradata/CDB2/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_sysaux_bqfmtn2l_.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    60       TEMP                 32767       /u01/oradata/CDB2/datafile/o1_mf_temp_bqf3p96h_.tmp
2    20       PDB$SEED:TEMP        32767       /u01/oradata/CDB2/datafile/pdbseed_temp012015-06-09_02-59-59-AM.dbf
3    20       MASTER:TEMP          32767       /u01/oradata/CDB2/18119189D3265B51E0530C64A8C0A3AE/datafile/o1_mf_temp_bqf4tnv3_.dbf
4    20       PDB1:TEMP            32767       /u01/oradata/CDB2/1813503BE37C62FEE0530C64A8C02F2C/datafile/o1_mf_temp_bqfd57b8_.dbf
5    20       PDBSBY:TEMP          32767       /u01/oradata/CDB2/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_temp_bqfmtn2l_.dbf

RMAN> run {
2> restore pluggable database I_AM_AN_EX_PARROT;
3> recover pluggable database I_AM_AN_EX_PARROT;
4> }

Starting restore at 11-JUN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=280 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=55 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/11/2015 06:22:07
RMAN-06813: could not translate pluggable database I_AM_AN_EX_PARROT

- Why? the backup was there a minute ago! Check the controlfile for the PDB backup:

RMAN> list backup of pluggable database I_AM_AN_EX_PARROT;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 06/11/2015 06:22:52
RMAN-06813: could not translate pluggable database I_AM_AN_EX_PARROT

- And indeed the backup is gone, as well as all the information with it.
}}}

! LAB X: Data Guard

{{{
Data Guard is an essential part of data protection. CDBs can be Data-Guarded as well. In this lab you will learn how to. It might be a bit more involved than previous labs and therefore we have most time here. The steps in the lab guide you through what needs to be done, the examples may have to be updated according to your environment.

1) create a physical standby of the CDB you used

- connect to the CDB as root and enable automatic standby_file_management 
- make sure that you use a SPFILE
- edit tnsnames.ora in $ORACLE_HOME to include the new standby database

CDBSBY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = class<n>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDBSBY)
    )
  )

- modify listener.ora in $ORACLE_HOME/network/admin/listener.ora and reload it. Ensure the names match your environment!

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = CDB2)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/dbhome_1)
      (SID_NAME = CDB2)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = CDB2_DGMGRL)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/dbhome_1)
      (SID_NAME = CDB2)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = CDBSBY)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/dbhome_1)
      (SID_NAME = CDBSBY)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = CDBSBY_DGMGRL)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/dbhome_1)
      (SID_NAME = CDBSBY)
    )
  )

- use lsnrctl service to ensure the services are registered

- update oratab with the new standby database

CDBSBY:/u01/app/oracle/product/12.1.0.2/dbhome_1:N

- create a minimum ppfile for the clone 

*.audit_file_dest='/u01/app/oracle/admin/CDBSBY/adump'
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.db_block_size=8192
*.db_create_file_dest='/u01/oradata'
*.db_domain=''
*.db_name='CDB2'
*.db_unique_name='CDBSBY'
*.db_recovery_file_dest='/u01/fra'
*.db_recovery_file_dest_size=4560m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBSBYXDB)'
*.enable_pluggable_database=true
*.nls_language='ENGLISH'
*.nls_territory='UNITED KINGDOM'
*.open_cursors=300
*.pga_aggregate_target=512m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1024m
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

- ensure the audit file dest is created

mkdir -vp /u01/app/oracle/admin/CDBSBY/adump

- copy the pwfile to allow remote login

[oracle@server3 dbs]$ cp orapwCDB2 orapwCDBSBY

- duplicate

[oracle@server3 ~]$  rman target sys/password@cdb2 auxiliary sys/password@cdbsby

RMAN> startup clone nomount

....

RMAN> duplicate target database for standby;

- Make sure to note down the control files. Their names are in the RMAN output

executing Memory Script

Starting restore at 09-JUN-15
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/fra/CDB2/autobackup/2015_06_09/o1_mf_s_881907110_bqfgzb3n_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/fra/CDB2/autobackup/2015_06_09/o1_mf_s_881907110_bqfgzb3n_.bkp tag=TAG20150609T061150
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/oradata/CDBSBY/controlfile/o1_mf_bqflhy0t_.ctl
output file name=/u01/fra/CDBSBY/controlfile/o1_mf_bqflhydr_.ctl
Finished restore at 09-JUN-15

- In this case they are:

output file name=/u01/oradata/CDBSBY/controlfile/o1_mf_bqflhy0t_.ctl
output file name=/u01/fra/CDBSBY/controlfile/o1_mf_bqflhydr_.ctl

- modify the pfile to include these. You can also use "show parameter control_files".

- create spfile from pfile and restart the standby

2) add the database into the broker configuration

- Enable the broker on primary and standby

SQL> alter system set dg_broker_start = true;

- add the databases to the broker configuration

[oracle@server3 ~]$ dgmgrl /
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

Copyright (c) 2000, 2013, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected as SYSDBA.

DGMGRL>  CREATE CONFIGURATION twelve as PRIMARY DATABASE IS 'CDB2' CONNECT IDENTIFIER IS 'CDB2';
Configuration "twelve" created with primary database "CDB2"

DGMGRL> add database 'CDBSBY' AS CONNECT IDENTIFIER IS 'CDBSBY';
Database "CDBSBY" added

- create standby redo logs on each database

Check their size in v$log, and create the files on each database. The following should work, you create group# + 1 SRLs per thread (there is only 1 in single instance Oracle)

SQL> begin
  2  for i in 1..4 loop
  3   execute immediate 'alter database add standby logfile size 52428800';
  4  end loop;
  5  end;
  6  /

- enable the configuration

DGMGRL> enable configuration
Enabled.

DGMGRL> show configuration

Configuration - twelve

  Protection Mode: MaxPerformance
  Members:
  CDB2   - Primary database
    CDBSBY - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 4 seconds ago)


3) create a new PDB on the primary, tail the alert.log to see what's happening on the standby

- be sure to have standby_file_management set to auto

DGMGRL> show database 'CDB2' standbyfilemanagement
  StandbyFileManagement = 'AUTO'
DGMGRL> show database 'CDBSBY' standbyfilemanagement
  StandbyFileManagement = 'AUTO'

SQL> select name, db_unique_name, database_role from v$database;

NAME      DB_UNIQUE_NAME                 DATABASE_ROLE
--------- ------------------------------ ----------------
CDB2      CDB2                           PRIMARY

SQL> create pluggable database PDBSBY admin user PDBSBY_ADMIN identified by secret;

- tail the primary alert.log

2015-06-09 07:34:43.265000 -04:00
create pluggable database PDBSBY admin user PDBSBY_ADMIN identified by *
 APEX_040200.WWV_FLOW_ADVISOR_CHECKS (CHECK_STATEMENT) - CLOB populated
2015-06-09 07:35:05.280000 -04:00
****************************************************************
Pluggable Database PDBSBY with pdb id - 5 is created as UNUSABLE.
If any errors are encountered before the pdb is marked as NEW,
then the pdb must be dropped
****************************************************************
Database Characterset for PDBSBY is WE8MSWIN1252
2015-06-09 07:35:06.834000 -04:00
Deleting old file#5 from file$
Deleting old file#7 from file$
Adding new file#23 to file$(old file#5)
Adding new file#24 to file$(old file#7)
2015-06-09 07:35:08.031000 -04:00
Successfully created internal service pdbsby at open
2015-06-09 07:35:12.391000 -04:00
ALTER SYSTEM: Flushing buffer cache inst=0 container=5 local
2015-06-09 07:35:20.225000 -04:00
****************************************************************
Post plug operations are now complete.
Pluggable database PDBSBY with pdb id - 5 is now marked as NEW.
****************************************************************
Completed: create pluggable database PDBSBY admin user PDBSBY_ADMIN identified by *

- tail the standby

2015-06-09 07:34:58.636000 -04:00
Recovery created pluggable database PDBSBY
2015-06-09 07:35:03.499000 -04:00
Recovery copied files for tablespace SYSTEM
Recovery successfully copied file /u01/oradata/CDBSBY/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_system_bqfmtn2d_.dbf from /u01/oradata/CDBSBY/datafile/o1_mf_system_bqflkyry_.dbf
2015-06-09 07:35:05.219000 -04:00
Successfully added datafile 23 to media recovery
Datafile #23: '/u01/oradata/CDBSBY/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_system_bqfmtn2d_.dbf'
2015-06-09 07:35:13.119000 -04:00
Recovery copied files for tablespace SYSAUX
Recovery successfully copied file /u01/oradata/CDBSBY/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_sysaux_bqfmtn2l_.dbf from /u01/oradata/CDBSBY/datafile/o1_mf_sysaux_bqflkpc2_.dbf
2015-06-09 07:35:17.968000 -04:00
Successfully added datafile 24 to media recovery
Datafile #24: '/u01/oradata/CDBSBY/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_sysaux_bqfmtn2l_.dbf'


4) switch over to CDBSBY

Using the broker connect to CDBSBY as sysdba. Then verify switchover readiness

[oracle@server3 ~]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

Copyright (c) 2000, 2013, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@cdbsby
Password:
Connected as SYSDBA.
DGMGRL> validate database 'CDBSBY';

  Database Role:     Physical standby database
  Primary Database:  CDB2

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Temporary Tablespace File Information:
    CDB2 TEMP Files:    5
    CDBSBY TEMP Files:  4

  Flashback Database Status:
    CDB2:    Off
    CDBSBY:  Off

  Current Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (CDB2)                  (CDBSBY)
    1         3                       3                       Insufficient SRLs

  Future Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (CDBSBY)                (CDB2)
    1         3                       0                       Insufficient SRLs
    Warning: standby redo logs not configured for thread 1 on CDB2

DGMGRL>

If you see "ready for switchover", do it:

DGMGRL> switchover to 'CDBSBY';
Performing switchover NOW, please wait...
New primary database "CDBSBY" is opening...
Oracle Clusterware is restarting database "CDB2" ...
Switchover succeeded, new primary is "CDBSBY"
DGMGRL>

4) check if you can access PDBSBY

SQL> select name,db_unique_name,database_role from v$database;

NAME      DB_UNIQUE_NAME                 DATABASE_ROLE
--------- ------------------------------ ----------------
CDB2      CDBSBY                         PRIMARY

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 MASTER                         READ WRITE NO
         4 PDB1                           READ WRITE NO
         5 PDBSBY                         READ WRITE NO

SQL> select name from v$datafile
  2  /

NAME
---------------------------------------------------------------------------------------------------------
/u01/oradata/CDBSBY/datafile/o1_mf_undotbs1_bqfljffy_.dbf
/u01/oradata/CDBSBY/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_system_bqfmtn2d_.dbf
/u01/oradata/CDBSBY/1815250A88E57497E0530C64A8C01A28/datafile/o1_mf_sysaux_bqfmtn2l_.dbf

SQL> select sys_context('userenv', 'con_name') from dual;

SYS_CONTEXT('USERENV','CON_NAME')
----------------------------------------------------------------------------------------------------------
PDBSBY


- keep the standby database! Will be needed for later on.
}}}

! LAB X: CDB Resource Manager

{{{
1) Create a CDB resource plan

Consolidation requires the creation of a CDB resource manager plan. Please ensure you have the following PDBs in your CDB:
- MASTER
- PDB1
- PDBSBY

Create a CDB plan for your CDB and set the distribution of CPU shares and utilisation limts as follows:
- MASTER: 1 share, limit 30
- PDB1: 5 shares, limit 100
- PDBSBY: 3 shares, limit 70

There is no need to limit PQ. To keep the lab simple, no PDB plans are needed.

Unfortunately due to a limited number of CPUs we cannot test the plans in action!

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 MASTER                         READ WRITE NO
         4 PDB1                           READ WRITE NO
         5 PDBSBY                         READ WRITE NO

- make sure you are in the ROOT

SQL> select sys_context('userenv','con_name') from dual;

declare
 v_plan_name varchar2(50) := 'ENKITEC_CDB_PLAN';
begin
 dbms_resource_manager.clear_pending_area;
 dbms_resource_manager.create_pending_area;

 dbms_resource_manager.create_cdb_plan(
  plan => v_plan_name,
  comment => 'A CDB plan for the 12c class'
 );

 dbms_resource_manager.create_cdb_plan_directive(
  plan => v_plan_name,
  pluggable_database => 'MASTER',
  shares => 1,
  utilization_limit => 30);

 dbms_resource_manager.create_cdb_plan_directive(
  plan => v_plan_name,
  pluggable_database => 'PDB1',
  shares => 5,
  utilization_limit => 100);

 dbms_resource_manager.create_cdb_plan_directive(
  plan => v_plan_name,
  pluggable_database => 'PDBSBY',
  shares => 3,
  utilization_limit => 70);

 dbms_resource_manager.validate_pending_area;
 dbms_resource_manager.submit_pending_area;
end;
/

2) Query the CDB Resource Plan dictionary information

COLUMN PLAN FORMAT A30
COLUMN STATUS FORMAT A10
COLUMN COMMENTS FORMAT A35
 
SELECT PLAN, STATUS, COMMENTS FROM DBA_CDB_RSRC_PLANS ORDER BY PLAN;

3) Query the CDB Plan directives in the dictionary

COLUMN PLAN HEADING 'Plan' FORMAT A26
COLUMN PLUGGABLE_DATABASE HEADING 'Pluggable|Database' FORMAT A25
COLUMN SHARES HEADING 'Shares' FORMAT 999
COLUMN UTILIZATION_LIMIT HEADING 'Utilization|Limit' FORMAT 999
COLUMN PARALLEL_SERVER_LIMIT HEADING 'Parallel|Server|Limit' FORMAT 999
 
SELECT PLAN, 
       PLUGGABLE_DATABASE, 
       SHARES, 
       UTILIZATION_LIMIT,
       PARALLEL_SERVER_LIMIT
  FROM DBA_CDB_RSRC_PLAN_DIRECTIVES
  ORDER BY PLAN;


4) Set the CDB resource plan

Set the new plan in the CDB$ROOT

SQL> alter system set RESOURCE_MANAGER_PLAN = 'ENKITEC_CDB_PLAN' scope=both;

System altered.

5) create a DBRM plan for MASTER PDB

Create a new database resource plan for 2 new consumer group, lowprio and highprio. The consumer group mappings are to be based on the oracle user. Do not forget to add the SYS_GROUP and OTHER_GROUP.

The various CPU entitlements are as follows:
- SYS_GROUP      - level 1 - 70
- HIGHPRIO_GROUP - level 1 - 100
- LOWPRIO_GROUP  - level 1 - 25
- OTHERS_GROUP   - level 1 - 45
- ORA$AUTOTASK   - level 1 - 15 

No other plan directives are needed. You can only have plans at level 1 in a PDB... Make sure you are connected against the PDB when executing the commands! Start by creating the users and grant them the connect role. Define the mapping based on the oracle user, and grant both the privilege to switch consumer groups. In the last step, create the plan and plan directives.

create user LOWPRIO identified by lowprio;
create user HIGHPRIO identified by highprio;

grant connect to LOWPRIO;
grant connect to HIGHPRIO;


begin
 dbms_resource_manager.clear_pending_area;
 dbms_resource_manager.create_pending_area;

 dbms_resource_manager.create_consumer_group('LOWPRIO_GROUP', 'for low priority processing');
 dbms_resource_manager.create_consumer_group('HIGHPRIO_GROUP', 'we will starve you');

 dbms_resource_manager.validate_pending_area();
 dbms_resource_manager.submit_pending_area();
end;
/

begin
 dbms_resource_manager.create_pending_area();
 dbms_resource_manager.set_consumer_group_mapping(
		dbms_resource_manager.oracle_user, 'LOWPRIO', 'LOWPRIO_GROUP');
 dbms_resource_manager.set_consumer_group_mapping(
		dbms_resource_manager.oracle_user, 'HIGHPRIO', 'HIGHPRIO_GROUP');
 dbms_resource_manager.submit_pending_area();
end;
/

begin
 dbms_resource_manager_privs.grant_switch_consumer_group('LOWPRIO','LOWPRIO_GROUP', true);
 dbms_resource_manager_privs.grant_switch_consumer_group('HIGHPRIO','HIGHPRIO_GROUP', true);
end;
/

BEGIN
 dbms_resource_manager.clear_pending_area();
 dbms_resource_manager.create_pending_area();
 
 dbms_resource_manager.create_plan(
 	plan => 'ENKITEC_MASTER_PDB_PLAN',
 	comment => 'sample DBRM plan for the training classes'
 );

 dbms_resource_manager.create_plan_directive(
  plan => 'ENKITEC_MASTER_PDB_PLAN',
  comment => 'sys_group is level 1',
  group_or_subplan => 'SYS_GROUP',
  mgmt_p1 => 50);

 dbms_resource_manager.create_plan_directive(
  plan => 'ENKITEC_MASTER_PDB_PLAN',
  group_or_subplan => 'HIGHPRIO_GROUP',
  comment => 'us before anyone else',
  mgmt_p1 => 30
 );

 -- artificially limit the resources
 dbms_resource_manager.create_plan_directive(
  plan => 'ENKITEC_MASTER_PDB_PLAN',
  group_or_subplan => 'LOWPRIO_GROUP',
  comment => 'then the LOWPRIO group',
  mgmt_p1 => 10
 );

 -- finally anyone not in a previous consumer group will be mapped to the
 -- OTHER_GROUPS
 dbms_resource_manager.create_plan_directive(
  plan => 'ENKITEC_MASTER_PDB_PLAN',
  group_or_subplan => 'OTHER_GROUPS',
  comment => 'all the rest',
  mgmt_p1 => 5
 );
 
 dbms_resource_manager.validate_pending_area();
 dbms_resource_manager.submit_pending_area();
end;
/

6) enable the PDB resource plan

alter system set resource_manager_plan = 'ENKITEC_MASTER_PDB_PLAN';

7) Verify the resource manager plans are correct in their respective container

SQL> select sys_context('userenv','con_name') from dual;

SYS_CONTEXT('USERENV','CON_NAME')
--------------------------------------------------------------------------------
CDB$ROOT

SQL> show parameter resource_manager_plan

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
resource_manager_plan                string      ENKITEC_CDB_PLAN
SQL>

SQL> alter session set container = master;

Session altered.

SQL> select sys_context('userenv','con_name') from dual;

SYS_CONTEXT('USERENV','CON_NAME')
--------------------------------------------------------------------------------
MASTER

SQL> show parameter resource_manager_plan

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
resource_manager_plan                string      ENKITEC_MASTER_PDB_PLAN
SQL>

8) connect as either highprio or lowprio to the PDB and check if the mapping works

[oracle@server3 ~]$ sqlplus highprio/highprio@localhost/master

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 10 05:58:55 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Wed Jun 10 2015 05:57:33 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


- in a different session

SQL> select con_id, resource_consumer_group from v$session where username = 'HIGHPRIO';

    CON_ID RESOURCE_CONSUMER_GROUP
---------- --------------------------------
         3 HIGHPRIO_GROUP
}}}

! LAB X: generic RMAN enhancements

{{{
In this lab you learn how to perform a table point in time recovery. 

1) create a table in a schema of your choice in the non-CDB and populate it with data

SQL> sho user
USER is "MARTIN"

SQL> create table recoverme tablespace users as select * from dba_objects;

Table created 

SQL> select table_name from tabs;

TABLE_NAME
--------------------------------------------------------------------------------
RECOVERME

2) get some information about the database, the most useful is the SCN. This is the SCN to recover to in the next steps, so take a note of it.

SQL> select db_unique_name, database_role, cdb, current_scn from v$database;

DB_UNIQUE_NAME                    DATABASE_ROLE CDB CURRENT_SCN
------------------------------ ---------------- --- -----------
NCDB                                    PRIMARY  NO     1766295

3) ensure there were rows in the table at this particular SCN

SQL> select count(*) from recoverme;

COUNT(*)
----------
91858

4) truncate the table to simulate something daft

SQL> truncate table recoverme;

table truncated.

5) try to salvage the table without having to revert to a restore

SQL> flashback table recoverme to scn 1766304;
flashback table recoverme to scn 1766304
*
ERROR at line 1:
ORA-08189: cannot flashback the table because row movement is not enabled


SQL> alter table recoverme enable row movement;

Table altered.

SQL> flashback table recoverme to scn 1766304;
flashback table recoverme to scn 1766304
*
ERROR at line 1:
ORA-01466: unable to read data - table definition has changed

6) After this proved unsuccessful perform a table point in time recovery

NB: which other recovery technique could you have tried in step 5?

RECOVER TABLE MARTIN.RECOVERME
UNTIL SCN 1766295
AUXILIARY DESTINATION '/u02/oradata/adata/oraback/NCDB/temp'
REMAP TABLE 'MARTIN'.'RECOVERME':'RECOVERME_RESTRD';
....
executing Memory Script

Oracle instance shut down

Performing import of tables...
IMPDP> Master table "SYS"."TSPITR_IMP_onvy_iEei" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_onvy_iEei":
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
IMPDP> . . imported "MARTIN"."RECOVERME_RESTRD" 10.01 MB 91858 rows
IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
IMPDP> Job "SYS"."TSPITR_IMP_onvy_iEei" successfully completed at Thu Jun 11 09:42:52 2015 elapsed 0 00:00:15
Import completed


Removing automatic instance
Automatic instance removed
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/NCDB/datafile/o1_mf_temp_bqlldwvd_.tmp deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/ONVY_PITR_NCDB/onlinelog/o1_mf_3_bqllgqf9_.log deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/ONVY_PITR_NCDB/onlinelog/o1_mf_2_bqllgq2t_.log deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/ONVY_PITR_NCDB/onlinelog/o1_mf_1_bqllgpq2_.log deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/ONVY_PITR_NCDB/datafile/o1_mf_users_bqllgnnh_.dbf deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/NCDB/datafile/o1_mf_sysaux_bqllddlj_.dbf deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/NCDB/datafile/o1_mf_undotbs1_bqllddln_.dbf deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/NCDB/datafile/o1_mf_system_bqllddlb_.dbf deleted
auxiliary instance file /u02/oradata/adata/oraback/NCDB/temp/NCDB/controlfile/o1_mf_bqlld6c7_.ctl deleted
auxiliary instance file tspitr_onvy_78692.dmp deleted
Finished recover at 11.06.2015 09:42:54

7) check if the table is imported ok and has the rows needed.

SQL> conn martin/secret
Connected.
SQL> select table_name from tabs;

TABLE_NAME
--------------------------------------------------------------------------------
RECOVERME
RECOVERME_RESTRD

SQL> select count(*) from RECOVERME_RESTRD;

COUNT(*)
----------
91858

SQL> select count(*) from RECOVERME;

COUNT(*)
----------
0
}}}

! Lab X: Threaded Execution

{{{
In the final lab you will experiment with the changes introduced with threaded execution

1) Verify your current settings

Start your NCDB if it is not open. Have a look at all the OS process IDs. How many are started?

[oracle@server3 ~]$ ps -ef | grep NCDB
oracle   19728 19658  0 06:27 pts/0    00:00:00 screen -S NCDB
oracle   19729 19728  0 06:27 ?        00:00:00 SCREEN -S NCDB
oracle   19963     1  0 06:28 ?        00:00:00 ora_pmon_NCDB
oracle   19965     1  0 06:28 ?        00:00:00 ora_psp0_NCDB
oracle   19967     1  2 06:28 ?        00:00:11 ora_vktm_NCDB
oracle   19971     1  0 06:28 ?        00:00:00 ora_gen0_NCDB
oracle   19973     1  0 06:28 ?        00:00:00 ora_mman_NCDB
oracle   19977     1  0 06:28 ?        00:00:00 ora_diag_NCDB
oracle   19979     1  0 06:28 ?        00:00:00 ora_dbrm_NCDB
oracle   19981     1  0 06:28 ?        00:00:00 ora_vkrm_NCDB
oracle   19983     1  0 06:28 ?        00:00:00 ora_dia0_NCDB
oracle   19985     1  0 06:28 ?        00:00:02 ora_dbw0_NCDB
oracle   19987     1  0 06:28 ?        00:00:03 ora_lgwr_NCDB
oracle   19989     1  0 06:28 ?        00:00:00 ora_ckpt_NCDB
oracle   19991     1  0 06:28 ?        00:00:00 ora_lg00_NCDB
oracle   19993     1  0 06:28 ?        00:00:00 ora_smon_NCDB
oracle   19995     1  0 06:28 ?        00:00:00 ora_lg01_NCDB
oracle   19997     1  0 06:28 ?        00:00:00 ora_reco_NCDB
oracle   19999     1  0 06:28 ?        00:00:00 ora_lreg_NCDB
oracle   20001     1  0 06:28 ?        00:00:00 ora_pxmn_NCDB
oracle   20003     1  0 06:28 ?        00:00:00 ora_rbal_NCDB
oracle   20005     1  0 06:28 ?        00:00:00 ora_asmb_NCDB
oracle   20007     1  0 06:28 ?        00:00:01 ora_mmon_NCDB
oracle   20009     1  0 06:28 ?        00:00:00 ora_mmnl_NCDB
oracle   20013     1  0 06:28 ?        00:00:00 ora_mark_NCDB
oracle   20015     1  0 06:28 ?        00:00:00 ora_d000_NCDB
oracle   20017     1  0 06:28 ?        00:00:00 ora_s000_NCDB
oracle   20021     1  0 06:28 ?        00:00:00 ora_dmon_NCDB
oracle   20033     1  0 06:28 ?        00:00:00 ora_o000_NCDB
oracle   20039     1  0 06:28 ?        00:00:00 ora_o001_NCDB
oracle   20043     1  0 06:28 ?        00:00:00 ora_rvwr_NCDB
oracle   20045     1  0 06:28 ?        00:00:00 ora_insv_NCDB
oracle   20047     1  0 06:28 ?        00:00:00 ora_nsv1_NCDB
oracle   20049     1  0 06:28 ?        00:00:00 ora_fsfp_NCDB
oracle   20054     1  0 06:28 ?        00:00:00 ora_rsm0_NCDB
oracle   20056     1  0 06:29 ?        00:00:00 ora_tmon_NCDB
oracle   20058     1  0 06:29 ?        00:00:00 ora_arc0_NCDB
oracle   20060     1  0 06:29 ?        00:00:00 ora_arc1_NCDB
oracle   20062     1  0 06:29 ?        00:00:00 ora_arc2_NCDB
oracle   20064     1  0 06:29 ?        00:00:00 ora_arc3_NCDB
oracle   20066     1  0 06:29 ?        00:00:00 ora_o002_NCDB
oracle   20068     1  0 06:29 ?        00:00:00 ora_o003_NCDB
oracle   20074     1  0 06:29 ?        00:00:00 ora_o004_NCDB
oracle   20078     1  0 06:29 ?        00:00:00 ora_tt00_NCDB
oracle   20080     1  0 06:29 ?        00:00:00 ora_tt01_NCDB
oracle   20091     1  0 06:29 ?        00:00:00 ora_p000_NCDB
oracle   20093     1  0 06:29 ?        00:00:00 ora_p001_NCDB
oracle   20095     1  0 06:29 ?        00:00:00 ora_p002_NCDB
oracle   20097     1  0 06:29 ?        00:00:00 ora_p003_NCDB
oracle   20099     1  0 06:29 ?        00:00:00 ora_smco_NCDB
oracle   20101     1  0 06:29 ?        00:00:00 ora_w000_NCDB
oracle   20103     1  0 06:29 ?        00:00:00 ora_w001_NCDB
oracle   20107     1  0 06:29 ?        00:00:00 ora_aqpc_NCDB
oracle   20111     1  0 06:29 ?        00:00:00 ora_p004_NCDB
oracle   20113     1  0 06:29 ?        00:00:00 ora_p005_NCDB
oracle   20115     1  0 06:29 ?        00:00:00 ora_p006_NCDB
oracle   20117     1  0 06:29 ?        00:00:00 ora_p007_NCDB
oracle   20119     1  0 06:29 ?        00:00:00 ora_cjq0_NCDB
oracle   20121     1  0 06:29 ?        00:00:00 ora_qm02_NCDB
oracle   20125     1  0 06:29 ?        00:00:00 ora_q002_NCDB
oracle   20127     1  0 06:29 ?        00:00:00 ora_q003_NCDB
oracle   20131     1  0 06:29 ?        00:00:00 oracleNCDB (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   20305     1  1 06:30 ?        00:00:03 ora_m005_NCDB
oracle   20412     1  0 06:33 ?        00:00:00 ora_m004_NCDB
oracle   20481     1  0 06:34 ?        00:00:00 ora_j000_NCDB
oracle   20483     1  0 06:34 ?        00:00:00 ora_j001_NCDB
oracle   20508 20415  0 06:36 pts/15   00:00:00 grep --color=auto NCDB

[oracle@server3 ~]$ ps -ef | grep NCDB | grep -v grep | wc -l
66

- keep that number in mind

2) switch to threaded_execution

Connect as sysdba check if it is using threaded execution. If not, enable threaded execution and bounce the instance for the parameter to take effect. What do you notice when the database restarts?

SQL> show parameter threaded_

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
threaded_execution                   boolean     FALSE
SQL> alter system set threaded_execution=true scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ERROR:
ORA-01017: invalid username/password; logon denied


ORA-01017: invalid username/password; logon denied
SQL>

3) how can you start the database?

SQL> conn sys/change_on_install as sysdba
Connected.

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL>

3) check the OS processes now-how many are there?

[oracle@server3 ~]$ ps -ef | grep NCDB | egrep -vi "grep|screen" | nl
     1  oracle   20858     1  0 06:40 ?        00:00:00 ora_pmon_NCDB
     2  oracle   20860     1  0 06:40 ?        00:00:00 ora_psp0_NCDB
     3  oracle   20862     1  2 06:40 ?        00:00:05 ora_vktm_NCDB
     4  oracle   20866     1  0 06:40 ?        00:00:01 ora_u004_NCDB
     5  oracle   20872     1  6 06:40 ?        00:00:15 ora_u005_NCDB
     6  oracle   20879     1  0 06:40 ?        00:00:00 ora_dbw0_NCDB
     7  oracle   20959     1  0 06:42 ?        00:00:00 oracleNCDB (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
[oracle@server3 ~]$

4) Can you think of a reason why there are so few? Can you make the others appear? Clue: check man ps

[oracle@server3 ~]$ ps -eLf | grep NCDB | egrep -vi "grep|screen" | grep -v grep
oracle   20858     1 20858  0    1 06:40 ?        00:00:00 ora_pmon_NCDB
oracle   20860     1 20860  0    1 06:40 ?        00:00:00 ora_psp0_NCDB
oracle   20862     1 20862  2    1 06:40 ?        00:00:06 ora_vktm_NCDB
oracle   20866     1 20866  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20867  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20868  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20869  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20875  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20880  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20881  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20882  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20883  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20884  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20886  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20888  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20889  0   14 06:40 ?        00:00:00 ora_u004_NCDB
oracle   20866     1 20928  0   14 06:41 ?        00:00:00 ora_u004_NCDB
oracle   20872     1 20872  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20873  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20874  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20876  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20877  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20885  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20887  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20890  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20891  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20892  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20893  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20896  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20897  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20898  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20900  0   45 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20922  0   45 06:41 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20925  0   45 06:41 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20932  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20934  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20935  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20936  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20937  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20938  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20939  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20940  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20941  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20942  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20943  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20944  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20945  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20947  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20948  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20949  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20950  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20951  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20952  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20953  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20954  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20955  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21088  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21089  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21091  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21092  0   45 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21138  0   45 06:44 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21139  0   45 06:44 ?        00:00:00 ora_u005_NCDB
oracle   20879     1 20879  0    1 06:40 ?        00:00:00 ora_dbw0_NCDB
oracle   20959     1 20959  0    1 06:42 ?        00:00:00 oracleNCDB (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

5) create a session using net*8 - is the session a process or a thread?

[oracle@server3 ~]$ sqlplus martin/secret@ncdb

SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 11 06:45:57 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Thu Apr 23 2015 04:11:21 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
            15


- in another session

SQL> select pid,sosid,spid,stid,execution_type from v$process where addr = (select paddr from v$session where sid = 15);

       PID SOSID                    SPID                     STID                     EXECUTION_
---------- ------------------------ ------------------------ ------------------------ ----------
        30 21178                    21178                    21178                    PROCESS

- this appears to be a process. Confirm on the OS-level:

[oracle@server3 ~]$ ps -eLf | grep 21178 | grep -v grep
oracle   21178     1 21178  0    1 06:45 ?        00:00:00 oracleNCDB (LOCAL=NO)

6) Now enable new sessions to be created as threads. In order to do so you need to change the listener and add DEDICATED_THROUGH_BROKER_listener = ON. Then reload the listener

7) connect again

[oracle@server3 ~]$ sqlplus martin/secret@ncdb

SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 11 06:56:38 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Thu Jun 11 2015 06:45:58 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
            31


- verify if it's a process or a thread

SQL> select pid,sosid,spid,stid,execution_type from v$process where addr = (select paddr from v$session where sid = 31);

       PID SOSID                    SPID                     STID                     EXECUTION_
---------- ------------------------ ------------------------ ------------------------ ----------
        30 20872_21481              20872                    21481                    THREAD

- it is. Can you see this on the OS too?

[oracle@server3 ~]$ ps -eLf | egrep 21481
oracle   20872     1 21481  0   46 06:56 ?        00:00:00 ora_u005_NCDB

- Note that this is the STID. The SPID is the thread ID

[oracle@server3 ~]$ ps -eLf | egrep 20872
oracle   20872     1 20872  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20873  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20874  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20876  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20877  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20885  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20887  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20890  0   49 06:40 ?        00:00:01 ora_u005_NCDB
oracle   20872     1 20891  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20892  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20893  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20896  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20898  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20900  0   49 06:40 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20922  0   49 06:41 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20925  0   49 06:41 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20932  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20934  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20935  0   49 06:42 ?        00:00:01 ora_u005_NCDB
oracle   20872     1 20936  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20937  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20938  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20939  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20940  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20941  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20942  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20943  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20944  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20945  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20947  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20948  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20949  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20950  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20951  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20952  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20953  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20954  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 20955  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21088  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21089  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21091  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21092  0   49 06:42 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21481  0   49 06:56 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21494  0   49 06:57 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21499  0   49 06:57 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21500  0   49 06:57 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21521  0   49 06:59 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21522  0   49 06:59 ?        00:00:00 ora_u005_NCDB
oracle   20872     1 21536  0   49 07:00 ?        00:00:00 ora_u005_NCDB

8) kill the user session with SID 31 ON THE OS LEVEL. Do not use alter system disconnect session!

[oracle@server3 ~]$ ps -eLf | egrep 21481
oracle   20872     1 21481  0   48 06:56 ?        00:00:00 ora_u005_NCDB
oracle   21578 21236 21578  0    1 07:01 pts/16   00:00:00 grep -E --color=auto 21481
[oracle@server3 ~]$ kill -9 21481
[oracle@server3 ~]$

- what do you see? Remember never to do this in production!


}}}


! end
! instrumentation for the before and after change
vi memcount.sh
{{{
echo "##### count the threads"
ps -eLf | grep $ORACLE_SID | wc -l
echo "##### count the processes"
ps -ef | grep $ORACLE_SID | wc -l
echo "##### CPU%, MEM%, VSZ, RSS for all users"
ps -A -o pcpu,pmem,vsz,rss | awk '{cpu += $1; mem += $2; vsz += $3; rss += $4} END {print cpu, mem, vsz/1024, rss/1024}'
echo "##### CPU%, MEM%, VSZ, RSS for oracle user"
ps -u $USER -o pcpu,pmem,vsz,rss | awk '{cpu += $1; mem += $2; vsz += $3; rss += $4} END {print cpu, mem, vsz/1024, rss/1024}'
echo "##### system memory"
free -m
echo "##### this sums the %MEM for all users"
ps aux | awk 'NR != 1 {x[$1] += $4} END{ for(z in x) {print z, x[z]"%"}}'
echo "##### this greps the current ORACLE_SID (excluding others) and sums the %MEM"
ps aux | grep $ORACLE_SID | awk 'NR != 1 {x[$1] += $4} END{ for(z in x) {print z, x[z]"%"}}'
}}}

! enable / disable
-- enable
alter system set threaded_execution=true scope=spfile sid='*';
srvctl stop database -d noncdb
srvctl start database -d noncdb
sqlplus sys/oracle@enkx4db01.enkitec.com/noncdb.enkitec.com as sysdba

-- disable
alter system set threaded_execution=false scope=spfile sid='*';
srvctl stop database -d noncdb
srvctl start database -d noncdb
sqlplus sys/oracle@enkx4db01.enkitec.com/noncdb.enkitec.com as sysdba


show parameter threaded

select sys_context('userenv','sid') from dual;
set lines 300
select s.username, s.sid, s.serial#, s.con_id, p.spid, p.sosid, p.stid, p.execution_type
from v$session s, v$process p
where s.sid = 270
and s.paddr = p.addr
/

select count(spid),spid,execution_type from v$process where background = 1 group by spid, execution_type;

select pname, pid, sosid, spid, stid, execution_type
from v$process where background = 1
order by pname
/

select pname, pid, sosid, spid, stid, execution_type
from v$process 
order by pname
/

ps -ef | grep noncdb
ps -eLf | grep noncdb


! before and after effect

-- BEFORE
{{{
$ sh memcount.sh
##### count the threads
49
##### count the processes
49
##### CPU%, MEM%, VSZ, RSS for all users
42.3 159.7 81873.2 1686.75
##### CPU%, MEM%, VSZ, RSS for oracle user
41 154.1 62122.9 1586.95
##### system memory
             total       used       free     shared    buffers     cached
Mem:           994        978         15          0          1        592
-/+ buffers/cache:        385        609
Swap:         1227        591        636
##### this sums the %MEM for all users
gdm 1.1%
oracle 153.9%
rpc 0%
dbus 0.1%
68 0.1%
rtkit 0%
postfix 0.1%
rpcuser 0%
root 4.2%
##### this greps the current ORACLE_SID (excluding others) and sums the %MEM
oracle 142.3%
}}}


-- AFTER
{{{
$ sh memcount.sh
##### count the threads
55
##### count the processes
7
##### CPU%, MEM%, VSZ, RSS for all users
58.3 92.9 56845.8 1005.93
##### CPU%, MEM%, VSZ, RSS for oracle user
57.1 87.3 37095.5 906.363
##### system memory
             total       used       free     shared    buffers     cached
Mem:           994        965         28          0          1        628
-/+ buffers/cache:        336        658
Swap:         1227        591        636
##### this sums the %MEM for all users
gdm 1.1%
oracle 87.4%
rpc 0%
dbus 0.1%
68 0.1%
rtkit 0%
postfix 0.1%
rpcuser 0%
root 4.2%
##### this greps the current ORACLE_SID (excluding others) and sums the %MEM
oracle 75.7%
}}}


! initial conclusions
* all in all the count of processes dropped from @@49 to 7@@, but what does this mean in terms of resource savings? 
I say this mostly affects the memory
** VSZ (virtual memory size) dropped from 62122.9 MB to 37095.5 MB for the oracle user which is a 40% decrease
** RSS (resident set size) dropped from 1586.95 MB to 906.363 MB for the oracle user which is a 42% decrease
** %MEM (ratio of the processes resident set size  to the physical memory on the machine)  dropped from 142.3% to 75.7% which is 46% decrease

So when you consolidate, the savings gained from changing to threaded_execution will be more physical memory headroom for more instances 
and even more when switched to PDB (multi-tenant) architecture

For CPU, there's really no effect. I say, the CPU workload requirements of an app will be the same and it's only going to decrease if you 1) tune 2) move to a faster CPU. 
See the slide 27-30 of this OOW presentation by Arup http://www.oracle.com/technetwork/oem/app-quality-mgmt/con8788-2088738.pdf  

! updates to the initial conclusions 

Had a talk with Frits on the memory part of 12c threaded_execution.. 

I did a research on the performance and here's the result https://twitter.com/karlarao/status/582053491079843840
For the memory here's the before and after  https://twitter.com/karlarao/status/581367258804396032 

On the side of performance, non-threaded_execution is faster. I'm definitive about that. 
For the memory gains, yes some of the sessions could still end up eating the same (SGA+PGA) memory but there are still some memory gains with some background processes although there are some inconsistencies 
* on the VM test that I did it showed ~40 decrease in RSS memory 
* but on the Exadata test it actually increased in RSS memory (from ~27258.4MB to ~42487.8MB). 

All in all, I don't like threaded_execution in terms of performance. For memory, that needs a little bit more investigation because I'm seeing different results on VM and non-VM environments. 















also check this tiddler [[12c New Features]]



Interesting observation about 15sec Top Activity graph
http://oracleprof.blogspot.com/2010/07/oem-performance-tab-and-active-session.html
http://www.evernote.com/shard/s48/sh/1a9c1779-94ec-4e5a-a26f-ba92ea08988e/3bb10603e76f4fb346d7df4328882dcd

Also check out this thread at oracle-l for options on 10GbE on V2 http://www.freelists.org/post/oracle-l/Exadata-V2-Compute-Node-10GigE-PCI-card-installation







{{{
create table parallel_t1(c1 int, c2 char(100));

insert into parallel_t1
select level, 'x'
from dual
connect by level <= 8000
;

commit;


alter system set db_file_multiblock_read_count=128;
*._db_block_prefetch_limit=0
*._db_block_prefetch_quota=0
*._db_file_noncontig_mblock_read_count=0

alter system flush buffer_cache;


-- generate one parallel query
select count(*) from parallel_t1;


16:28:36 SYS@orcl> shutdown abort
ORACLE instance shut down.
16:29:21 SYS@orcl> startup pfile='/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/initorcl.ora'
ORACLE instance started.

Total System Global Area  456146944 bytes
Fixed Size                  1344840 bytes
Variable Size             348129976 bytes
Database Buffers          100663296 bytes
Redo Buffers                6008832 bytes
Database mounted.
Database opened.
16:29:33 SYS@orcl> alter system flush buffer_cache;

System altered.

16:29:38 SYS@orcl> show parameter db_file_multi

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_multiblock_read_count        integer     128
16:29:47 SYS@orcl>
16:29:47 SYS@orcl> set lines 300
16:29:51 SYS@orcl> col "Parameter" FOR a40
16:29:51 SYS@orcl> col "Session Value" FOR a20
16:29:51 SYS@orcl> col "Instance Value" FOR a20
16:29:51 SYS@orcl> col "Description" FOR a50
16:29:51 SYS@orcl> SELECT a.ksppinm "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value", a.ksppdesc "Description"
16:29:51   2  FROM x$ksppi a, x$ksppcv b, x$ksppsv c
16:29:51   3  WHERE a.indx = b.indx AND a.indx = c.indx
16:29:51   4  AND substr(ksppinm,1,1)='_'
16:29:51   5  AND a.ksppinm like '%&parameter%'
16:29:51   6  /
Enter value for parameter: read_count

Parameter                                Session Value        Instance Value       Description
---------------------------------------- -------------------- -------------------- --------------------------------------------------
_db_file_exec_read_count                 128                  128                  multiblock read count for regular clients
_db_file_optimizer_read_count            128                  128                  multiblock read count for regular clients
_db_file_noncontig_mblock_read_count     0                    0                    number of noncontiguous db blocks to be prefetched
_sort_multiblock_read_count              2                    2                    multi-block read count for sort

16:29:54 SYS@orcl>
16:29:54 SYS@orcl> @mystat

628 rows created.


SNAP_DATE_END
-------------------
2014-09-08 16:29:57


SNAP_DATE_BEGIN
-------------------



no rows selected


no rows selected


0 rows deleted.

16:29:57 SYS@orcl> select count(*) from parallel_t1;

  COUNT(*)
----------
      8000

16:30:03 SYS@orcl> @mystat

628 rows created.


SNAP_DATE_END
-------------------
2014-09-08 16:30:05


SNAP_DATE_BEGIN
-------------------
2014-09-08 16:29:57


      Difference Statistics Name
---------------- --------------------------------------------------------------
               2 CPU used by this session
               4 CPU used when call started
               3 DB time
             628 HSC Heap Segment Block Changes
              10 SQL*Net roundtrips to/from client
              80 buffer is not pinned count
           3,225 bytes received via SQL*Net from client
           2,308 bytes sent via SQL*Net to client
              15 calls to get snapshot scn: kcmgss
               1 calls to kcmgas
              32 calls to kcmgcs
       1,097,728 cell physical IO interconnect bytes
               4 cluster key scan block gets
               4 cluster key scans
             672 consistent changes
             250 consistent gets
              12 consistent gets - examination
             250 consistent gets from cache
             211 consistent gets from cache (fastpath)
               1 cursor authentications
           1,307 db block changes
             703 db block gets
             703 db block gets from cache
              10 db block gets from cache (fastpath)
              18 enqueue releases
              19 enqueue requests
              14 execute count
             530 file io wait time
             149 free buffer requested
               5 index fetch by key
               2 index scans kdiixs1
             218 no work - consistent read gets
              42 non-idle wait count
              19 opened cursors cumulative
               5 parse count (failures)
              12 parse count (hard)
              19 parse count (total)
               1 parse time elapsed
              32 physical read IO requests
       1,097,728 physical read bytes
              32 physical read total IO requests
       1,097,728 physical read total bytes
             134 physical reads
             134 physical reads cache
             102 physical reads cache prefetch
              56 recursive calls
             629 redo entries
          88,372 redo size
             953 session logical reads
               3 shared hash latch upgrades - no wait
               3 sorts (memory)
               2 sorts (rows)
               5 sql area purged
               1 table fetch by rowid
             211 table scan blocks gotten
          13,560 table scan rows gotten
               4 table scans (short tables)
          42,700 undo change vector size
              17 user calls
               3 workarea executions - optimal
               4 workarea memory allocated

61 rows selected.


SNAP_DATE_BEGIN     SNAP_DATE_END
------------------- -------------------
2014-09-08 16:29:57 2014-09-08 16:30:05


1256 rows deleted.

16:30:05 SYS@orcl> set lines 300
16:30:38 SYS@orcl> col "Parameter" FOR a40
16:30:38 SYS@orcl> col "Session Value" FOR a20
16:30:38 SYS@orcl> col "Instance Value" FOR a20
16:30:38 SYS@orcl> col "Description" FOR a50
16:30:38 SYS@orcl> SELECT a.ksppinm "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value", a.ksppdesc "Description"
16:30:38   2  FROM x$ksppi a, x$ksppcv b, x$ksppsv c
16:30:38   3  WHERE a.indx = b.indx AND a.indx = c.indx
16:30:38   4  AND substr(ksppinm,1,1)='_'
16:30:38   5  AND a.ksppinm like '%&parameter%'
16:30:38   6  /
Enter value for parameter: prefetch

Parameter                                Session Value        Instance Value       Description
---------------------------------------- -------------------- -------------------- --------------------------------------------------
_db_block_prefetch_quota                 0                    0                    Prefetch quota as a percent of cache size
_db_block_prefetch_limit                 0                    0                    Prefetch limit in blocks


}}}
{{{

-- CREATE THE JOB 
-- 1min interval --   repeat_interval => 'FREQ=MINUTELY;BYSECOND=0',
-- 2mins interval -- repeat_interval => 'FREQ=MINUTELY;INTERVAL=2;BYSECOND=0',
-- 10secs interval -- repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',

BEGIN
    SYS.DBMS_SCHEDULER.CREATE_JOB (
            job_name => '"SYSTEM"."AWR_1MIN_SNAP"',
            job_type => 'PLSQL_BLOCK',
            job_action => 'BEGIN
dbms_workload_repository.create_snapshot;
END;',
            number_of_arguments => 0,
            start_date => SYSTIMESTAMP,
            repeat_interval => 'FREQ=MINUTELY;BYSECOND=0',
            end_date => NULL,
            job_class => '"SYS"."DEFAULT_JOB_CLASS"',
            enabled => FALSE,
            auto_drop => FALSE,
            comments => 'AWR_1MIN_SNAP',
            credential_name => NULL,
            destination_name => NULL);

    SYS.DBMS_SCHEDULER.SET_ATTRIBUTE( 
             name => '"SYSTEM"."AWR_1MIN_SNAP"', 
             attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);
          
    SYS.DBMS_SCHEDULER.enable(
             name => '"SYSTEM"."AWR_1MIN_SNAP"');

END; 
/


-- RUN JOB
BEGIN
	SYS.DBMS_SCHEDULER.run_job('"SYSTEM"."AWR_1MIN_SNAP"');
END;
/


-- DROP JOB
BEGIN
    SYS.DBMS_SCHEDULER.DROP_JOB(job_name => '"SYSTEM"."AWR_1MIN_SNAP"',
                                defer => false,
                                force => true);
END;
/


-- DISABLE JOB
BEGIN
    SYS.DBMS_SCHEDULER.disable(
             name => '"SYSTEM"."AWR_1MIN_SNAP"');
END;
/   


-- MONITOR JOB
SELECT * FROM DBA_SCHEDULER_JOB_LOG WHERE job_name = 'AWR_1MIN_SNAP';

col JOB_NAME format a15
col START_DATE format a25
col LAST_START_DATE format a25
col NEXT_RUN_DATE format a25
SELECT job_name, enabled, start_date, last_start_date, next_run_date FROM DBA_SCHEDULER_JOBS WHERE job_name = 'AWR_1MIN_SNAP';

-- AWR get recent snapshot
select * from 
(SELECT s0.instance_number, s0.snap_id, s0.startup_time,
  TO_CHAR(s0.END_INTERVAL_TIME,'YYYY-Mon-DD HH24:MI:SS') snap_start,
  TO_CHAR(s1.END_INTERVAL_TIME,'YYYY-Mon-DD HH24:MI:SS') snap_end,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) ela_min
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1
WHERE s1.snap_id           = s0.snap_id + 1
ORDER BY snap_id DESC)
where rownum < 11;

}}}
{{{
oracle@localhost.localdomain:/u01/oracle:orcl
$ s1

SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 16 00:53:22 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

00:53:23 SYS@orcl>  select name, cdb, con_id from v$database;

NAME      CDB     CON_ID
--------- --- ----------
ORCL      YES          0

00:53:23 SYS@orcl> select INSTANCE_NAME, STATUS, CON_ID from v$instance;

INSTANCE_NAME    STATUS           CON_ID
---------------- ------------ ----------
orcl             OPEN                  0

00:53:39 SYS@orcl> col name format A20
00:54:24 SYS@orcl> select name, con_id from v$services;

NAME                     CON_ID
-------------------- ----------
pdb1                          3
orclXDB                       1
orcl                          1
SYS$BACKGROUND                1
SYS$USERS                     1

00:54:30 SYS@orcl> select CON_ID, NAME, OPEN_MODE from v$pdbs;

    CON_ID NAME                 OPEN_MODE
---------- -------------------- ----------
         2 PDB$SEED             READ ONLY
         3 PDB1                 READ WRITE

00:57:49 SYS@orcl> show con_name

CON_NAME
------------------------------
CDB$ROOT
00:58:19 SYS@orcl> show con_id

CON_ID
------------------------------
1
00:58:25 SYS@orcl> SELECT sys_context('userenv','CON_NAME') from dual;

SYS_CONTEXT('USERENV','CON_NAME')
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CDB$ROOT

00:58:36 SYS@orcl> SELECT sys_context('userenv','CON_ID') from dual;

SYS_CONTEXT('USERENV','CON_ID')
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1

00:58:44 SYS@orcl> col PDB_NAME format a8
00:59:43 SYS@orcl> col CON_ID format 99
00:59:51 SYS@orcl> select PDB_ID, PDB_NAME, DBID, GUID, CON_ID from cdb_pdbs;

    PDB_ID PDB_NAME       DBID GUID                             CON_ID
---------- -------- ---------- -------------------------------- ------
         2 PDB$SEED 4080030308 F081641BB43F0F7DE045000000000001      1
         3 PDB1     3345156736 F0832BAF14721281E045000000000001      1

01:00:07 SYS@orcl> col MEMBER format A40
01:00:42 SYS@orcl> select GROUP#, CON_ID, MEMBER from v$logfile;

    GROUP# CON_ID MEMBER
---------- ------ ----------------------------------------
         3      0 /u01/app/oracle/oradata/ORCL/onlinelog/o
                  1_mf_3_9fxn1pmn_.log

         3      0 /u01/app/oracle/fast_recovery_area/ORCL/
                  onlinelog/o1_mf_3_9fxn1por_.log

         2      0 /u01/app/oracle/oradata/ORCL/onlinelog/o
                  1_mf_2_9fxn1lmy_.log

         2      0 /u01/app/oracle/fast_recovery_area/ORCL/
                  onlinelog/o1_mf_2_9fxn1lox_.log

    GROUP# CON_ID MEMBER
---------- ------ ----------------------------------------

         1      0 /u01/app/oracle/oradata/ORCL/onlinelog/o
                  1_mf_1_9fxn1dq4_.log

         1      0 /u01/app/oracle/fast_recovery_area/ORCL/
                  onlinelog/o1_mf_1_9fxn1dsx_.log


6 rows selected.

01:00:49 SYS@orcl> col NAME format A60
01:01:28 SYS@orcl> select NAME , CON_ID from v$controlfile;

NAME                                                         CON_ID
------------------------------------------------------------ ------
/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_9fxn1csd_.ctl      0
/u01/app/oracle/fast_recovery_area/ORCL/controlfile/o1_mf_9f      0
xn1d0k_.ctl


01:01:35 SYS@orcl> col file_name format A50
01:02:01 SYS@orcl> col tablespace_name format A8
01:02:10 SYS@orcl> col file_id format 9999
01:02:18 SYS@orcl> col con_id format 999
01:02:26 SYS@orcl> select FILE_NAME, TABLESPACE_NAME, FILE_ID, con_id from cdb_data_files order by con_id ;

FILE_NAME                                          TABLESPA FILE_ID CON_ID
-------------------------------------------------- -------- ------- ------
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system SYSTEM         1      1
_9fxmx6s1_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux SYSAUX         3      1
_9fxmvhl3_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_ USERS          6      1
9fxn0t8s_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotb UNDOTBS1       4      1
s1_9fxn0vgg_.dbf

FILE_NAME                                          TABLESPA FILE_ID CON_ID
-------------------------------------------------- -------- ------- ------

/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system SYSTEM         5      2
_9fxn22po_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux SYSAUX         7      2
_9fxn22p3_.dbf

/u01/app/oracle/oradata/ORCL/F0832BAF14721281E0450 USERS         13      3
00000000001/datafile/o1_mf_users_9fxvoh6n_.dbf

/u01/app/oracle/oradata/ORCL/F0832BAF14721281E0450 SYSAUX        12      3

FILE_NAME                                          TABLESPA FILE_ID CON_ID
-------------------------------------------------- -------- ------- ------
00000000001/datafile/o1_mf_sysaux_9fxvnjdl_.dbf

/u01/app/oracle/oradata/ORCL/F0832BAF14721281E0450 APEX_226      14      3
00000000001/datafile/o1_mf_apex_226_9gfgd96o_.dbf  45286309
                                                   61551

/u01/app/oracle/oradata/ORCL/F0832BAF14721281E0450 SYSTEM        11      3
00000000001/datafile/o1_mf_system_9fxvnjdq_.dbf


10 rows selected.

01:02:40 SYS@orcl> col file_name format A42
01:03:49 SYS@orcl> select FILE_NAME, TABLESPACE_NAME, FILE_ID from dba_data_files;

FILE_NAME                                  TABLESPA FILE_ID
------------------------------------------ -------- -------
/u01/app/oracle/oradata/ORCL/datafile/o1_m SYSTEM         1
f_system_9fxmx6s1_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_m SYSAUX         3
f_sysaux_9fxmvhl3_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_m USERS          6
f_users_9fxn0t8s_.dbf

/u01/app/oracle/oradata/ORCL/datafile/o1_m UNDOTBS1       4
f_undotbs1_9fxn0vgg_.dbf

FILE_NAME                                  TABLESPA FILE_ID
------------------------------------------ -------- -------


01:03:56 SYS@orcl> col NAME format A12
01:07:23 SYS@orcl> select FILE#, ts.name, ts.ts#, ts.con_id
01:07:24   2  from v$datafile d, v$tablespace ts
01:07:30   3  where d.ts#=ts.ts#
01:07:39   4  and d.con_id=ts.con_id
01:07:46   5  order by 4,3;

     FILE# NAME                TS# CON_ID
---------- ------------ ---------- ------
         1 SYSTEM                0      1
         3 SYSAUX                1      1
         4 UNDOTBS1              2      1
         6 USERS                 4      1
         5 SYSTEM                0      2
         7 SYSAUX                1      2
        11 SYSTEM                0      3
        12 SYSAUX                1      3
        13 USERS                 3      3
        14 APEX_2264528          4      3
           630961551

     FILE# NAME                TS# CON_ID
---------- ------------ ---------- ------


10 rows selected.

01:07:52 SYS@orcl> col file_name format A47
01:08:23 SYS@orcl> select FILE_NAME, TABLESPACE_NAME, FILE_ID
01:08:30   2  from cdb_temp_files;

FILE_NAME                                       TABLESPA FILE_ID
----------------------------------------------- -------- -------
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tem TEMP           1
p_9fxn206l_.tmp

/u01/app/oracle/oradata/ORCL/F0832BAF14721281E0 TEMP           3
45000000000001/datafile/o1_mf_temp_9fxvnznp_.db
f

/u01/app/oracle/oradata/ORCL/datafile/pdbseed_t TEMP           2
emp01.dbf


01:08:36 SYS@orcl> col username format A22
01:09:09 SYS@orcl> select username, common, con_id from cdb_users
01:09:17   2  where username ='SYSTEM';

USERNAME               COM CON_ID
---------------------- --- ------
SYSTEM                 YES      1
SYSTEM                 YES      3
SYSTEM                 YES      2

01:09:22 SYS@orcl> select distinct username from cdb_users
01:09:37   2  where common ='YES';

USERNAME
----------------------
SPATIAL_WFS_ADMIN_USR
OUTLN
CTXSYS
SYSBACKUP
APEX_REST_PUBLIC_USER
ORACLE_OCM
APEX_PUBLIC_USER
MDDATA
GSMADMIN_INTERNAL
SYSDG
ORDDATA

USERNAME
----------------------
APEX_040200
DVF
MDSYS
GSMUSER
FLOWS_FILES
AUDSYS
DVSYS
OJVMSYS
APPQOSSYS
SI_INFORMTN_SCHEMA
ANONYMOUS

USERNAME
----------------------
LBACSYS
WMSYS
DIP
SYSKM
XS$NULL
OLAPSYS
SPATIAL_CSW_ADMIN_USR
APEX_LISTENER
SYSTEM
ORDPLUGINS
DBSNMP

USERNAME
----------------------
ORDSYS
XDB
GSMCATUSER
SYS

37 rows selected.

01:09:43 SYS@orcl> select distinct username, con_id from cdb_users
01:10:07   2  where common ='NO';

USERNAME               CON_ID
---------------------- ------
HR                          3
OE                          3
ADMIN                       3
PMUSER                      3
OBE                         3

01:10:26 SYS@orcl> select username, con_id from cdb_users
01:10:51   2  where common ='NO';

USERNAME               CON_ID
---------------------- ------
PMUSER                      3
HR                          3
ADMIN                       3
OE                          3
OBE                         3

01:10:59 SYS@orcl> col role format A30
01:11:34 SYS@orcl> select role, common, con_id from cdb_roles;

ROLE                           COM CON_ID
------------------------------ --- ------
CONNECT                        YES      1
RESOURCE                       YES      1
DBA                            YES      1
AUDIT_ADMIN                    YES      1
AUDIT_VIEWER                   YES      1
SELECT_CATALOG_ROLE            YES      1
EXECUTE_CATALOG_ROLE           YES      1
DELETE_CATALOG_ROLE            YES      1
CAPTURE_ADMIN                  YES      1
EXP_FULL_DATABASE              YES      1
IMP_FULL_DATABASE              YES      1

... output snipped ...

ROLE                           COM CON_ID
------------------------------ --- ------
DV_PATCH_ADMIN                 YES      2
DV_STREAMS_ADMIN               YES      2
DV_GOLDENGATE_ADMIN            YES      2
DV_XSTREAM_ADMIN               YES      2
DV_GOLDENGATE_REDO_ACCESS      YES      2
DV_AUDIT_CLEANUP               YES      2
DV_DATAPUMP_NETWORK_LINK       YES      2
DV_REALM_RESOURCE              YES      2
DV_REALM_OWNER                 YES      2

251 rows selected.

01:11:40 SYS@orcl> desc sys.system_privilege_map
 Name                                                                                                                                                  Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------
 PRIVILEGE                                                                                                                                             NOT NULL NUMBER
 NAME                                                                                                                                                  NOT NULL VARCHAR2(40)
 PROPERTY                                                                                                                                              NOT NULL NUMBER

01:12:22 SYS@orcl> desc sys.table_privilege_map
 Name                                                                                                                                                  Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------
 PRIVILEGE                                                                                                                                             NOT NULL NUMBER
 NAME                                                                                                                                                  NOT NULL VARCHAR2(40)

01:12:30 SYS@orcl> desc CDB_SYS_PRIVS
 Name                                                                                                                                                  Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------
 GRANTEE                                                                                                                                                        VARCHAR2(128)
 PRIVILEGE                                                                                                                                                      VARCHAR2(40)
 ADMIN_OPTION                                                                                                                                                   VARCHAR2(3)
 COMMON                                                                                                                                                         VARCHAR2(3)
 CON_ID                                                                                                                                                         NUMBER

01:13:07 SYS@orcl> desc CDB_TAB_PRIVS
 Name                                                                                                                                                  Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------
 GRANTEE                                                                                                                                                        VARCHAR2(128)
 OWNER                                                                                                                                                          VARCHAR2(128)
 TABLE_NAME                                                                                                                                                     VARCHAR2(128)
 GRANTOR                                                                                                                                                        VARCHAR2(128)
 PRIVILEGE                                                                                                                                                      VARCHAR2(40)
 GRANTABLE                                                                                                                                                      VARCHAR2(3)
 HIERARCHY                                                                                                                                                      VARCHAR2(3)
 COMMON                                                                                                                                                         VARCHAR2(3)
 TYPE                                                                                                                                                           VARCHAR2(24)
 CON_ID                                                                                                                                                         NUMBER

01:13:16 SYS@orcl> col grantee format A10
01:14:02 SYS@orcl> col granted_role format A28
01:14:09 SYS@orcl> select grantee, granted_role, common, con_id
01:14:16   2  from cdb_role_privs
01:14:22   3  where grantee='SYSTEM';

GRANTEE    GRANTED_ROLE                 COM CON_ID
---------- ---------------------------- --- ------
SYSTEM     DBA                          YES      1
SYSTEM     AQ_ADMINISTRATOR_ROLE        YES      1
SYSTEM     DBA                          YES      2
SYSTEM     AQ_ADMINISTRATOR_ROLE        YES      2
SYSTEM     DBA                          YES      3
SYSTEM     AQ_ADMINISTRATOR_ROLE        YES      3

6 rows selected.

01:14:29 SYS@orcl>

}}}
— Oracle Mix - Oracle OpenWorld and Oracle Develop Suggest-a-Session
https://mix.oracle.com/oow10/faq
https://mix.oracle.com/oow10/streams


http://blogs.oracle.com/oracleopenworld/2010/06/missed_the_call_for_papers_dea.html
http://blogs.oracle.com/datawarehousing/2010/06/openworld_suggest-a-session_vo.html
http://structureddata.org/2010/07/13/oracle-openworld-2010-the-oracle-real-world-performance-group/
http://kevinclosson.wordpress.com/2010/08/26/whats-really-happening-at-openworld-2010/

BI 
http://www.rittmanmead.com/2010/09/03/rittman-mead-at-oracle-openworld-2010-san-francisco/
OCW 2010 photos by Karl Arao
http://www.flickr.com/photos/kylehailey/sets/72157625025196338/

Oracle Closed World 2010
http://www.flickr.com/photos/kylehailey/sets/72157625018583630/
-- scheduler builder username is karlara0
https://oracleus.wingateweb.com/scheduler/login.jsp


Volunteer geek work at RACSIG 9-10am Wed, Oct5
http://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home/Events

my notes ... http://www.evernote.com/shard/s48/sh/6591ce43-e00f-4b5c-ad12-b1f1547183a7/2a146737c4bfb7dab7453ba0bcdb4677

''bloggers meetup''
http://blogs.portrix-systems.de/brost/good-morning-san-francisco-5k-partner-fun-run/
http://dbakevlar.com/2011/10/oracle-open-world-2011-followup/
making use of smart scan made the run times faster, cpu on a lower utilization, + can accommodate more databases 
http://www.evernote.com/shard/s48/sh/b1f43d49-1bcd-4319-b274-19a91cf338ac/f9f554d2d03b3f20db591d5e68392cbf

{{{
Glenn Fawcett 
http://glennfawcett.files.wordpress.com/2013/06/ciops_data_x3-2.jpg
---
It wasn’t actually SLOB, but that might be interesting.
I used a mod of my blkhammer populate script to populate a bunch of tables OLTP style to 
show how WriteBack is used. As expected, Exadata is real good on 
“db file sequential read”… in the sub picosecond range if I am not mistaken :)
---
That was just a simple OLTP style insert test that spawns a bunch of PLSQL.  Yes for sure 
their were spills to disk... But the benefit was the coalescing of blocks.  DBWR is flushing really 
mostly random blocks, but the write back flash is pretty huge these days.  I was seeing average 
iosize to disk being around 800k but only about 8k to flash.
}}}
Backup and Recovery Performance and Best Practices for Exadata Cell and Oracle Exadata Database Machine  Oracle Database Release 11.2.0.2 and 11.2.0.3
http://www.oracle.com/technetwork/database/features/availability/maa-tech-wp-sundbm-backup-11202-183503.pdf

ODA (Oracle Database Appliance): HowTo Configure Multiple Public Network on GI (Grid Infrastructure) (Doc ID 1501039.1)
Data Guard: Redo Transport Services – How to use a separate network in a RAC environment. (Doc ID 1210153.1)
Data Guard Physical Standby 11.2 RAC Primary to RAC Standby using a second network (Doc ID 1349977.1)

<<showtoc>>

! @@Create a new@@ PDB from the seed PDB
@@quickest way is to DBCA@@
DBCA options: 
* create a new PDB
* create new PDB from PDB Archive
* create PDB from PDB file set (RMAN backup and PDB XML metadata file)
<<<
1) Copies the data files from PDB$SEED data files 
2) Creates tablespaces SYSTEM, SYSAUX 
3) Creates a full catalog including metadata pointing to Oracle-supplied objects 
4) Creates common users: 
>	– Superuser SYS 
>	– SYSTEM 
5) Creates a local user (PDBA) 
> granted local PDB_DBA role 
6) Creates a new default service 
7) After PDB creation make sure TNS entry is created 
> CONNECT sys/oracle@pdb2 AS SYSDBA 
> CONNECT oracle/oracle@pdb2 
<<<

! @@Plug a non-CDB@@ in a CDB
options:
* TTS
* full export/import
* TDB (transportable database)
* DBMS_PDB package
* Clone a Remote Non-CDB (you can do it remotely)
* replication (Golden Gate)
<<<
using DBMS_PDB package below (running on the same server):
{{{

Cleanly shutdown the non-CDB and start it in read-only mode.

sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP OPEN READ ONLY;

Describe the non-DBC using the DBMS_PDB.DESCRIBE procedure

BEGIN
  DBMS_PDB.DESCRIBE(
    pdb_descr_file => '/tmp/db12c.xml');
END;
/

Shutdown the non-CDB database.
SHUTDOWN IMMEDIATE;

Connect to an existing CDB and create a new PDB using the file describing the non-CDB database
CREATE PLUGGABLE DATABASE pdb4 USING '/tmp/db12c.xml'
  COPY;

ALTER SESSION SET CONTAINER=pdb4;
@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

ALTER SESSION SET CONTAINER=pdb4;
ALTER PLUGGABLE DATABASE OPEN;

08:24:03 SYS@cdb21> ALTER SESSION SET CONTAINER=pdb4;

Session altered.

08:24:23 SYS@cdb21>
08:24:24 SYS@cdb21>
08:24:24 SYS@cdb21> select name from v$datafile;

NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+DATA/CDB2/DATAFILE/undotbs1.340.868397457
+DATA/CDB2/0C1D0762158FE2B6E053AA08A8C0D1F5/DATAFILE/system.391.868520259
+DATA/CDB2/0C1D0762158FE2B6E053AA08A8C0D1F5/DATAFILE/sysaux.390.868520259
+DATA/CDB2/0C1D0762158FE2B6E053AA08A8C0D1F5/DATAFILE/users.389.868520259

08:24:29 SYS@cdb21> conn / as sysdba
Connected.
08:24:41 SYS@cdb21> select name from v$datafile
08:24:45   2  ;

NAME
-----------------------------------------------------------------------------------------------------------------------------------------------------------
+DATA/CDB2/DATAFILE/system.338.868397411
+DATA/CDB2/DATAFILE/sysaux.337.868397377
+DATA/CDB2/DATAFILE/undotbs1.340.868397457
+DATA/CDB2/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/system.346.868397513
+DATA/CDB2/DATAFILE/users.339.868397457
+DATA/CDB2/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/sysaux.345.868397513
+DATA/CDB2/DATAFILE/undotbs2.348.868397775
+DATA/CDB2/DATAFILE/undotbs3.349.868397775
+DATA/CDB2/DATAFILE/undotbs4.350.868397775
+DATA/CDB2/0C1D0762158FE2B6E053AA08A8C0D1F5/DATAFILE/system.391.868520259
+DATA/CDB2/0C1D0762158FE2B6E053AA08A8C0D1F5/DATAFILE/sysaux.390.868520259
+DATA/CDB2/0C1D0762158FE2B6E053AA08A8C0D1F5/DATAFILE/users.389.868520259

12 rows selected.

08:24:46 SYS@cdb21> select FILE_NAME, TABLESPACE_NAME, FILE_ID, con_id from cdb_data_files order by con_id ;

FILE_NAME
-----------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                   FILE_ID     CON_ID
------------------------------ ---------- ----------
+DATA/CDB2/DATAFILE/system.338.868397411
SYSTEM                                  1          1

+DATA/CDB2/DATAFILE/sysaux.337.868397377
SYSAUX                                  3          1

+DATA/CDB2/DATAFILE/undotbs1.340.868397457
UNDOTBS1                                4          1

+DATA/CDB2/DATAFILE/undotbs4.350.868397775
UNDOTBS4                               10          1

+DATA/CDB2/DATAFILE/undotbs2.348.868397775
UNDOTBS2                                8          1

+DATA/CDB2/DATAFILE/undotbs3.349.868397775
UNDOTBS3                                9          1

+DATA/CDB2/DATAFILE/users.339.868397457
USERS                                   6          1


7 rows selected.
}}}
<<<

! @@Clone a PDB@@ from another PDB
@@through SQL*Plus@@
<<<
{{{
This technique copies a source PDB from a CDB and plugs the copy in to a CDB. The source
PDB is in the local CDB.
The steps to clone a PDB within the same CDB are the following:
1. In init.ora, set DB_CREATE_FILE_DEST= 'PDB3dir' (OMF) or
PDB_FILE_NAME_CONVERT= 'PDB1dir', 'PDB3dir' (non OMF).
2. Connect to the root of the CDB as a common user with CREATE PLUGGABLE DATABASE
privilege.
3. Quiesce the source PDB used to clone, using the command ALTER PLUGGABLE
DATABASE pdb1 READ ONLY after closing the PDB using the command ALTER
PLUGGABLE DATABASE CLOSE
4. Use the command CREATE PLUGGABLE DATABASE to clone the PDB pdb3 FROM pdb1.
5. Then open the new pdb3 with the command ALTER PLUGGABLE DATABASE OPEN.
If you do not use OMF, in step 4, use the command CREATE PLUGGABLE DATABASE with the
clause FILE_NAME_CONVERT=(’pdb1dir’,’ pdb3dir’) to define the directory of the
source files to copy from PDB1 and the target directory for the new files of PDB3.

quick step by step

alter session set container=cdb$root;
show con_name
set db_create_file_dest

15:09:04 SYS@orcl> ALTER PLUGGABLE DATABASE pdb2 close;

Pluggable database altered.

15:09:30 SYS@orcl> ALTER PLUGGABLE DATABASE pdb2 open read only;

Pluggable database altered.

15:09:40 SYS@orcl> CREATE PLUGGABLE DATABASE PDB3 FROM PDB2;

Pluggable database created.

15:12:25 SYS@orcl> ALTER PLUGGABLE DATABASE pdb3 open;

Pluggable database altered.

15:12:58 SYS@orcl> select CON_ID, dbid, NAME, OPEN_MODE from v$pdbs;

    CON_ID NAME                           OPEN_MODE
— — —
         2 PDB$SEED                       READ ONLY
         3 PDB1                           READ WRITE
         4 PDB2                           READ ONLY
         5 PDB3                           READ WRITE

 select FILE_NAME, TABLESPACE_NAME, FILE_ID, con_id from cdb_data_files order by con_id ;

15:13:33 SYS@orcl> show parameter db_create

NAME                                 TYPE        VALUE
-
db_create_file_dest                  string      /u01/app/oracle/oradata
db_create_online_log_dest_1          string
db_create_online_log_dest_2          string
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string
15:15:14 SYS@orcl>
15:15:17 SYS@orcl>
15:15:17 SYS@orcl> show parameter file_name

NAME                                 TYPE        VALUE
-
db_file_name_convert                 string
log_file_name_convert                string
pdb_file_name_convert                string

ALTER PLUGGABLE DATABASE pdb2 close;
ALTER PLUGGABLE DATABASE pdb2 open;

CONNECT sys/oracle@pdb3 AS SYSDBA
CONNECT oracle/oracle@pdb3 
}}}
<<<

! @@Plug an unplugged PDB@@ into another CDB
@@quickest is DBCA, just do the unplug and plug from UI@@






! References:
http://oracle-base.com/articles/12c/multitenant-create-and-configure-pluggable-database-12cr1.php














http://kevinclosson.wordpress.com/2012/02/12/how-many-non-exadata-rac-licenses-do-you-need-to-match-exadata-performance/
{{{
kevinclosson
February 14, 2012 at 8:52 pm
Actually, Matt, I see nothing wrong with what the rep said. A single Exadata database grid host can drive a tremendous amount of storage throughput but it can only eat 3.2GB/s since there is but a single 40Gb HCA port active on each host. A single host can drive the storage grid nearly to saturation via Smart Scan…but as soon as the data flow back to the host approaches 3.2GB/s the Smart Scan will start to throttle. In fact single session (non-Parallel Query) can drive Smart Scan to well over 10GB/s in a full rack but, in that case you’d have a single foreground process on a single core of WSM-EP so there wouldn’t sufficient bandwidth to ingest much data..about 250MB/s can flow into a single session performing a Smart Scan. So the hypothetical there would be Smart Scan is churning through, let’s say, 10GB/s and Smart Scan is whittling down the payload by about 9.75GB/s through filtration and projection. Those are very close to realistic numbers I’ve just cited but I haven’t measured those sort of “atomics” in a year so I’m going by memory. Let’s say give or take 5% on my numbers.
<<<
}}}

http://forums.theregister.co.uk/forum/1/2011/12/12/ibm_vs_oracle_data_centre_optimisation/
{{{
Exadata: 2 Grids, 2 sets of roles.
>The Exadata storage nodes compress database files using a hybrid columnar algorithm so they take up less space and can be searched more quickly. They also run a chunk of the Oracle 11g code, pre-processing SQL queries on this compressed data before passing it off to the full-on 11g database nodes.
Exadata cells do not compress data. Data compression is done at load time (in the direct path) and compression (all varieties not just HCC) is code executed only on the RAC grid CPUS. Exadata users get no CPU help from the 168 cores in the storage grid when it comes to compressing data.
Exadata cells can, however, decompress HCC data (but not the other types of compressed data). I wrote "can" because cells monitor how busy they are and are constantly notified by the RAC servers about their respective CPU utilization. Since decompressing HCC data is murderously CPU-intensive the cells easily go processor-bound. At that time cells switch to "pass-through" mode shipping up to 40% of the HCC blocks to the RAC grid in compressed form. Unfortunately there are more CPUs in the storage grid than the RAC grid. There is a lot of writing on this matter on my blog and in the Expert Oracle Exadata book (Apress).
Also, while there are indeed 40GB DDR Infiniband paths to/from the RAC grid and the storage grid, there is only 3.2GB/s usable bandwidth for application payload between these grids. Therefore, the aggregate maximum data flow between the RAC grid and the cells is 25.6GB/s (3.2x8). There are 8 IB HCAs in either X2 model as well so the figure sticks for both. In the HP Oracle Database Mahine days that figure was 12.8GB/s.
With a maximum of 25.6 GB/s for application payload (Oracle's iDB protocol as it is called) one has to quickly do the math to see the mandatory data reduction rate in storage. That is, if only 25.6 GB/s fits through the network between these two grids yet a full rack can scan combined HDD+FLASH at 75 GB/s then you have to write SQL that throws away at least 66% of the data that comes off disk. Now, I'll be the first to point out that 66% payload reduction from cells is common. Indeed, the cells filter (WHERE predicate) and project columns (only the cited and join columns need shipped). However, compression changes all of that.
If scanning HCC data on a full rack Exadata configuration, and that data is compressed at the commonly cited compression ratio of 10:1 then the "effective" scan rate is 750GB/s. Now use the same predicates and cite the same columns and you'll get 66% reduced payload--or 255GB/s that needs to flow over iDB. That's about 10x over-subscription of the available 25.6 GB/s iDB bandwidth. When this occurs, I/O is throttled. That is, if the filtered/projected data produced by the cells is greater than 25.6GB/s then I/O wanes. Don't expect 10x query speedup because the product only has to perform 10% the I/O it would in the non-compressed case (given a HCC compression ratio of 10:1).
That is how the product works. So long as your service levels are met, fine. Just don't expect to see 75GB/s of HCC storage throughput with complex queries because this asymmetrical MPP architecture (Exadata) cannot scale that way (for more info see: http://bit.ly/tFauDA )
}}}


http://kevinclosson.wordpress.com/2011/11/23/mark-hurd-knows-cios-i-know-trivia-cios-may-not-care-about-either-hang-on-im-booting-my-cell-phone/#comment-37527
{{{
kevinclosson
November 28, 2011 at 7:09 pm
“I can see the shared nothing vs shared everything point in a CPU + separate storage perspective.”

…actually, I don’t fester about with the shared-disk versus shared nothing as I really don’t think it matters. It’s true that Real Application Clusters requires shared disk but that is not a scalability hindrance–so long as one works out the storage bandwidth requirements–a task that is not all that difficult with modern storage networking options. So long as ample I/O flow is plumbed into RAC it scales DW/BI workloads. It is as simple as that. On the other hand, what doesn’t scale is asymmetry. Asymmetry has never scaled as would be obvious to even the casual observer. As long as all code can run on all CPUs (symmetry) scalability is within reach. What I’m saying is that RAC actually has better scalability characteristics when running with conventional storage than with Exadata! That’s a preposterous statement to the folks who don’t actually know the technology, as well as those who are dishonest about the technology, but obvious to the rest of us. It’s simple computer science. One cannot take the code path of query processing, chop it off at the knees (filtration/projection) and offload that to some arbitrary percentage of your CPU assets and pigeon-hole all the rest of the code to the remaining CPUs and cross fingers.

A query cannot be equally CPU-intensive in all query code all the time. There is natural ebb and tide. If the query plan is at the point of intensive join processing it is not beneficial to have over fifty percent of the CPUs in the rack unable to process join code (as is the case with Exadata).

To address this sort of ebb/tide imbalance Oracle has “released” a “feature” referred to as “passthrough” where Exadata cells stop doing their value-add (filtration and HCC decompression) for up to about 40% of the data flowing off storage when cells get too busy (CPU-wise). At that point they just send unfiltered, compressed data to the RAC grid. The RAC grid, unfortunately, has less CPU cores than the storage grid and has brutally CPU-intensive work of its own to do (table join, sort, agg). “Passthrough” is discussed in the Expert Oracle Exadata (Apress) book.

This passthrough feature does allow water to find its level, as it were. When Exadata falls back to passthrough mode the whole configuration does indeed utilize all CPU and since idle CPU doesn’t do well to increase query processing performance this is a good thing. However, if Exadata cells stop doing the “Secret Sauce” (a.k.a., Offload Processing) when they get busy then why not just build a really large database grid (e.g., with the CPU count of all servers in an Exadata rack) and feed it with conventional storage? That way all CPU power is “in the right place” all the time. Well, the answer to that is clearly RAC licensing. Very few folks can afford to license enough cores to run a large enough RAC grid to make any of this matter. Instead they divert some monies that could go for a bigger database grid into “intelligent storage” and hope for the best.
}}}



http://www.snia.org/sites/default/education/tutorials/2008/fall/networking/DrorGoldenberg-Fabric_Consolidation_InfiniBand.pdf
3.2 GB/s unidirectional 
theoretical limit 3.2 GB/s measured due to server IO limitations


http://www.it-einkauf.de/images/PDF/677C777.pdf
{{{
INFINIBAND PHYSICAL-LAYER CHARACTERISTICS 
The InfiniBand physical-layer specification supports three data rates, designated 1X, 4X, and 12X, over both copper and fiber optic media. 
The base data rate, 1X single data rate (SDR), is clocked at 2.5 Gbps and is transmitted over two pairs of wires—transmit and receive—and 
yields an effective data rate of 2 Gbps full duplex (2 Gbps transmit, 2 Gbps receive). The 25 percent difference between data rate and  
clock rate is due to 8B/10B line encoding that dictates that for every 8 bits of data transmitted, an additional 2 bits of transmission 
overhead is incurred. 
}}}

infiniband cabling issues
{{{
InfiniBand cable presents a challenge within this environment because the cables are considerably thicker, heavier, and shorter in length 
to mitigate the effects of cross-talk and signal attenuation and achieve low bit error rates (BERs). To assure the operational integrity and 
performance of the HPC cluster, it is critically important to maintain the correct bend radius, or the integrity of the cable can be 
compromised such that the effects of cross-talk introduce unacceptable BERs. 
To address these issues, it is essential to thoroughly plan the InfiniBand implementation and provide a good cable management solution 
that enables easy expansion and replacement of failed cables and hardware. This is especially important when InfiniBand 12X or DDR 
technologies are being deployed because the high transmission rates are less tolerant to poor installation practices. 
}}}

http://www.redbooks.ibm.com/abstracts/tips0456.html
A single PCI Express serial link is a dual-simplex connection using two pairs of wires, one pair for transmit and one pair for receive, and can only transmit one bit per cycle. Although this sounds limiting, it can transmit at the extremely high speed of 2.5 Gbps, which equates to a burst mode of 320 MBps on a single connection. These two pairs of wires is called a lane.
{{{
Table: PCI Express maximum transfer rate
Lane width	Clock speed	Throughput (duplex, bits)	Throughput (duplex, bytes)	Initial expected uses
x1	2.5 GHz	5 Gbps	400 MBps	Slots, Gigabit Ethernet
x2	2.5 GHz	10 Gbps	800 MBps	
x4	2.5 GHz	20 Gbps	1.6 GBps	Slots, 10 Gigabit Ethernet, SCSI, SAS
x8	2.5 GHz	40 Gbps	3.2 GBps	
x16	2.5 GHz	80 Gbps	6.4 GBps	Graphics adapters
}}}


http://www.aiotestking.com/juniper/2011/07/when-using-a-40-gbps-switch-fabric-how-much-full-duplex-bandwidth-is-available-to-each-slot/
{{{
When using a 40 Gbps switch fabric, how much full duplex bandwidth is available to each slot?
A.
1.25 Gbps
}}}

Sun Blade 6048 InfiniBand QDR Switched Network Express Module Introduction
http://docs.oracle.com/cd/E19914-01/820-6705-10/chapter1.html
{{{
IB transfer rate (maximum)	
40 Gbps (QDR) per 4x IB port for the Sun Blade X6275 server module and 20 Gbps (DDR) per 4x IB port for the Sun Blade X6270 server module. There are two 4x IB ports per server module.

1,536 Gbps aggregate throughput
}}}


''email with Kevin''
<<<
on Exadata the 3.2 is establsihed by the PCI slot the HCA is sitting in. I don't scrutinize QDR IB these days. It would be duplex...would have to look it up.
<<<

wikipedia
<<<
http://en.wikipedia.org/wiki/InfiniBand where it mentioned about "The SDR connection's signalling rate is 2.5 gigabit per second (Gbit/s) in each direction per connection"
<<<

''The flash and HCA cards uses pci-e x8''
http://jarneil.wordpress.com/2012/02/02/upgradingdowngrading-exadata-ilom-firmware/
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CFkQFjAA&url=http%3A%2F%2Fhusnusensoy.files.wordpress.com%2F2010%2F10%2Foracle-exadata-v2-fast-track.pptx&ei=M4zTT_mvLcGC2AWpufi6Dw&usg=AFQjCNFMAJgvIx9QuD3513dWS9nETkeXqw
{{{
IB Switches
3 x 36-port managed switches as opposed to Exadata v1 (2+1).
2 “leaf”
1 “spine” switches
Spine switch is only available for Full Rack because it is for connecting multiple full racks side by side.
A subnet manager running on one switch discovers the topology of the network.
HCA
Each node (RAC & Storage Cell) has a PCIe x8 40 Gbit HCA with two ports
Active-Standby Intracard Bonding.
}}}

F20 PCIe Card
{{{
Not a SATA/SAS SSD driver but a x8 PCIe device providing SATA/SAS interface.
4 Solid State Flash Disk Modules (FMod) each of 24 GB size
256 MB Cache
SuperCap Power Reserve (EnergyStorageModule) provides write-back operation mode.
ESM should be enabled for optimal write performance
Should be replaced in every two years.
Can be monitored using various tools like ILOM
Embedded SAS/SATA configuration will expose  16 (4 cards x 4 FMod) Linux devices.
/dev/sdn
4K sector boundary for Fmods
Each FMod consists of several NAND modules best performance can be reached with multithreading (32+ thread/FMod etc)

}}}







{{{

How To Avoid ORA-04030/ORA-12500 In 32 Bit Windows Environment
  	Doc ID: 	Note:373602.1

How to convert a 32-bit database to 64-bit database on Linux?
  	Doc ID: 	Note:341880.1 	
  	


-- PAE/AWE
		
		Some relief may be obtained by setting the /3GB flag as well as the /PAE flag in Oracle. This at least assures that up to 2 GB of memory is available for the Large Pool, 
		the Shared Pool, the PGA, and all user threads, after the AWE_WINDOW_SIZE parameter is taken into account. However, Microsoft recommends that the /3GB flag not be set if 
		the /AWE flag is set. This is due to the fact that the total amount of RAM accessible for ALL purposes is limited to 16 GB if the /3GB flag is set. RAM above 16 GB simply 
		�disappears� from the view of the OS. For PowerEdge 6850 servers that can support up to 64 GB of RAM, a limitation to only 16 GB of RAM is unacceptable.
		
		As noted previously, the model used for extended memory access under a 32-bit Operating System entails a substantial performance penalty. However, with a 64-bit OS, a flat linear model for memory used, with no need for PAE to access memory above 4 GB. Improved performance will be experienced for database SGA sizes greater than 3 GB, due to elimination of PAE overhead.
		
		
		MAXIMUM OF 4 GB OF ADDRESSABLE MEMORY FOR THE 32 BIT ARCHITECTURE. THIS IS A MAXIMUM PER PROCESS. THAT IS, EACH PROCESS MAY ALLOCATE UP TO 4 GB OF MEMORY
		
		2GB for OS
		2GB for USER THREADS
		
		1st workaround on 4GB limit: 
			- To expand the total memory used by Oracle above 2 GB, the /3GB flag may be set in the boot.ini file.	
				With the /3GB flag set, only 1 GB is used for the OS, and 3 GB is available for all user threads, including the Oracle SGA. 
			
		2nd workaround on 4GB limit: 
			- use the PAE, Intel 32-bit processors such as the Xeon processor support PAGING ADDRESS EXTENSIONS for large memory support
				MS Windows 2000 and 2003 support PAE through ADDRESS WINDOWING EXTENSIONS (AWE). PAE/AWE may be enabled by setting the /PAE flag in the boot.ini file. 
				The �USE_INDIRECT_BUFFERS=TRUE� parameter must also be set in the Oracle initialization file. In addition, the DB_BLOCK_BUFFERS parameter must be used 
				instead of the DB_CACHE parameter in the Oracle initialization file. With this method, Windows 2000 Server and Windows Server 2003 versions can support 
				up to 8 GB of total memory.
				Windows Advanced Server and Data Center versions support up to 64 GB of addressable memory with PAE/AWE.
			- One limitation of AWE is that only the Data Buffer component of the SGA may be placed in extended memory. Threads for other 
				SGA components such as the Shared Pool and the Large Pool, as well as the PGA and all Oracle user sessions must still fit inside 
				a relatively small memory area. THERE IS AN AWE_WINDOW_SIZE REGISTRY KEY PARAMETER THAT IS USED TO SET THE SIZE OF A KIND OF  �SWAP� AREA IN THE SGA. <-- swap area in SGA
				This �swap� area is used for mapping data blocks in upper memory to a lower memory location. By default, 
				this takes an additional 1 GB of low memory. This leaves only 2 GB of memory for everything other than the Buffer cache, assuming 
				the /3GB flag is set. If the /3GB flag is not set, only 1 GB of memory is available for the non-Buffer Cache components.
			- Note that the maximum addressable memory was limited to 16 GB of RAM
				Some relief may be obtained by setting the /3GB flag as well as the /PAE flag in Oracle. This at least assures that up to 2 GB of memory is available 
				for the Large Pool, the Shared Pool, the PGA, and all user threads, after the AWE_WINDOW_SIZE parameter is taken into account. However, Microsoft 
				recommends that the /3GB flag not be set if the /AWE flag is set. This is due to the fact that the total amount of RAM accessible for ALL purposes 
				is limited to 16 GB if the /3GB flag is set. RAM ABOVE 16 GB SIMPLY �DISAPPEARS� FROM THE VIEW OF THE OS. For PowerEdge 6850 servers that can support 
				up to 64 GB of RAM, a limitation to only 16 GB of RAM is unacceptable.
					This will give you (/3GB is set):
						3-4GB 	for Buffer Cache
						1GB 	for the swap area
						2GB 	for everything other than the Buffer Cache
						1GB 	for OS
					This will give you (/3GB is not set):
						3-4GB 	for Buffer Cache
						1GB 	for the swap area
						1GB 	for everything other than the Buffer Cache
						2GB 	for OS
			- Performance Tuning Corporation Benchmark:
					This will give you (/3GB is set):
						11GB 	for Buffer Cache
						.75GB 	for the swap area (AWE_MEMORY_WINDOW..minimum size that allowed the database to start)
						2.25GB 	for everything other than the Buffer Cache
						1GB 	for OS
					This will give you (/3GB is not set):
						11GB 	for Buffer Cache
						.75GB 	for the swap area (AWE_MEMORY_WINDOW..minimum size that allowed the database to start)
						1.25GB 	for everything other than the Buffer Cache
						2GB 	for OS

}}}

Using Large Pages for Oracle on Windows 64-bit (ORA_LPENABLE) http://blog.ronnyegner-consulting.de/2010/10/19/using-large-pages-for-oracle-on-windows-64-bit-ora_lpenable/
http://www.sketchup.com/download
http://docs.oracle.com/cd/E11857_01/em.111/e16790/ha_strategy.htm#EMADM9613
http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/ <-- good stuff
http://ubuntuforums.org/showthread.php?t=1854524
http://ubuntuforums.org/showthread.php?t=1685666
http://ubuntuforums.org/showthread.php?t=1768635

also see [[Get BlockSize of OS]]


''Oracle related links''
1.8.1.4 Support 4 KB Sector Disk Drives http://docs.oracle.com/cd/E11882_01/server.112/e22487/chapter1.htm#FEATURENO08747 
Planning the Block Size of Redo Log Files http://docs.oracle.com/cd/E11882_01/server.112/e25494/onlineredo002.htm#ADMIN12891
Specifying the Sector Size for Drives http://docs.oracle.com/cd/E11882_01/server.112/e18951/asmdiskgrps.htm#OSTMG10203
Microsoft support policy for 4K sector hard drives in Windows http://support.microsoft.com/kb/2510009
ATA 4 KiB sector issues https://ata.wiki.kernel.org/index.php/ATA_4_KiB_sector_issues
http://en.wikipedia.org/wiki/Advanced_format
http://martincarstenbach.wordpress.com/2013/04/29/4k-sector-size-and-grid-infrastructure-11-2-installation-gotcha/
http://flashdba.com/4k-sector-size/
http://flashdba.com/install-cookbooks/installing-oracle-database-11-2-0-3-single-instance-using-4k-sector-size/
http://flashdba.com/2013/04/12/strange-asm-behaviour-with-4k-devices/
http://flashdba.com/2013/05/08/the-most-important-thing-you-need-to-know-about-flash/
http://www.storagenewsletter.com/news/disk/217-companies-hdd-since-1956
http://www.theregister.co.uk/2013/02/04/ihs_hdd_projections/
Alert: (Fix Is Ready + Additional Steps!) : After SAN Firmware Upgrade, ASM Diskgroups ( Using ASMLIB) Cannot Be Mounted Due To ORA-15085: ASM disk "" has inconsistent sector size. [1500460.1]












http://karlarao.wordpress.com/2009/12/31/50-sql-performance-optimization-scenarios/

{{{
ORACLE SQL Performance Optimization Series (1)

1. The types of ORACLE optimizer
2. The way to visit Table
3. Shared SQL statement

ORACLE SQL Performance Optimization Series (2)

4. Select the table name of the most efficient order (only in the effective rule-based optimizer)
5. WHERE clause in the order of the connections
6. SELECT clause to avoid using ‘*’
7. Access to the database to reduce the number of

ORACLE SQL Performance Optimization Series (3)

8. Using the DECODE function to reduce the processing time
9. Integration of simple, non-associated database access
10. Remove duplicate records
11. Alternative DELETE with TRUNCATE
12. As much as possible the use of COMMIT

ORACLE SQL Performance Optimization Series (4)

13. Calculate the number of records
14. Where clause with the HAVING clause to replace
15. To reduce the query table
16. Through an internal function to improve SQL efficiency

ORACLE SQL Performance Optimization Series (5)

17. Use the table alias (Alias)
18. Replace IN with EXISTS
19. Replace NOT IN with NOT EXISTS

ORACLE SQL performance optimization Series (6)

20. Connect with the table to replace EXISTS
21. Replace DISTINCT with EXISTS
22. Recognition ‘inefficient implementation of the’ in SQL statements
23. Use TKPROF tool to query SQL Performance Status

ORACLE SQL Performance Optimization Series (7)

24. Analysis of SQL statements with EXPLAIN PLAN

ORACLE SQL Performance Optimization Series (8)

25. With the index to improve efficiency
26. Operation index

ORACLE SQL Performance Optimization Series (9)

27. The choice of the basis of the table
28. Number of equal index
29. Comparing and scope of the comparison equation
30. The index level is not clear

ORACLE SQL Performance Optimization Series (10)

31. Force index failure
32. Avoid the use of columns in the index calculation.
33. Auto Select Index
34. Avoid the use of NOT in the index column
35. With “= substitute”

ORACLE SQL Performance Optimization Series (11)

36. UNION replaced with the OR (for the index column)
37. To replace the OR with the IN
38. Avoid the use of columns in the index IS NULL and IS NOT NULL

ORACLE SQL Performance Optimization Series (12)

39. Always use the first column index
40. ORACLE internal operations
41. With the UNION-ALL replaced UNION (if possible)
42. Usage Tips (Hints)

ORACLE SQL Performance Optimization Series (13)

43. WHERE replaced with ORDER BY
44. Avoid changing the index of the column type
45. Need to be careful of the WHERE clause

ORACLE SQL Performance Optimization Series (14)

46. Connect multiple scan
47. CBO to use a more selective index of
48. Avoid the use of resource-intensive operations
49. GROUP BY Optimization
50. Use Date
51. Use explicit cursor (CURSORs)
52. Optimization EXPORT and IMPORT
53. Separate tables and indexes

ORACLE SQL Performance Optimization Series (15)

EXISTS / NOT EXISTS must be better than IN / NOT IN the efficiency of high?

ORACLE SQL Performance Optimization Series (16)

I used the view of how query results are wrong?

ORACLE SQL Performance Optimization Series (17)

Page Which writing efficient SQL?

ORACLE SQL Performance Optimization Series (18)

COUNT (rowid) / COUNT (pk) the efficiency of high?

ORACLE SQL Performance Optimization Series (19)

ORACLE data type implicit conversions

ORACLE SQL Performance Optimization Series (20)

The use of INDEX should pay attention to the three questions

ORACLE Tips (HINT) use (Part 1) (21)

ORACLE Tips (HINT) use (Part 2) (22)

Analysis of function-based index (Part 1) (23)

Analysis of function-based index (Part 2) (24)

How to achieve efficient paging query (25)

ORACLE achieved in the SELECT TOP N method (26)
}}}
http://highscalability.com/blog/2013/11/25/how-to-make-an-infinitely-scalable-relational-database-manag.html
http://dimitrik.free.fr/blog/archives/2013/11/mysql-performance-over-1m-qps-with-innodb-memcached-plugin-in-mysql-57.html
Average Active Sessions (AAS) is a metric of the database load. This value should not go above the CPU count, if it does then that means the database is working very hard or waiting a lot for something. 

''The AAS & CPU count is used as a yardstick for a possible performance problem (I suggest reading Kyle's stuff about this):''
{{{
    if AAS < 1 
      -- Database is not blocked
    AAS ~= 0 
      -- Database basically idle
      -- Problems are in the APP not DB
    AAS < # of CPUs
      -- CPU available
      -- Database is probably not blocked
      -- Are any single sessions 100% active?
    AAS > # of CPUs
      -- Could have performance problems
    AAS >> # of CPUS
      -- There is a bottleneck
}}}

''AAS Formula''
--
{{{
* AAS is either dbtime/elapsed
* or count/samples
* in the case of dba_hist_ count is count*10 since they only write out 1/10 samples (19751*10)/600 = 329.18
}}}
<<showtoc>>

This Tiddler will show you a new interesting metric included in the performance graph of Enterprise Manager 11g.. which is the ''CPU Wait'' or ''CPU + CPU Wait''

a little background.. 

I've done an IO test with the intention of bringing the system down to its knees and characterizing the IO performance on that level of stress. That time I want to know the IO performance of my R&D server http://www.facebook.com/photo.php?pid=5272015&l=d5f2be4166&id=552113028 (which I intend to run lots of VMs) having 8GB memory, IntelCore2Quad Q9500 & 5 x 1TB short stroked disk (on the outer 100GB area) and I was able to built from it an LVM stripe that produced about 900+ IOPS & 300+ MB/s on my ''Orion'' and ''dbms_resource_manager.calibrate_io'' runs and validated those numbers against the database I created by actually running ''256 parallel sessions'' doing SELECT * on a 300GB table http://goo.gl/PYYyH (the same disks are used but as ASM disks on the next 100GB area - short stroked). 

I'll start off by showing you how AAS is computed.. Then detail on how it is being graphed and show you the behavior of AAS on IO and CPU bound workload.. 

The tools I used for graphing the AAS: 
* Enterprise Manager 11g
** both the real time and historical graphs
* ASH Viewer by Alexander Kardapolov http://j.mp/dNidrB 
** this tool samples from the ASH itself and graphs it.. so it allows me to check the correctness and compare it with the ''real time'' graph of Enterprise Manager
* MS Excel and awr_topevents.sql 
** this tool samples from the DBA_HIST views and graphs it.. so it allows me to check the correctness and compare it with the ''historical'' graph of Enterprise Manager

Let's get started.. 

!
! How AAS is computed

AAS is the abstraction of database load and you can get it by the following means... 

!!!! 1) From ASH
<<<
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZtyRXwwiOI/AAAAAAAABLA/BYOUYtXO1Vo/AASFromASH.png]]
<<<

!!!! 2) From DBA_HIST_ACTIVE_SESS_HISTORY
* In the case of DBA_HIST_ ''sample count'' is sample count*10 since they only write out 1/10 samples
<<<
[img[picturename| https://lh4.googleusercontent.com/_F2x5WXOJ6Q8/TZtyRcp7m_I/AAAAAAAABLI/sLqztbLY3Mw/AASFromDBA_HIST.png]]
<<<

!!!! 3) From the AWR Top Events
* The Top Events section unions the output of ''dba_hist_system_event'' (all the events) and the ''CPU'' from time model (''dba_hist_sys_time_model'') and then filter only the ''top 5'' and do this across the SNAP_IDs
** To get the ''high level AAS'' you have to divide DB Time / Elapsed Time
** To get the ''AAS for the Top Events'', you have to divide the ''time'' (from event or cpu) by ''elapsed time''
* You can see below that we are having ''the same'' AAS numbers compared to the ASH reports 
<<<
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TZtyRdPqm3I/AAAAAAAABLE/o23FMIG1yeQ/AASFromAWRTop.png]]
<<<

!
! How AAS is being graphed
I have a dedicated blog post on this topic.. http://karlarao.wordpress.com/2010/07/25/graphing-the-aas-with-perfsheet-a-la-enterprise-manager/

So we already know how we get the AAS, and how is it graphed.. ''so what's my issue?''

''Remember I mentioned this on the blog post above.. ?''
<<<
"So what’s the effect? mm… on a high CPU activity period you’ll notice that there will be a higher AAS on the Top Activity Page compared to Performance Page. Simply because ASH samples every second and it does that quickly on every active session (the only way to see CPU usage realtime) while the time model CPU although it updates quicker (5secs I think) than v$sysstat “CPU used by this session” there could still be some lag time and it will still be based on Time Statistics (one of two ways to calculate AAS) which could be affected by averages."
<<<
I'll expound on that with test cases included.. ''see below!''

!
! AAS behavior on an IO bound load
* This is the graph of an IO bound load using ASH Viewer, this will be similar to the graph you will see on ''real time'' view of the Enterprise Manager 11g
<<<
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TZ9Cp2Kc8aI/AAAAAAAABN0/1konJAJZMUo/highio-3.png]]
[img[picturename| https://lh4.googleusercontent.com/_F2x5WXOJ6Q8/TZt3yMWQUCI/AAAAAAAABLM/8d-I2RqvF3I/AASIObound.png]]
<<<
* This is the graph of the same workload using MS Excel and the script awr_topevents.sql, this will be the similar graph you will see on the ''historical'' view of the Enterprise Manager 11g
<<<
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TZ9FJ6cXxRI/AAAAAAAABN4/eWRs8SQd0ws/highio-4.png]]
<<<

As you can see from the images above and the numbers below.. the database is doing a lot of ''direct path read'' and we don't have a high load average. Although when you look at the OS statistics, from this IO intensive workload you will see high IO WAIT from the CPU.

Looking at the data below from AWR and ASH.. ''we see no discrepancies''.. now, let's compare this to the workload below where the database server is CPU bound and has a really high load average. 

''AAS Data from AWR''
<<<
[img[picturename| https://lh4.googleusercontent.com/_F2x5WXOJ6Q8/TZ8-nKFw2pI/AAAAAAAABNk/oozsoEgnmeE/highio-1.png]]
<<<

''AAS Data from ASH''
<<<
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TZ8-nFhmP7I/AAAAAAAABNo/x5kIF-HuhnY/highio-2.png]]
<<<

!
! AAS behavior on a CPU bound load

This is the Enterprise Manager 11g graph of a CPU bound load 
<<<
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZt8ZxUeEUI/AAAAAAAABLY/gmclSmutRVg/AASCPUbound.png]]
<<<
This is the ASH Viewer graph of a CPU bound load 
* The dark green color you see below (18:30 - 22:00) is actually the ''CPU Wait'' metric that you are seeing on the Enterprise Manager graph above
* The light green color on the end part of the graph (22:00) is the ''Scheduler wait - resmgr: cpu quantum'' 
* The small hump on the 16:30-17:30 time frame is the IO bound load test case
<<<
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TZ6emvgui7I/AAAAAAAABNI/fxVzQryIwKc/highcpu-4.png]]
<<<
Below are the data from AWR and ASH of the same time period ''(21:50 - 22:00)''.. see the high level and drill down numbers below 
... it seems like if the database server is ''high on CPU/high on runqueue'' or the ''"wait for CPU"'' appears.. then the AAS numbers from the AWR and ASH reports don't match anymore but I would expect ASH to be bigger because it has fine grained samples of 1 second. But as you can see (below).. 
* the ASH top events correctly accounted the CPU time ''(95.37 AAS)'' which was tagged as ''CPU + Wait  for CPU''
* while the AWR CPU seems to be idle ''(.2 AAS)''. 
And what's even more interesting is 
* the high level AAS on AWR is ''356.7'' 
* while on the ASH it is ''329.18'' 
that's a huge gap! Well that could be because of 
* the high DB Time ''(215947.8)'' on AWR 
* compared to what Sample Count ASH has ''(197510)''. 
Do you have any idea why is this happening? Interesting right? 

''AAS Data from AWR''
<<<
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZ6BdKu23hI/AAAAAAAABMw/Nuwg_qTt6m8/highcpu-1.png]]

[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZ6BdrU46FI/AAAAAAAABM4/6Inv_8_Z5dc/highcpu-2.png]]
<<<

''AAS Data from ASH''
<<<
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TZ8rp2UTbWI/AAAAAAAABNg/6VBzvJxxApM/highcpu-3.png]]
<<<

''A picture is worth a thousand words...'' - To clearly explain this behavior of ''CPU not properly accounted'' I'll show you the graph of the data samples

__''AWR Top Events with CPU "not properly" accounted''__
<<<
* This is the high level AAS we are getting from the ''DB Time/Elapsed Time'' from the AWR report across SNAP_IDs.. this output comes from the script ''awr_genwl.sql'' (AAS column - http://goo.gl/MUWr) notice that there are AAS number as high as 350 and above.. the second occurence of 350+ is from the SNAP_ID 495-496 mentioned above..
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZ61tG_iQ0I/AAAAAAAABNY/iKAy7j4Y534/highcpu-5.png]]
* Drilling down on the AAS components of that high level AAS we have to graph the output of the ''awr_topevents.sql''... given that this is still the same workload, you see here that only the ''Direct Path Read'' is properly accounted and when you look at the CPU time it seems to be idle... thus, giving lower AAS than the image above..
* Take note that SNAP_ID 495 the AWR ''CPU'' seems to be idle (.2 AAS) which is what is happening on this image
* Also on the 22:00 period, the database stopped waiting on CPU and started to wait on ''Scheduler''.. and then it matched again the high level AAS from the image above (AAS range of 320).. Interesting right? 
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZ53u_cLWLI/AAAAAAAABMY/9QP2C4S7AUI/highcpu-6.png]]
* We will also have this same behavior on Enterprise Manager 11g when we go to the ''Top Activity page'' and change the ''Real Time'' to ''Historical''... see the similarities on the graph from MS Excel? So when you go ''Real Time'' you are actually pulling from ASH.. then when you go ''Historical'' you are just pulling the Top Timed events across SNAP_IDs and graphing it.. but when you have issues like CPU time not properly accounted you'll see a really different graph and if you are not careful and don't know what it means you may end up with bad conclusions.. 
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TZ6fz5UzkVI/AAAAAAAABNM/9xL8IukSM4A/highcpu-10.png]]
<<<

__''AWR Top Events with CPU "properly" accounted''__
<<<
* Now, this is really interesting... the graph shown below is from the ''Performance page'' and is also ''Historical'' but produced a different graph from the ''Top Activity page''... 
* Why and how did it account for the ''CPU Wait''? where did it pull the data that the ''Top Activity page'' missed? 
* This is an improvement in the Enterprise Manager! So I'm curious how is this happening...
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TZ6ogMsAp0I/AAAAAAAABNQ/b9dTIxATxoY/highcpu-11.png]]
<<<

__''ASH with CPU "properly" accounted (well.. I say, ALWAYS!)''__

From the graph above & below where the CPU is properly accounted, you see the AAS is consistent at the range of 320.. 
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TZ53uvK1xkI/AAAAAAAABMU/7HThzn4uoEo/highcpu-7.png]]
What makes ASH different is the proper accounting of the ''CPU'' AAS component unlike the chart coming from awr_topevents.sql (mentioned on the AWR Top Events with CPU "not properly" accounted) where there's no CPU accounted at all... this could be the problem of DBA_HIST_SYS_TIME_MODEL - ''DB CPU'' metric that when the database server is high on runqueue and there are already scheduling issues in the OS the ''ASH is even more reliable'' on accounting all the CPU time.. 

Another thing that bothers me is why is it that the ''DB Time'' when applied to the AAS formula gives much higher AAS value than of the ASH? so that could also mean that ''the DB Time is another reliable source'' if the database server is high on runqueue.. 

If this is the case, from a pure AWR perspective... what I would do is have the output of ''awr_genwl.sql''.. then run the ''awr_topevents.sql''.. 
and then if I would see that my AAS is high on awr_genwl.sql with a really high "OS Load" and "CPU Utilization" and then if I compare it with the output of awr_topevents.sql and see a big discrepancy that would give me an idea that I'm experiencing the same issue mentioned here, and I would investigate further with the ASH data to solidify my conclusions.. 

If you are curious about the output of Time model statistics on SNAP_ID 495-496
the CPU values found here does not help either because they have low values..

{{{
   DB CPU = 126.70 sec
   BG CPU = 4.32 sec
   OS CPU (osstat) = 335.71 sec

Statistic Name                                       Time (s) % of DB Time
------------------------------------------ ------------------ ------------
sql execute elapsed time                            215,866.2        100.0
DB CPU                                                  126.7           .1
parse time elapsed                                       62.8           .0
hard parse elapsed time                                  60.0           .0
PL/SQL execution elapsed time                            33.9           .0
hard parse (sharing criteria) elapsed time                9.7           .0
sequence load elapsed time                                0.6           .0
PL/SQL compilation elapsed time                           0.2           .0
connection management call elapsed time                   0.0           .0
repeated bind elapsed time                                0.0           .0
hard parse (bind mismatch) elapsed time                   0.0           .0
DB time                                             215,947.9
background elapsed time                               1,035.5
background cpu time                                       4.3
          -------------------------------------------------------------
}}}

''Now we move on by splitting the ASH AAS components into their separate areas..''
* the ''CPU'' 
* and ''USER IO'' 
see the charts below.. 

This just shows that there is something about ASH properly accounting the ''CPU + WAIT FOR CPU'' whenever the database server is high on runqueue or OS load average... as well as the ''DB Time''
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TZ53wDeLd4I/AAAAAAAABMc/G5lodk6IAqE/highcpu-8.png]]
this is the ''USER IO'' AAS.. same as what is accounted in awr_topevents.sql
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TZ53wKTIMVI/AAAAAAAABMg/dAihs-LYGfY/highcpu-9.png]]


So the big question for me is...

How does ASH and the Enterprise Manager performance page account for the "CPU + WAIT FOR CPU"? even if you drill down on the V$ACTIVE_SESSION_HISTORY you will not find this metric. So I'm really interested on where they pull the data.. :)


''update''... and then I asked a couple of people, and I had a recent problem on a client site running on Exadata where I was troubleshooting their ETL runs. I was running 10046 for every run and found out that my unaccounted-for time is due to the CPU wait that is shown on this tiddler. So using Mr. Tools, and given that I'm having a similar workload.. I had an idea that the unaccounted-for time is the CPU wait. See the write up here http://www.evernote.com/shard/s48/sh/3ccc1e38-b5ef-46f8-bc75-371156ade4b3/69066fa2741f780f93b86af1626a1bcd , and I was right all along ;)


''AAS investigation updates:  Answered questions + bits of interesting findings''
http://www.evernote.com/shard/s48/sh/b4ecaaf2-1ceb-43ea-b58e-6f16079a775c/cb2e28e651c3993b325e66cc858c3935


''I've updated the awr_topevents.sql script to show CPU wait to solve the unnaccounted DB Time issue'' see the write up on the link below:
awr_topevents_v2.sql - http://www.evernote.com/shard/s48/sh/a64a656f-6511-4026-be97-467dccc82688/de5991c75289f16eee73c26c249a60bf



Thanks to the following people for reading/listening about this research, and for the interesting discussions and ideas around this topic: 
- Kyle Hailey, Riyaj Shamsudeen, Dave Abercrombie, Cary Millsap, John Beresniewicz


''Here's the MindMap of the AAS investigation'' http://www.evernote.com/shard/s48/sh/90cdf56f-da52-4dc5-91d0-a9540905baa6/9eb34e881a120f82f2dab0f5424208bf




http://www.evernote.com/shard/s48/sh/a0875f07-26e6-4ec7-ab31-2d946925ef73/6d2fe9d6adc6f716a40ec87e35a0b264
https://blogs.oracle.com/RobertGFreeman/entry/exadata_support_for_acfs_and
Atomic - they all complete successfully, or not at all
Consistent - integrity rules
Isolated - locking
Durable - transaction is guaranteed
{{{
connect / as sysdba

set serveroutput on

show user;

create or replace procedure mailserver_acl(
  aacl       varchar2,
  acomment   varchar2,
  aprincipal varchar2,
  aisgrant   boolean,
  aprivilege varchar2,
  aserver    varchar2,
  aport      number)
is
begin  
  begin
    DBMS_NETWORK_ACL_ADMIN.DROP_ACL(aacl);
     dbms_output.put_line('ACL dropped.....'); 
  exception
    when others then
      dbms_output.put_line('Error dropping ACL: '||aacl);
      dbms_output.put_line(sqlerrm);
  end;
  begin
    DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(aacl,acomment,aprincipal,aisgrant,aprivilege);
    dbms_output.put_line('ACL created.....'); 
  exception
    when others then
      dbms_output.put_line('Error creating ACL: '||aacl);
      dbms_output.put_line(sqlerrm);
  end;  
  begin
    DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(aacl,aserver,aport);
    dbms_output.put_line('ACL assigned.....');         
  exception
    when others then
      dbms_output.put_line('Error assigning ACL: '||aacl);
      dbms_output.put_line(sqlerrm);
  end;    
  commit;
  dbms_output.put_line('ACL commited.....'); 
end;
/
show errors



select acl, host, lower_port, upper_port from dba_network_acls

ACL                                      HOST                           LOWER_PORT UPPER_PORT
---------------------------------------- ------------------------------ ---------- ----------
/sys/acls/IFSAPP-PLSQLAP-Permission.xml  haiapp09.mfg.am.mds.       59080      59080

 select acl, principal, privilege, is_grant from dba_network_acl_privileges

ACL                                      PRINCIPAL                      PRIVILE IS_GR
---------------------------------------- ------------------------------ ------- -----
/sys/acls/IFSAPP-PLSQLAP-Permission.xml  IFSAPP                         connect true
/sys/acls/IFSAPP-PLSQLAP-Permission.xml  IFSSYS                         connect true



begin
  mailserver_acl(
    '/sys/acls/IFSAPP-PLSQLAP-Permission.xml',
    'ACL for used Email Server to connect',
    'IFSAPP',
    TRUE,
    'connect',
    'haiapp09.mfg.am.mds.',
    59080);    
end;
/


begin
   DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('/sys/acls/IFSAPP-PLSQLAP-Permission.xml','IFSSYS',TRUE,'connect');
   commit;
end;
/
}}}
{{{

Summary:
> Implement Instance Caging
> Enable Parallel Force Query and Parallel Statement Queuing  
> A database trigger has to be created on the Active Data Guard for all databases to enable Parallel Force Query on the session level upon login
> Create a new Resource Management Plan to limit the per session parallelism to 4
> Enable IORM and set to objective of AUTO on the Storage Cells

Commands to implement the recommended changes:
> The numbers 1 and 2 need to be executed on each database of the Active Data Guard environment
> #3 needs to be executed on all the Storage Cells, use the dcli and execute only on the 1st storage cell if passwordless ssh is configured
> #4 needs to be executed on each database (ECC, EWM, GTS, APO) of the Primary site to create the new Resource Management Plan
> #5 needs to be executed on each database of the Active Data Guard environment to activate the Resource Management Plan

The behavior:
        instance caging is set to CPU_COUNT of 40 (83% max CPU utilization)	
	parallel 4 will be set to all users logged in as ENTERPRISE, no need for hints	
	although the hints override the session settings, the non-ENTERPRISE users will be throttled on the resource management layer to PX of 4 even if hints are set	
		RM plan has PX limit of 4 for other_groups 
		We can set a higher limit (let's say 8) for the ENTERPRISE users so they can override the PX 4 to a higher value through hints
	this configuration will be done on all 4 databases 	
		
Switchover steps - just in case the 4 DBs will switchover to Exadata:
	disable the px trigger	
	alter the resource plan to SAP primary	


######################################################################

1) instance caging 

alter system set cpu_count=40 scope=both sid='*';
alter system set resource_manager_plan=default_plan; 

2) statement queueing and create trigger

alter system set parallel_force_local=false scope=both sid='*';
alter system set parallel_max_servers=128 scope=both sid='*';
alter system set parallel_servers_target=64 scope=both sid='*';
alter system set parallel_min_servers=64 scope=both sid='*';
alter system set "_parallel_statement_queuing"=true scope=both sid='*';

-- alter trigger sys.adg_pxforce_trigger disable;

-- the trigger checks if ENTERPRISE user is logged on, if it's running as PHYSICAL STANDBY, and if it's running on X4DP cluster

CREATE OR REPLACE TRIGGER adg_pxforce_trigger
AFTER LOGON ON database
WHEN (USER in ('ENTERPRISE'))
BEGIN
IF (SYS_CONTEXT('USERENV','DATABASE_ROLE') IN ('PHYSICAL STANDBY'))
AND (UPPER(SUBSTR(SYS_CONTEXT ('USERENV','SERVER_HOST'),1,4)) IN ('X4DP'))
THEN
execute immediate 'alter session force parallel query parallel 4';
END IF;
END;
/


3) IORM AUTO

-- execute on each storage cell
cellcli -e list iormplan detail
cellcli -e alter iormplan objective = auto
cellcli -e alter iormplan active

-- use these commands if passwordless ssh is configured 
dcli -g ~/cell_group -l root 'cellcli -e list iormplan detail'
dcli -g ~/cell_group -l root 'cellcli -e alter iormplan objective = auto'
dcli -g ~/cell_group -l root 'cellcli -e alter iormplan active'

######################################################################

4) RM plan to be created on the primary site


exec DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA;

BEGIN
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_PLAN(PLAN => 'px_force', COMMENT => 'force parallel query parallel 4');
DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'CG_ENTERPRISE',    COMMENT => 'CG for ENTERPRISE users');
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN =>'px_force', GROUP_OR_SUBPLAN => 'CG_ENTERPRISE', COMMENT => 'Directive for ENTERPRISE users', PARALLEL_DEGREE_LIMIT_P1 => 4);
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN =>'px_force', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'Low priority users', PARALLEL_DEGREE_LIMIT_P1 => 4);
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
/ 

begin
 dbms_resource_manager_privs.grant_switch_consumer_group(grantee_name => 'ENTERPRISE',consumer_group => 'CG_ENTERPRISE', grant_option => FALSE);
end;
/ 

begin
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.SET_INITIAL_CONSUMER_GROUP ('ENTERPRISE', 'CG_ENTERPRISE');
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
/


-- check config 

set wrap off
set head on
set linesize 300
set pagesize 132
col comments format a64

-- show current resource plan
select * from  V$RSRC_PLAN;

-- show all resource plans
select PLAN,NUM_PLAN_DIRECTIVES,CPU_METHOD,substr(COMMENTS,1,64) "COMMENTS",STATUS,MANDATORY 
from dba_rsrc_plans 
order by plan;

-- show consumer groups
select CONSUMER_GROUP,CPU_METHOD,STATUS,MANDATORY,substr(COMMENTS,1,64) "COMMENTS" 
from DBA_RSRC_CONSUMER_GROUPS 
order by consumer_group;

-- show  category
SELECT consumer_group, category
FROM DBA_RSRC_CONSUMER_GROUPS
ORDER BY category;

-- show mappings
col value format a30
select ATTRIBUTE, VALUE, CONSUMER_GROUP, STATUS 
from DBA_RSRC_GROUP_MAPPINGS
order by 3;

-- show mapping priority 
select * from DBA_RSRC_MAPPING_PRIORITY;

-- show directives 
SELECT plan,group_or_subplan,cpu_p1,cpu_p2,cpu_p3, PARALLEL_DEGREE_LIMIT_P1, status 
FROM dba_rsrc_plan_directives 
order by 1,3 desc,4 desc,5 desc;

-- show grants
select * from DBA_RSRC_CONSUMER_GROUP_PRIVS order by grantee;
select * from DBA_RSRC_MANAGER_SYSTEM_PRIVS order by grantee;

-- show scheduler windows
select window_name, resource_plan, START_DATE, DURATION, WINDOW_PRIORITY, enabled, active from dba_scheduler_windows;


5) enforce on the standby site
connect / as sysdba
--ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = 'FORCE:px_force';



-- revert
connect / as sysdba
exec DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA;

ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = 'default_plan';

BEGIN
  DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
  DBMS_RESOURCE_MANAGER.DELETE_PLAN_CASCADE ('px_force');
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
/
}}}



https://wiki.archlinux.org/index.php/AHCI
http://en.wikipedia.org/wiki/AHCI
http://en.wikipedia.org/wiki/NCQ

Disks from the Perspective of a File System - TCQ,NCQ,4KSectorSize,MRAM http://goo.gl/eWUK7
{{{

Logical Partitioning (LPAR) in AIX
  	Doc ID: 	Note:458571.1


-- INSTALLATION

Minimum Software Versions and Patches Required to Support Oracle Products on IBM pSeries
 	Doc ID:	Note:282036.1

Additional Steps Required To Upgrade IBM JDK On IBM iSeries
 	Doc ID:	Note:457287.1

Questions regarding Oracle database upgrades on AIX
 	Doc ID:	Note:223521.1

PAR: MATRIX IBM AIX for Oracle RDBMS Compatibility
 	Doc ID:	Note:41984.1

http://www-933.ibm.com/eserver/support/fixes/fixcentral/pfixpacks/53



-- BUG on 10.2.0.2 and ML 05 and higher

http://unix.derkeiler.com/Mailing-Lists/AIX-L/2006-09/msg00030.html
http://www.tek-tips.com/viewthread.cfm?qid=1272346&page=7

-- IY fix
ftp://ftp.software.ibm.com/aix/efixes/iy89080/

-- one-of-patch download
https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5496862&release=80102020&plat_lang=212P&patch_num_id=747092&email=karao@sqlwizard.com&userid=ml-591048.992&

Bug 5496862 - AIX: Mandatory patch to use Oracle with IBM Technology Level 5 (5300-5)
 	Doc ID:	Note:5496862.8

Introduction to "Bug Description" Articles
 	Doc ID:	Note:245840.1

10.2.0.3 PMON CRASHES ON STARTUP ON AIX 5L 5.3 ML05 -- WORKS on ML06
 	Doc ID:	Note:458442.1

Does A DB Running Oracle 10.2.0.2 On Aix 5.3 Tl5 Sp1 Have To Use Patch 5496862
 	Doc ID:	Note:432998.1

Is Patch 5496862 Mandatory for 10.2.0.3?
 	Doc ID:	Note:418105.1

How To Determine Whether an APAR has been Fixed in AIX Version/Maintenance Level
 	Doc ID:	Note:417451.1

How To Determine Service Pack in AIX
 	Doc ID:	Note:421513.1

How Do I Determine The AIX Technology level ?
 	Doc ID:	Note:443343.1

Is Patch 5496862 applicable on AIX 5.3 TL 06 / TL 07 / TL 08 ?
 	Doc ID:	Note:443944.1

How To Determine Whether an APAR has been Fixed in AIX Version/Maintenance Level
 	Doc ID:	Note:417451.1

Is Patch 5496862 Mandatory for 10.2.0.3?
 	Doc ID:	Note:418105.1

How Do I Determine The AIX Technology level ?
 	Doc ID:	Note:443343.1

ORA-01115 ORA-01110 ORA-27091 ORA-27072 Error: 5: I/O error
 	Doc ID:	Note:559697.1

IO Interoperability Issue between IBM ML05 and Oracle Databases
 	Doc ID:	Note:390656.1

Patch 5496862 Now Available For RDBMS Server Version 10.1.0.4.2 (AIX)
 	Doc ID:	Note:418048.1



-- DYNAMIC CPU ALLOCATION BUG

http://oracledoug.com/serendipity/index.php?/archives/1318-10.2.0.2-bug-with-Dynamic-Reconfiguration-of-CPU.html

Bug 4704890 - OERI[kslgetl:1] after adding CPU using dynamic reconfiguration
  	Doc ID: 	Note:4704890.8

Pmon Terminated With Ora-00600 [1100] After Dynamically Increase CPU_COUNT
  	Doc ID: 	Note:467695.1

ORA-600 [kslgetl:1]
  	Doc ID: 	Note:351779.1

Ora-07445 (Internal Error)
  	Doc ID: 	Note:421045.1

Ora-600 [Kslgetl:1] when dynamically changing CPU
  	Doc ID: 	Note:369400.1




-- MEMORY

Memory Consumption on AIX
  	Doc ID: 	259983.1

}}}
Power5
Power6	<-- most advanced processor, starting clock is 4Ghz
Power7	

Hardware Virtualization (LPAR)
1) Standard Partition 
	4 LPARs, each have its own dedicated resources (processor, memory)

2) Micropartition
	4 LPARs can utilize a pool of 8 processors
	2 LPARs can utilize 1 processor


Note:
- Dynamic allocation can happen, 
	CPU	5seconds
	Memory	1minute
http://www.oraclerant.com/?p=8
{{{
# Oracle Database environment variables
umask 022
export ORACLE_BASE='/oracle/app/oracle'
export ORACLE_HOME="${ORACLE_BASE}/product/10.2.0/db_1"
export AIXTHREAD_SCOPE=S
export PATH="${ORACLE_HOME}/OPatch:${ORACLE_HOME}/bin:${PATH}"
# export NLS_LANG=language_territory.characterset
export LIBPATH=$ORACLE_HOME/lib:$LIBPATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
}}}
http://www.scribd.com/doc/2153747/AIX-EtherChannel-Load-Balancing-Options
http://gjilevski.wordpress.com/2009/12/13/hardware-solution-for-oracle-rac-11g-private-interconnect-aggregating/
http://www.freelists.org/post/oracle-l/Oracle-10g-R2-RAC-network-configuration
! show system configuration
<<<
* show overall system config
{{{
prtconf
}}}
* to give the highest installed maintenance level
{{{
$ oslevel -r
6100-05
}}}
* to give the known recommended ML
{{{
$ oslevel -rq
Known Recommended Maintenance Levels
------------------------------------
6100-06
6100-05
6100-04
6100-03
6100-02
6100-01
6100-00
}}}
* To show you Service Packs levels as well 
{{{
$ oslevel -s
6100-05-03-1036
}}}
* amount of real memory 
{{{
lsattr -El sys0 -a realmem
realmem 21757952 Amount of usable physical memory in Kbytes False
}}}
* Displays the system model name. For example, IBM, 9114-275
{{{
uname -M

-- on p6
IBM,8204-E8A

-- on p7
IBM,8205-E6C
}}}
<<<

! get CPU information
* get number of CPUs
{{{
lscfg | grep proc

-- on p6
+ proc0                                                      Processor
+ proc2                                                      Processor
+ proc4                                                      Processor
+ proc6                                                      Processor
+ proc8                                                      Processor
+ proc10                                                     Processor
+ proc12                                                     Processor
+ proc14                                                     Processor

-- on p7
+ proc0                                                                          Processor
+ proc4                                                                          Processor
}}}
* get CPU speed
{{{
lsattr -El proc0

-- on p6
frequency   4204000000     Processor Speed       False
smt_enabled true           Processor SMT enabled False
smt_threads 2              Processor SMT threads False
state       enable         Processor state       False
type        PowerPC_POWER6 Processor type        False

-- on p7
frequency   3550000000     Processor Speed       False
smt_enabled true           Processor SMT enabled False
smt_threads 4              Processor SMT threads False
state       enable         Processor state       False
type        PowerPC_POWER7 Processor type        False
}}}

{{{

# lsdev -Cc processor
proc0  Available 00-00 Processor
proc2  Available 00-02 Processor
proc4  Available 00-04 Processor
proc6  Available 00-06 Processor
proc8  Available 00-08 Processor
proc10 Available 00-10 Processor
Which says 6 processors but the following command shows it is only a single 6-way card:
lscfg -vp |grep -ip proc |grep "PROC"
    6 WAY PROC CUOD :
    
The problem seems to revolve around what is a cpu these days, is it a chip or a core or a single piece of a silicone wafer and whatever resides on that being counted as 1 or many.
IBM deem a core to be a CPU so they would say your system has 6 processors.
They are all on one card and may all be in one MCM / chip or there may be several MCMs / chips on that card but you have a 6 CPU system there.
lsdev shows 6 processors so AIX has configured 6 processors.
lscfg shows it is a CUoD 6 processor system and as AIX has configured all 6 it shows all 6 are activated by a suitable POD code.
The Oracle wiki at orafaq.com shows Oracle licence the Standard Edition by CPU (definition undefined) and Enterprise by core (again undefined).
http://www.orafaq.com/wiki/Oracle_Licensing
What ever you call a cpu or a core I would say you have a 6 way / 6 processor system there and the fact that all 6 may or may not be on one bit of silicone wafer will not make any difference.

#############################################################################

get number of processors, its name, physical location, Lists all processors
odmget -q"PdDvLn LIKE processor/*" CuDv

list specific processor, but it is more about Physical location etc, nothing about single/dual core etc
odmget -q"PdDvLn LIKE processor/* AND name=proc0" CuDv

#############################################################################

I've checked is on LPARs on two servers - p55A and p570 - both servers 8 CPUs and seems that in p55A there are 2 4-core CPUs and in 570 4 2-core CPUs.

$ lsattr -El sys0 -a modelname
modelname IBM,9133-55A Machine name False
$ lparstat -i|grep ^Active\ Phys
Active Physical CPUs in system : 8
$ lscfg -vp|grep WAY
4-WAY PROC CUOD :
4-WAY PROC CUOD :
$ lscfg -vp|grep proc
proc0 Processor
proc2 Processor
proc4 Processor
proc6 Processor
$

$ lsattr -El sys0 -a modelname
modelname IBM,9117-570 Machine name False
$ lparstat -i|grep ^Active\ Phys
Active Physical CPUs in system : 8
$ lscfg -vp|grep WAY
2-WAY PROC CUOD :
2-WAY PROC CUOD :
2-WAY PROC CUOD :
2-WAY PROC CUOD :
$ lscfg -vp|grep proc
proc0 Processor
proc2 Processor
proc4 Processor
proc6 Processor
$

#############################################################################

p550 with 2 quad-core processors (no LPARs):

/ #>lsattr -El sys0 -a modelname
modelname IBM,9133-55A Machine name False

/ #>lparstat -i|grep Active\ Phys
Active Physical CPUs in system : 8

/ #>lscfg -vp | grep WAY
2-WAY PROC CUOD :
2-WAY PROC CUOD :

/ #>lscfg -vp |grep proc
proc0 Processor
proc2 Processor
proc4 Processor
proc6 Processor
proc8 Processor
proc10 Processor
proc12 Processor
proc14 Processor

And the further detailed lscfg -vp output shows:
2-WAY PROC CUOD :
Record Name.................VINI
Flag Field..................XXPF
Hardware Location Code......U787B.001.DNWC2F7-P1-C9
Customer Card ID Number.....8313
Serial Number...............YL10HA68E008
FRU Number..................10N6469
Part Number.................10N6469
As you can see, the part number is 10N6469, which clearly is a quad-core cpu:
http://www.searchlighttech.com/searchResults.cfm?part=10N6469

#############################################################################

Power5 and Power6 processors are both Dual Core - Dual Threads.
The next Power7 should have 8 cores and each core can execute 4 threads (comes 2010) but less frequency (3.2Ghz max instead of 5.0Ghz on the power6).

#############################################################################

To get the information about the partition, enter the following command:
lparstat -i

#############################################################################

 lparstat -i
 lparstat
 lscfg | grep proc
 lsattr -El proc0
 uname -M
 lsattr -El sys0 -a realmem
 lscfg | grep proc
 lsdev -Cc processor
 lscfg -vp |grep -ip proc |grep "PROC"
 odmget -q"PdDvLn LIKE processor/*" CuDv
 odmget -q"PdDvLn LIKE processor/* AND name=proc0" CuDv
 odmget -q"PdDvLn LIKE processor/* AND name=proc14" CuDv
 lsattr -El sys0 -a modelname
 lparstat -i|grep ^Active\ Phys
 lscfg -vp|grep WAY
 lscfg -vp|grep proc
 lsattr -El sys0 -a modelname
 lparstat -i|grep Active\ Phys
 lscfg -vp | grep WAY
 lscfg -vp |grep proc
 lscfg -vp

#############################################################################

So the physical CPUs of the AIX box is 8… now it’s a bit tricky to get the real CPU% in AIX.. 
First you have to determine the CPUs of the machine

$ prtconf
System Model: IBM,8204-E8A
Machine Serial Number: 10F2441
Processor Type: PowerPC_POWER6
Processor Implementation Mode: POWER 6
Processor Version: PV_6_Compat
Number Of Processors: 8
Processor Clock Speed: 4204 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 2 nad0019aixp21
Memory Size: 21248 MB
Good Memory Size: 21248 MB
Platform Firmware level: Not Available
Firmware Version: IBM,EL350_132
Console Login: enable
Auto Restart: true
Full Core: false

Then, execute the lparstat… 
•	The ent 2.30 is the entitled CPU capacity
•	The psize is the # of physical CPUs on the shared pool
•	The physc 4.42 means that the CPU usage went above the entitled capacity because it is “Uncapped”.. so to get the real CPU% just do a 4.42/8 = 55% utilization
•	55% utilization could either be applied on the 8Physical CPUs or 16 Logical CPUs… because that’s just the percentage used so I just put on the prov worksheet 60% 

$ lparstat 1 10000

System configuration: type=Shared mode=Uncapped smt=On lcpu=16 mem=21247 psize=8 ent=2.30

%user  %sys  %wait  %idle physc %entc  lbusy  vcsw phint
----- ----- ------ ------ ----- ----- ------ ----- -----
 91.4   7.6    0.8    0.3  3.94 171.1   29.9  4968  1352
 92.0   6.9    0.7    0.4  3.76 163.4   26.2  4548  1054
 93.1   6.0    0.5    0.3  4.42 192.3   33.2  4606  1316
 91.3   7.5    0.7    0.5  3.74 162.6   25.6  5220  1191
 93.4   5.7    0.6    0.3  4.07 176.9   28.7  4423  1239
 93.1   6.0    0.6    0.4  4.05 176.0   29.4  4709  1164
 92.3   6.7    0.6    0.5  3.46 150.2   24.8  4299   718
 92.2   6.9    0.6    0.4  3.69 160.6   27.9  4169   973
 91.9   7.3    0.5    0.3  4.06 176.5   33.2  4248  1233
}}}



! install IYs
{{{
To list all IYs
# instfix –i | pg
To show the filesets on a given IY
# instfix –avik IY59135
To commit a fileset
# smitty maintain_software
To list the fileset of an executable
# lslpp –w <full path of the executable>
To install an IY
# Uncompress <file>
# Tar –xvf <file>
# inutoc .
# smity installp
}}}


! iostat

{{{
> iostat -sl

System configuration: lcpu=4 drives=88 ent=0.20 paths=176 vdisks=8

tty:      tin         tout    avg-cpu: % user % sys % idle % iowait physc % entc
          0.3         29.5               64.5  28.6    5.1      1.9   0.9  435.5

System: 
                           Kbps      tps    Kb_read   Kb_wrtn
                         30969.7     429.9   937381114927  200661442300

Disks:        % tm_act     Kbps      tps    Kb_read   Kb_wrtn
hdisk0           1.3      61.9       7.6   1479300432  794583660
...

> iostat -st

System configuration: lcpu=4 drives=88 ent=0.20 paths=176 vdisks=8

tty:      tin         tout    avg-cpu: % user % sys % idle % iowait physc % entc
          0.3         29.5               64.5  28.6    5.1      1.9   0.9  435.5

System: 
                           Kbps      tps    Kb_read   Kb_wrtn
                         30969.7     429.9   937381298349  200661442605

}}}

{{{
$ iostat -DRTl 10 100

System configuration: lcpu=16 drives=80 paths=93 vdisks=2

Disks:                     xfers                                read                                write                                  queue                    time
-------------- -------------------------------- ------------------------------------ ------------------------------------ -------------------------------------- ---------
                 %tm    bps   tps  bread  bwrtn   rps    avg    min    max time fail   wps    avg    min    max time fail    avg    min    max   avg   avg  serv
                 act                                    serv   serv   serv outs              serv   serv   serv outs        time   time   time  wqsz  sqsz qfull
hdisk3           0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk13          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk15         61.5   3.3M 162.0   3.2M  90.2K 158.4   6.4    0.2   60.0     0    0   3.5   3.3    0.7    4.6     0    0   0.5    0.0   15.7    0.0   0.1  53.6  16:05:30
hdisk14         67.3   3.4M 166.2   3.3M  67.7K 162.3   7.2    0.2   71.8     0    0   3.9   2.8    0.8    5.7     0    0   1.0    0.0   36.0    0.0   0.1  63.0  16:05:30
hdisk8          58.9   3.0M 165.2   2.9M 112.8K 160.6   5.6    0.2   57.1     0    0   4.6   3.0    0.6    5.5     0    0   0.4    0.0   18.8    0.0   0.1  43.2  16:05:30
hdisk12         57.6   3.4M 151.3   3.3M  91.8K 147.4   6.0    0.2   54.7     0    0   3.9   3.1    0.6    4.7     0    0   0.5    0.0   23.4    0.0   0.1  43.6  16:05:30
hdisk11          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk10         86.0   2.9M 144.9   2.9M  58.0K 141.4  12.7    0.3  109.3     0    0   3.5   2.8    0.8    5.1     0    0   5.3    0.0   82.6    0.0   0.1  86.2  16:05:30
hdisk9           0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk16          0.1 402.8    0.1   0.0  402.8    0.0   0.0    0.0    0.0     0    0   0.1   8.8    8.8    8.8     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk5           0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk18          1.3 391.7K  17.1   0.0  391.7K   0.0   0.0    0.0    0.0     0    0  17.1   1.0    0.5    6.2     0    0   0.0    0.0    0.1    0.0   0.0   0.1  16:05:30
hdisk7           0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk4          43.7   3.2M 150.8   3.2M  67.7K 147.0   4.0    0.3   27.6     0    0   3.8   2.9    0.7    5.0     0    0   0.3    0.0   19.4    0.0   0.0  26.1  16:05:30
hdisk17          0.3   1.2K   0.3   0.0    1.2K   0.0   0.0    0.0    0.0     0    0   0.3   7.2    5.3    8.2     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk6          67.8   3.0M 151.8   2.9M  45.1K 149.1   7.6    0.2   58.4     0    0   2.8   2.8    0.7    4.6     0    0   0.5    0.0   27.1    0.0   0.1  51.6  16:05:30
hdisk21          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk27          0.4   1.2K   0.3   0.0    1.2K   0.0   0.0    0.0    0.0     0    0   0.3  16.7    7.7   34.3     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk23         61.3   3.3M 178.8   3.3M  59.6K 175.9   5.8    0.2   63.7     0    0   2.9   2.9    0.8    5.7     0    0   0.8    0.0   61.8    0.0   0.1  57.6  16:05:30
hdisk1          64.5   3.2M 149.7   3.2M  48.3K 146.8   7.0    0.3   45.0     0    0   2.9   2.5    0.9    4.5     0    0   0.7    0.0   46.4    0.0   0.1  42.0  16:05:30
hdisk20         64.8   3.3M 148.6   3.2M  90.2K 145.0   7.1    0.3   52.5     0    0   3.5   2.7    0.9    4.9     0    0   1.0    0.0   41.7    0.0   0.1  49.8  16:05:30
hdisk22          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk28          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk19         42.6   3.5M 162.6   3.4M  68.9K 160.0   3.6    0.2   22.2     0    0   2.7   1.6    0.5    4.3     0    0   0.1    0.0    8.2    0.0   0.0  27.2  16:05:30

Disks:                     xfers                                read                                write                                  queue                    time
-------------- -------------------------------- ------------------------------------ ------------------------------------ -------------------------------------- ---------
                 %tm    bps   tps  bread  bwrtn   rps    avg    min    max time fail   wps    avg    min    max time fail    avg    min    max   avg   avg  serv
                 act                                    serv   serv   serv outs              serv   serv   serv outs        time   time   time  wqsz  sqsz qfull
hdisk0          53.9   3.0M 153.7   3.0M  41.9K 151.1   5.1    0.2   38.4     0    0   2.6   3.0    1.1    4.6     0    0   0.2    0.0   14.7    0.0   0.0  31.7  16:05:30
hdisk26          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk2          63.6   3.2M 144.1   3.2M  64.4K 141.3   7.3    0.2   72.3     0    0   2.8   3.2    0.7    4.5     0    0   0.9    0.0   28.8    0.0   0.1  46.1  16:05:30
hdisk24         56.0   2.9M 139.6   2.8M  77.3K 135.3   6.2    0.2   56.6     0    0   4.3   3.0    1.0    4.7     0    0   0.5    0.0   19.0    0.0   0.1  34.9  16:05:30
hdisk30         65.5   3.3M 156.9   3.2M  70.9K 152.7   7.1    0.3   42.8     0    0   4.2   3.0    0.7    5.6     0    0   0.6    0.0   20.2    0.0   0.1  50.1  16:05:30
hdisk33          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk34          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk37          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk41          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk40         63.5   2.8M 148.2   2.7M 103.1K 143.9   7.0    0.2   42.0     0    0   4.3   2.9    1.0    5.2     0    0   0.8    0.0   19.2    0.0   0.1  49.7  16:05:30
hdisk38         60.6   3.0M 146.1   2.9M  70.9K 142.5   7.0    0.2   64.1     0    0   3.6   2.7    0.8    5.4     0    0   0.8    0.0   24.1    0.0   0.1  45.4  16:05:30
hdisk25          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk35         50.0   4.0M 197.6   3.9M 107.9K 193.2   3.7    0.2   37.7     0    0   4.3   3.0    0.6    5.4     0    0   0.3    0.0   15.2    0.0   0.0  41.9  16:05:30
hdisk32         41.9   3.0M 159.2   3.0M  54.8K 156.0   3.5    0.2   25.7     0    0   3.2   3.4    1.0    4.8     0    0   0.1    0.0   12.6    0.0   0.0  21.7  16:05:30
hdisk36          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk42         79.7   3.0M 159.3   2.9M  83.8K 155.5  10.1    0.2   92.3     0    0   3.8   2.6    0.9    5.3     0    0   2.2    0.0   50.5    0.0   0.1  79.7  16:05:30
hdisk31          3.6   2.1M  52.7   1.7M 391.7K  35.6   0.8    0.2    7.1     0    0  17.1   1.0    0.5    3.4     0    0   0.0    0.0    0.2    0.0   0.0   1.3  16:05:30
hdisk43         42.6   2.9M 144.2   2.8M  64.4K 140.9   4.0    0.2   34.3     0    0   3.2   3.0    1.3    5.4     0    0   0.1    0.0   10.9    0.0   0.0  21.2  16:05:30
hdisk52          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk48         51.2   3.7M 165.5   3.6M  69.3K 161.4   4.6    0.2   31.7     0    0   4.1   3.0    0.6    4.7     0    0   0.3    0.0   12.7    0.0   0.0  35.5  16:05:30
hdisk47          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk44          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk51         50.1   3.7M 187.6   3.6M  90.2K 183.5   3.7    0.2   40.0     0    0   4.1   3.2    1.1    5.0     0    0   0.4    0.0   37.8    0.0   0.0  44.4  16:05:30
hdisk39          0.1  37.7K   3.5  19.3K  18.3K   1.2   0.5    0.3    1.7     0    0   2.4   0.9    0.5    4.6     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30

Disks:                     xfers                                read                                write                                  queue                    time
-------------- -------------------------------- ------------------------------------ ------------------------------------ -------------------------------------- ---------
                 %tm    bps   tps  bread  bwrtn   rps    avg    min    max time fail   wps    avg    min    max time fail    avg    min    max   avg   avg  serv
                 act                                    serv   serv   serv outs              serv   serv   serv outs        time   time   time  wqsz  sqsz qfull
hdisk49          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk57          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk45         51.5   3.0M 154.3   3.0M  54.8K 151.5   4.7    0.2   31.6     0    0   2.8   3.2    1.3    5.1     0    0   0.2    0.0   12.5    0.0   0.0  28.1  16:05:30
hdisk50          7.9   2.1M  50.2   1.7M 391.7K  33.0   2.1    0.3   23.3     0    0  17.1   1.5    0.7   18.3     0    0   0.0    0.0    0.5    0.0   0.0   2.8  16:05:30
hdisk55         64.5   3.7M 169.6   3.6M  72.5K 166.0   6.1    0.2   55.9     0    0   3.6   3.4    0.8    5.2     0    0   0.4    0.0   17.6    0.0   0.1  47.0  16:05:30
hdisk54         66.9   3.6M 165.5   3.5M  80.6K 162.3   6.7    0.3   56.3     0    0   3.2   3.0    0.5    5.0     0    0   0.9    0.0   23.7    0.0   0.1  52.7  16:05:30
hdisk53          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk56         81.9   3.2M 142.5   3.1M  83.8K 138.8  11.6    0.3  117.6     0    0   3.6   3.3    1.1    5.3     0    0   1.9    0.0   42.9    0.0   0.1  72.4  16:05:30
hdisk58         82.2   3.6M 168.2   3.6M  77.3K 164.9   9.9    0.2   84.0     0    0   3.2   2.7    0.6    5.2     0    0   1.9    0.0   45.8    0.0   0.1  88.9  16:05:30
hdisk60          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk29         52.5   3.4M 172.4   3.4M  64.4K 170.1   4.3    0.2   51.9     0    0   2.3   2.6    1.0    5.5     0    0   0.2    0.0   12.5    0.0   0.0  37.1  16:05:30
hdisk59          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk61         46.6   3.0M 157.2   2.9M  58.0K 153.7   4.1    0.2   42.8     0    0   3.5   3.5    1.4    5.3     0    0   0.1    0.0    7.8    0.0   0.0  23.1  16:05:30
hdisk63          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk62         65.5   3.0M 152.3   2.9M  74.1K 148.7   7.4    0.3   66.8     0    0   3.6   2.6    0.8    5.4     0    0   1.0    0.0   43.2    0.0   0.1  56.1  16:05:30
hdisk68          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk65          0.3  19.6K   3.0   1.3K  18.3K   0.6   2.1    0.4    6.6     0    0   2.4   1.2    0.6    2.9     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk64         42.9   3.4M 145.4   3.4M  78.9K 141.5   4.1    0.2   25.1     0    0   3.9   3.0    0.7    5.6     0    0   0.3    0.0   14.5    0.0   0.0  23.7  16:05:30
hdisk67          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk46         66.8   3.4M 165.5   3.3M  93.4K 161.8   6.8    0.2   51.6     0    0   3.7   3.1    0.6    5.0     0    0   0.6    0.0   24.2    0.0   0.1  52.1  16:05:30
hdisk71          1.6 411.0K  18.3  19.3K 391.7K   1.2   0.6    0.3    3.2     0    0  17.1   1.1    0.5    3.1     0    0   0.0    0.0    0.1    0.0   0.0   0.1  16:05:30
hdisk70         61.5   2.7M 135.8   2.7M  62.4K 132.2   7.4    0.2  107.1     0    0   3.6   3.1    0.6    4.9     0    0   0.7    0.0   25.7    0.0   0.1  39.2  16:05:30
hdisk74         86.1   3.6M 182.2   3.5M  69.3K 178.9  10.7    0.2  108.8     0    0   3.3   3.2    0.8    5.3     0    0   4.2    0.0   98.7    0.0   0.1 119.1  16:05:30
hdisk72         58.2   2.5M 130.0   2.5M  80.6K 125.7   7.1    0.3   43.8     0    0   4.3   2.9    1.0    5.3     0    0   0.8    0.0   27.0    0.0   0.1  38.6  16:05:30

Disks:                     xfers                                read                                write                                  queue                    time
-------------- -------------------------------- ------------------------------------ ------------------------------------ -------------------------------------- ---------
                 %tm    bps   tps  bread  bwrtn   rps    avg    min    max time fail   wps    avg    min    max time fail    avg    min    max   avg   avg  serv
                 act                                    serv   serv   serv outs              serv   serv   serv outs        time   time   time  wqsz  sqsz qfull
hdisk75         47.3   3.3M 160.7   3.2M  69.3K 157.1   4.0    0.2   30.9     0    0   3.5   3.2    1.2    5.0     0    0   0.2    0.0   12.7    0.0   0.0  27.9  16:05:30
hdisk78         66.2   3.3M 168.3   3.2M  70.9K 165.5   6.7    0.2   48.5     0    0   2.9   3.8    2.0    5.1     0    0   0.9    0.0   31.5    0.0   0.1  56.3  16:05:30
hdisk69          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk77          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk73          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk76          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
hdisk66          0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
cd0              0.0   0.0    0.0   0.0    0.0    0.0   0.0    0.0    0.0     0    0   0.0   0.0    0.0    0.0     0    0   0.0    0.0    0.0    0.0   0.0   0.0  16:05:30
}}}


''AIX commands you should not leave home without'' http://www.ibm.com/developerworks/aix/library/au-dutta_cmds.html
''AIX system identification'' http://www.ibm.com/developerworks/aix/library/au-aix-systemid.html
''Determining CPU Speed in AIX'' http://www-01.ibm.com/support/docview.wss?uid=isg3T1000107
CPU monitoring and tuning http://www.ibm.com/developerworks/aix/library/au-aix5_cpu/
Too many Virtual Processors? https://www.ibm.com/developerworks/mydeveloperworks/blogs/AIXDownUnder/entry/too_many_virtual_processors365?lang=en
AIX Virtual Processor Folding is Misunderstood https://www.ibm.com/developerworks/mydeveloperworks/blogs/aixpert/entry/aix_virtual_processor_folding_in_misunderstood110?lang=en
How to find physical CPU socket count for IBM AIX http://www.tek-tips.com/viewthread.cfm?qid=1623771
Single/Dual Core Processor http://www.ibm.com/developerworks/forums/message.jspa?messageID=14270797
http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds3%2Flparstat.htm
lparstat command http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14772565
Micropartitioning and Lparstat Output Virtual/Physical http://unix.ittoolbox.com/groups/technical-functional/ibm-aix-l/micropartitioning-and-lparstat-output-virtualphysical-4241112
Capped/Uncapped Partitions http://www.ibmsystemsmag.com/ibmi/trends/linux/See-Linux-Run/Sidebar--Capped-Uncapped-Partitions/
IBM PowerVM Virtualization Introduction and Configuration http://www.redbooks.ibm.com/abstracts/sg247940.html
iostat http://www.wmduszyk.com/wp-content/uploads/2011/01/PE23_Braden_Nasypany.pdf























''12c'' Getting Started with Oracle Application Management Pack (AMP) for Oracle E-Business Suite, Release 12.1.0.1 [ID 1434392.1]
''11g'' Getting Started with Oracle E-Business Suite Plug-in, Release 4.0 [ID 1224313.1]
''10g'' Getting Started with Oracle Application Management Pack and Oracle Application Change Management Pack for Oracle E-Business Suite, Release 3.1 [ID 982302.1]
''Application Management Suite for PeopleSoft (AMS4PSFT)'' http://www.oracle.com/technetwork/oem/app-mgmt/ds-apps-mgmt-suite-psft-166219.pdf
http://download.oracle.com/technology/products/oem/screenwatches/peoplesoft_amp/PeopleSoft_final.html
http://www.psoftsearch.com/managing-peoplesoft-with-application-management-suite/

http://www.oracle.com/technetwork/oem/em12c-screenwatches-512013.html#app_mgmt
https://apex.oracle.com/pls/apex/f?p=44785:24:9222314894074::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:6415,2

<<<
''AMS we bundled the licenses of AMP and RUEI together in a single skew. AMP already had multiple features in it off course.''
<<<
''11g'' 
http://gasparotto.blogspot.com/2011/04/manage-peoplesoft-with-oem-grid-control.html
http://gasparotto.blogspot.com/2011/04/manage-peoplesoft-with-oem-grid-control_08.html
http://gasparotto.blogspot.com/2011/04/manage-peoplesoft-with-oem-grid-control_09.html
peoplesoft plugin 8.52 install, peoplesoft plugin agent install,  http://oraclehowto.wordpress.com/category/oracle-enterprise-manager-11g-plugins/peoplesoft-plugin/

''10g'' http://www.oracle.com/us/products/enterprise-manager/mgmt-pack-for-psft-ds-068946.pdf?ssSourceSiteId=ocomcafr
http://gigaom.com/2012/10/30/meet-arms-two-newest-cores-for-faster-phones-and-greener-servers/
http://gigaom.com/cloud/facebook-amd-hp-and-others-team-up-to-plan-the-arm-data-center-takeover/
''the consortium'' http://www.linaro.org/linux-on-arm
http://www.arm.com/index.php

''ARM and moore's law'' http://www.technologyreview.com/news/507116/moores-law-is-becoming-irrelevant/, http://www.technologyreview.com/news/428481/the-moores-law-moon-shot/
https://sites.google.com/site/embtdbo/wait-event-documentation/ash---active-session-history
ASH patent http://www.google.com/patents?id=cQWbAAAAEBAJ&pg=PA2&source=gbs_selected_pages&cad=3#v=onepage&q&f=false
Practical ASH http://www.scribd.com/rvenrdra/d/44100090-Practical-Advice-on-the-Use-of-Oracle-Database-s-Active-Session-History
magic metirc? http://wenku.baidu.com/view/7d07b81b964bcf84b9d57b48.html?from=related
Sifting through the ASHes http://www.oracle.com/technetwork/database/focus-areas/manageability/ppt-active-session-history-129612.pdf



{{{
col name for a12
col program for a25
col calling_code for a30
col CPU for 9999
col IO for 9999
col TOTAL for 99999
col WAIT for 9999
col user_id for 99999
col sid for 9999
col sql_text format a10

set linesize 300

select /* usercheck */
        decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED')
                                                        "STATUS",
        topsession.sid             "SID",
        topsession.serial#,
        u.username  "NAME",
        topsession.program                  "PROGRAM",
        topsession.sql_plan_hash_value,
        topsession.sql_id,        
        st.sql_text sql_text,
        topsession."calling_code",
        max(topsession.CPU)              "CPU",
        max(topsession.WAIT)       "WAITING",
        max(topsession.IO)                  "IO",
        max(topsession.TOTAL)           "TOTAL", 
        round((s.LAST_CALL_ET/60),2) ELAP_MIN
from (
				select * 
				from (
								select
								     ash.session_id sid,
								     ash.session_serial# serial#,
								     ash.user_id user_id,
								     ash.program,
								     ash.sql_plan_hash_value,
								     ash.sql_id, 
								    procs1.object_name || decode(procs1.procedure_name,'','','.')||
								    procs1.procedure_name ||' '||
								    decode(procs2.object_name,procs1.object_name,'',
									 decode(procs2.object_name,'','',' => '||procs2.object_name)) 
								    ||
								    decode(procs2.procedure_name,procs1.procedure_name,'',
								        decode(procs2.procedure_name,'','',null,'','.')||procs2.procedure_name)
								    "calling_code",	     
								     sum(decode(ash.session_state,'ON CPU',1,0))     "CPU",
								     sum(decode(ash.session_state,'WAITING',1,0))    -
								     sum(decode(ash.session_state,'WAITING',
								        decode(wait_class,'User I/O',1, 0 ), 0))    "WAIT" ,
								     sum(decode(ash.session_state,'WAITING',
								        decode(wait_class,'User I/O',1, 0 ), 0))    "IO" ,
								     sum(decode(session_state,'ON CPU',1,1))     "TOTAL"
								from 
									v$active_session_history ash,
									all_procedures procs1,
	                                all_procedures procs2
								where 
							        ash.PLSQL_ENTRY_OBJECT_ID  = procs1.object_id (+) and 
							        ash.PLSQL_ENTRY_SUBPROGRAM_ID = procs1.SUBPROGRAM_ID (+) and 
							        ash.PLSQL_OBJECT_ID   = procs2.object_id (+) and 
							        ash.PLSQL_SUBPROGRAM_ID  = procs2.SUBPROGRAM_ID (+) 
                                        and ash.sample_time > sysdate - 1
								group by session_id,user_id,session_serial#,program,sql_id,sql_plan_hash_value, 
								         procs1.object_name, procs1.procedure_name, procs2.object_name, procs2.procedure_name
								order by sum(decode(session_state,'ON CPU',1,1)) desc
				     ) 
				 where rownum < 10
      ) topsession,
        v$session s,
        (select sql_id, dbid, nvl(b.name, a.command_type) sql_text from dba_hist_sqltext a, audit_actions b where a.command_type =  b.action(+)) st,
        all_users u
where
        u.user_id =topsession.user_id and
        /* outer join to v$session because the session might be disconnected */
        topsession.sid         = s.sid         (+) and
        topsession.serial# = s.serial#   (+)   and
		st.sql_id(+)             = s.sql_id
		and topsession."calling_code" like '%&PACKAGE_NAME%'
group by  topsession.sid, topsession.serial#,
             topsession.user_id, topsession.program, topsession.sql_plan_hash_value, topsession.sql_id,
                     topsession."calling_code",
             s.username, s.sid,s.paddr,u.username, st.sql_text, s.LAST_CALL_ET
order by max(topsession.TOTAL) desc
/
}}}
{{{
col name for a12
col program for a25
col calling_code for a30
col CPU for 9999
col IO for 9999
col TOTAL for 99999
col WAIT for 9999
col user_id for 99999
col sid for 9999
col sql_text format a10

set linesize 300

select /* usercheck */
        decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED')
                                                        "STATUS",
        topsession.sid             "SID",
        topsession.serial#,
        u.username  "NAME",
        topsession.program                  "PROGRAM",
        topsession.sql_plan_hash_value,
        topsession.sql_id,
        st.sql_text sql_text,
        topsession."calling_code",
        max(topsession.CPU)              "CPU",
        max(topsession.WAIT)       "WAITING",
        max(topsession.IO)                  "IO",
        max(topsession.TOTAL)           "TOTAL",
        round((s.LAST_CALL_ET/60),2) ELAP_MIN
from (
                                select *
                                from (
                                                                select
                                                                     ash.session_id sid,
                                                                     ash.session_serial# serial#,
                                                                     ash.user_id user_id,
                                                                     ash.program,
                                                                     ash.sql_plan_hash_value,
                                                                     ash.sql_id,
                                                                    procs1.object_name || decode(procs1.procedure_name,'','','.')||
                                                                    procs1.procedure_name ||' '||
                                                                    decode(procs2.object_name,procs1.object_name,'',
                                                                         decode(procs2.object_name,'','',' => '||procs2.object_name))
                                                                    ||
                                                                    decode(procs2.procedure_name,procs1.procedure_name,'',
                                                                        decode(procs2.procedure_name,'','',null,'','.')||procs2.procedure_name)
                                                                    "calling_code",
                                                                     sum(decode(ash.session_state,'ON CPU',1,0))     "CPU",
                                                                     sum(decode(ash.session_state,'WAITING',1,0))    -
                                                                     sum(decode(ash.session_state,'WAITING',
                                                                        decode(wait_class,'User I/O',1, 0 ), 0))    "WAIT" ,
                                                                     sum(decode(ash.session_state,'WAITING',
                                                                        decode(wait_class,'User I/O',1, 0 ), 0))    "IO" ,
                                                                     sum(decode(session_state,'ON CPU',1,1))     "TOTAL"
                                                                from
                                                                        dba_hist_active_sess_history ash,
                                                                        all_procedures procs1,
                                        all_procedures procs2
                                                                where
                                                                ash.PLSQL_ENTRY_OBJECT_ID  = procs1.object_id (+) and
                                                                ash.PLSQL_ENTRY_SUBPROGRAM_ID = procs1.SUBPROGRAM_ID (+) and
                                                                ash.PLSQL_OBJECT_ID   = procs2.object_id (+) and
                                                                ash.PLSQL_SUBPROGRAM_ID  = procs2.SUBPROGRAM_ID (+)
                                        and ash.sample_time > sysdate - 99
                                                                group by session_id,user_id,session_serial#,program,sql_id,sql_plan_hash_value,
                                                                         procs1.object_name, procs1.procedure_name, procs2.object_name, procs2.procedure_name
                                                                order by sum(decode(session_state,'ON CPU',1,1)) desc
                                     )
                                 where rownum < 50
      ) topsession,
        v$session s,
        (select sql_id, dbid, nvl(b.name, a.command_type) sql_text from dba_hist_sqltext a, audit_actions b where a.command_type =  b.action(+)) st,
        all_users u
where
        u.user_id =topsession.user_id and
        /* outer join to v$session because the session might be disconnected */
        topsession.sid         = s.sid         (+) and
        topsession.serial# = s.serial#   (+)   and
                st.sql_id(+)             = s.sql_id
                and topsession."calling_code" like '%&PACKAGE_NAME%'
group by  topsession.sid, topsession.serial#,
             topsession.user_id, topsession.program, topsession.sql_plan_hash_value, topsession.sql_id,
                     topsession."calling_code",
             s.username, s.sid,s.paddr,u.username, st.sql_text, s.LAST_CALL_ET
order by max(topsession.TOTAL) desc
/
}}}
{{{
col name for a12
col program for a25
col calling_code for a30
col CPU for 9999
col IO for 9999
col TOTAL for 99999
col WAIT for 9999
col user_id for 99999
col sid for 9999
col sql_text format a10

set linesize 300

select /* usercheck */
        decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED')
                                                        "STATUS",
        topsession.sid             "SID",
        topsession.serial#,
        u.username  "NAME",
        topsession.program                  "PROGRAM",
        topsession.sql_plan_hash_value,
        topsession.sql_id,
        st.sql_text sql_text,
        topsession."calling_code",
        max(topsession.CPU)              "CPU",
        max(topsession.WAIT)       "WAITING",
        max(topsession.IO)                  "IO",
        max(topsession.TOTAL)           "TOTAL",
        round((s.LAST_CALL_ET/60),2) ELAP_MIN
from (
                                select *
                                from (
                                                                select
                                                                     ash.session_id sid,
                                                                     ash.session_serial# serial#,
                                                                     ash.user_id user_id,
                                                                     ash.program,
                                                                     ash.sql_plan_hash_value,
                                                                     ash.sql_id,
                                                                    procs1.object_name || decode(procs1.procedure_name,'','','.')||
                                                                    procs1.procedure_name ||' '||
                                                                    decode(procs2.object_name,procs1.object_name,'',
                                                                         decode(procs2.object_name,'','',' => '||procs2.object_name))
                                                                    ||
                                                                    decode(procs2.procedure_name,procs1.procedure_name,'',
                                                                        decode(procs2.procedure_name,'','',null,'','.')||procs2.procedure_name)
                                                                    "calling_code",
                                                                     sum(decode(ash.session_state,'ON CPU',1,0))     "CPU",
                                                                     sum(decode(ash.session_state,'WAITING',1,0))    -
                                                                     sum(decode(ash.session_state,'WAITING',
                                                                        decode(wait_class,'User I/O',1, 0 ), 0))    "WAIT" ,
                                                                     sum(decode(ash.session_state,'WAITING',
                                                                        decode(wait_class,'User I/O',1, 0 ), 0))    "IO" ,
                                                                     sum(decode(session_state,'ON CPU',1,1))     "TOTAL"
                                                                from
                                                                        v$active_session_history ash,
                                                                        all_procedures procs1,
                                        all_procedures procs2
                                                                where
                                                                ash.PLSQL_ENTRY_OBJECT_ID  = procs1.object_id (+) and
                                                                ash.PLSQL_ENTRY_SUBPROGRAM_ID = procs1.SUBPROGRAM_ID (+) and
                                                                ash.PLSQL_OBJECT_ID   = procs2.object_id (+) and
                                                                ash.PLSQL_SUBPROGRAM_ID  = procs2.SUBPROGRAM_ID (+)
                                        and ash.sample_time > sysdate - 1
                                                                group by session_id,user_id,session_serial#,program,sql_id,sql_plan_hash_value,
                                                                         procs1.object_name, procs1.procedure_name, procs2.object_name, procs2.procedure_name
                                                                order by sum(decode(session_state,'ON CPU',1,1)) desc
                                     )
                                 where rownum < 50
      ) topsession,
        v$session s,
        (select sql_id, dbid, nvl(b.name, a.command_type) sql_text from dba_hist_sqltext a, audit_actions b where a.command_type =  b.action(+)) st,
        all_users u
where
        u.user_id =topsession.user_id and
        /* outer join to v$session because the session might be disconnected */
        topsession.sid         = s.sid         (+) and
        topsession.serial# = s.serial#   (+)   and
                st.sql_id(+)             = s.sql_id
       and topsession.sql_id = '&SQLID'
group by  topsession.sid, topsession.serial#,
             topsession.user_id, topsession.program, topsession.sql_plan_hash_value, topsession.sql_id,
                     topsession."calling_code",
             s.username, s.sid,s.paddr,u.username, st.sql_text, s.LAST_CALL_ET
order by max(topsession.TOTAL) desc
/

}}}
{{{
$ cat ashtop
#!/bin/bash

while :; do
sqlplus "/ as sysdba" <<-EOF
@ashtop.sql
EOF
sleep 5
echo
done
}}}


{{{
-- (c) Kyle Hailey 2007, edited by Karl Arao 20091217

col name for a12
col program for a25
col calling_code for a25
col CPU for 9999
col IO for 9999
col TOTAL for 99999
col WAIT for 9999
col user_id for 99999
col sid for 9999
col sql_text format a10

set linesize 300

select /* usercheck */
        decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED')
                                                        "STATUS",
        topsession.sid             "SID",
        topsession.serial#,
        u.username  "NAME",
        topsession.program                  "PROGRAM",
        topsession.sql_plan_hash_value,
        topsession.sql_id,        
        st.sql_text sql_text,
        topsession."calling_code",
        max(topsession.CPU)              "CPU",
        max(topsession.WAIT)       "WAITING",
        max(topsession.IO)                  "IO",
        max(topsession.TOTAL)           "TOTAL", 
        round((s.LAST_CALL_ET/60),2) ELAP_MIN
from (
				select * 
				from (
								select
								     ash.session_id sid,
								     ash.session_serial# serial#,
								     ash.user_id user_id,
								     ash.program,
								     ash.sql_plan_hash_value,
								     ash.sql_id, 
								    procs1.object_name || decode(procs1.procedure_name,'','','.')||
								    procs1.procedure_name ||' '||
								    decode(procs2.object_name,procs1.object_name,'',
									 decode(procs2.object_name,'','',' => '||procs2.object_name)) 
								    ||
								    decode(procs2.procedure_name,procs1.procedure_name,'',
								        decode(procs2.procedure_name,'','',null,'','.')||procs2.procedure_name)
								    "calling_code",	     
								     sum(decode(ash.session_state,'ON CPU',1,0))     "CPU",
								     sum(decode(ash.session_state,'WAITING',1,0))    -
								     sum(decode(ash.session_state,'WAITING',
								        decode(wait_class,'User I/O',1, 0 ), 0))    "WAIT" ,
								     sum(decode(ash.session_state,'WAITING',
								        decode(wait_class,'User I/O',1, 0 ), 0))    "IO" ,
								     sum(decode(session_state,'ON CPU',1,1))     "TOTAL"
								from 
									v$active_session_history ash,
									all_procedures procs1,
	                                all_procedures procs2
								where 
							        ash.PLSQL_ENTRY_OBJECT_ID  = procs1.object_id (+) and 
							        ash.PLSQL_ENTRY_SUBPROGRAM_ID = procs1.SUBPROGRAM_ID (+) and 
							        ash.PLSQL_OBJECT_ID   = procs2.object_id (+) and 
							        ash.PLSQL_SUBPROGRAM_ID  = procs2.SUBPROGRAM_ID (+) 
                                        and ash.sample_time > sysdate - 1/(60*24)
								group by session_id,user_id,session_serial#,program,sql_id,sql_plan_hash_value, 
								         procs1.object_name, procs1.procedure_name, procs2.object_name, procs2.procedure_name
								order by sum(decode(session_state,'ON CPU',1,1)) desc
				     ) 
				 where rownum < 10
      ) topsession,
        v$session s,
        (select sql_id, dbid, nvl(b.name, a.command_type) sql_text from dba_hist_sqltext a, audit_actions b where a.command_type =  b.action(+)) st,
        all_users u
where
        u.user_id =topsession.user_id and
        /* outer join to v$session because the session might be disconnected */
        topsession.sid         = s.sid         (+) and
        topsession.serial# = s.serial#   (+)   and
		st.sql_id(+)             = s.sql_id
group by  topsession.sid, topsession.serial#,
             topsession.user_id, topsession.program, topsession.sql_plan_hash_value, topsession.sql_id,
                     topsession."calling_code",
             s.username, s.sid,s.paddr,u.username, st.sql_text, s.LAST_CALL_ET
order by max(topsession.TOTAL) desc
/

}}}

grant CREATE SESSION to karlarao;
grant SELECT_CATALOG_ROLE to karlarao;
grant SELECT ANY DICTIONARY to karlarao;
usage:
{{{
./ash
or 
sh ash
}}}


create the file and do ''chmod 755 ash''.. this calls the aveactn300.sql
{{{
$ cat ~/dba/bin/ash
#!/bin/bash

while :; do
sqlplus "/ as sysdba" <<-EOF
@/home/oracle/dba/scripts/aveactn300.sql
EOF
sleep 5
echo
done
}}}


{{{
$ cat /home/oracle/dba/scripts/aveactn300.sql
-- (c) Kyle Hailey 2007

set lines 500
column f_days new_value v_days
select 1 f_days from dual;
column f_secs new_value v_secs
select 5 f_secs from dual;
--select &seconds f_secs from dual;
column f_bars new_value v_bars
select 5 f_bars from dual;
column aveact format 999.99
column graph format a50


column fpct format 99.99
column spct format 99.99
column tpct format 99.99
column fasl format 999.99
column sasl format 999.99
column first format a40
column second format a40


select to_char(start_time,'DD HH:MI:SS'),
       samples,
       --total,
       --waits,
       --cpu,
       round(fpct * (total/samples),2) fasl,
       decode(fpct,null,null,first) first,
       round(spct * (total/samples),2) sasl,
       decode(spct,null,null,second) second,
        substr(substr(rpad('+',round((cpu*&v_bars)/samples),'+') ||
        rpad('-',round((waits*&v_bars)/samples),'-')  ||
        rpad(' ',p.value * &v_bars,' '),0,(p.value * &v_bars)) ||
        p.value  ||
        substr(rpad('+',round((cpu*&v_bars)/samples),'+') ||
        rpad('-',round((waits*&v_bars)/samples),'-')  ||
        rpad(' ',p.value * &v_bars,' '),(p.value * &v_bars),10) ,0,50)
        graph
     --  spct,
     --  decode(spct,null,null,second) second,
     --  tpct,
     --  decode(tpct,null,null,third) third
from (
select start_time
     , max(samples) samples
     , sum(top.total) total
     , round(max(decode(top.seq,1,pct,null)),2) fpct
     , substr(max(decode(top.seq,1,decode(top.event,'ON CPU','CPU',event),null)),0,25) first
     , round(max(decode(top.seq,2,pct,null)),2) spct
     , substr(max(decode(top.seq,2,decode(top.event,'ON CPU','CPU',event),null)),0,25) second
     , round(max(decode(top.seq,3,pct,null)),2) tpct
     , substr(max(decode(top.seq,3,decode(top.event,'ON CPU','CPU',event),null)),0,25) third
     , sum(waits) waits
     , sum(cpu) cpu
from (
  select
       to_date(tday||' '||tmod*&v_secs,'YYMMDD SSSSS') start_time
     , event
     , total
     , row_number() over ( partition by id order by total desc ) seq
     , ratio_to_report( sum(total)) over ( partition by id ) pct
     , max(samples) samples
     , sum(decode(event,'ON CPU',total,0))    cpu
     , sum(decode(event,'ON CPU',0,total))    waits
  from (
    select
         to_char(sample_time,'YYMMDD')                      tday
       , trunc(to_char(sample_time,'SSSSS')/&v_secs)          tmod
       , to_char(sample_time,'YYMMDD')||trunc(to_char(sample_time,'SSSSS')/&v_secs) id
       , decode(ash.session_state,'ON CPU','ON CPU',ash.event)     event
       , sum(decode(session_state,'ON CPU',1,decode(session_type,'BACKGROUND',0,1))) total
       , (max(sample_id)-min(sample_id)+1)                    samples
     from
        v$active_session_history ash
     where
               sample_time > sysdate - &v_days
     group by  trunc(to_char(sample_time,'SSSSS')/&v_secs)
            ,  to_char(sample_time,'YYMMDD')
            ,  decode(ash.session_state,'ON CPU','ON CPU',ash.event)
     order by
               to_char(sample_time,'YYMMDD'),
               trunc(to_char(sample_time,'SSSSS')/&v_secs)
  )  chunks
  group by id, tday, tmod, event, total
) top
group by start_time
) aveact,
  v$parameter p
where p.name='cpu_count'
order by start_time
/
}}}
-- from http://www.perfvision.com/statspack/ash.txt

{{{
ASH Report For CDB10/cdb10
DB Name         DB Id    Instance     Inst Num Release     RAC Host
CPUs           SGA Size       Buffer Cache        Shared Pool    ASH Buffer Size
Top User Events
Top Background Events
Top Event P1/P2/P3 Values
Top Service/Module
Top Client IDs
Top SQL Command Types
Top SQL Statements
Top SQL using literals
Top Sessions
Top Blocking Sessions
Top DB Objects
Top DB Files
Top Latches
Activity Over Time
}}}
-- from http://www.perfvision.com/statspack/ash.txt

{{{
ASH Report For CDB10/cdb10

DB Name         DB Id    Instance     Inst Num Release     RAC Host
------------ ----------- ------------ -------- ----------- --- ------------
CDB10         1193559071 cdb10               1 10.2.0.1.0  NO  tsukuba

CPUs           SGA Size       Buffer Cache        Shared Pool    ASH Buffer Size
---- ------------------ ------------------ ------------------ ------------------
   2        440M (100%)         28M (6.4%)       128M (29.1%)        4.0M (0.9%)


          Analysis Begin Time:   31-Jul-07 17:52:21
            Analysis End Time:   31-Jul-07 18:07:21
                 Elapsed Time:        15.0 (mins)
                 Sample Count:       2,647
      Average Active Sessions:        2.94
  Avg. Active Session per CPU:        1.47
                Report Target:   None specified

Top User Events                  DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

                                                               Avg Active
Event                               Event Class     % Activity   Sessions
----------------------------------- --------------- ---------- ----------
db file sequential read             User I/O             26.60       0.78
CPU + Wait for CPU                  CPU                   8.88       0.26
db file scattered read              User I/O              7.25       0.21
log file sync                       Commit                5.44       0.16
log buffer space                    Configuration         4.53       0.13
          -------------------------------------------------------------

Top Background Events            DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

                                                               Avg Active
Event                               Event Class     % Activity   Sessions
----------------------------------- --------------- ---------- ----------
db file parallel write              System I/O           21.61       0.64
log file parallel write             System I/O           18.21       0.54
          -------------------------------------------------------------

Top Event P1/P2/P3 Values        DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

Event                          % Event  P1 Value, P2 Value, P3 Value % Activity
------------------------------ ------- ----------------------------- ----------
Parameter 1                Parameter 2                Parameter 3
-------------------------- -------------------------- --------------------------
db file sequential read          26.97             "201","66953","1"       0.11
file#                      block#                     blocks

db file parallel write           21.61          "3","0","2147483647"       3.21
requests                   interrupt                  timeout

                                                "2","0","2147483647"       2.49


                                                "5","0","2147483647"       2.42


log file parallel write          18.21                "1","2022","1"       0.68
files                      blocks                     requests

db file scattered read            7.37             "201","72065","8"       0.23
file#                      block#                     blocks

log file sync                     5.48                "4114","0","0"       0.30
buffer#                    NOT DEFINED                NOT DEFINED

          -------------------------------------------------------------

Top Service/Module               DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

Service        Module                   % Activity Action               % Action
-------------- ------------------------ ---------- ------------------ ----------
SYS$USERS      UNNAMED                       50.70 UNNAMED                 50.70
SYS$BACKGROUND UNNAMED                       41.56 UNNAMED                 41.56
cdb10          OEM.SystemPool                 2.64 UNNAMED                  1.47
                                                   XMLLoader0               1.17
SYS$USERS      sqlplus@tsukuba (TNS V1-       1.55 UNNAMED                  1.55
cdb10          Lab128                         1.36 UNNAMED                  1.36
          -------------------------------------------------------------

Top Client IDs                   DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top SQL Command Types            DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)
-> 'Distinct SQLIDs' is the count of the distinct number of SQLIDs
      with the given SQL Command Type found over all the ASH samples
      in the analysis period

                                           Distinct            Avg Active
SQL Command Type                             SQLIDs % Activity   Sessions
---------------------------------------- ---------- ---------- ----------
INSERT                                           28      27.81       0.82
SELECT                                           45      12.73       0.37
UPDATE                                           11       3.85       0.11
DELETE                                            4       3.70       0.11
          -------------------------------------------------------------

Top SQL Statements              DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

       SQL ID    Planhash % Activity Event                             % Event
------------- ----------- ---------- ------------------------------ ----------
fd6a0p6333g8z  2993408006       7.59 db file sequential read              3.06
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

                                     direct path write temp               1.74

                                     db file scattered read               1.32

298wmz1kxjs1m  4251515144       5.25 CPU + Wait for CPU                   2.68
INSERT INTO CM_QOS_PROF SELECT :B1 , R.TOPOLOGYID, :B1 - :B4 , P.NODE_PROFILE_ID
, R.DOCSIFCMTSSERVICEQOSPROFILE FROM CM_SID_RAWDATA R, ( SELECT DISTINCT T.CMID,
 P.QOS_PROF_IDX, P.NODE_PROFILE_ID FROM TMP_TOP_SLOW_CM T, CMTS_QOS_PROF P WHERE
 T.CMTSID = P.TOPOLOGYID AND P.SECONDID = :B1 ) P WHERE R.BATCHID = :B3 AND R.PR

                                     db file sequential read              1.78

fhawr20n0wy5x  1792062018       3.40 db file sequential read              2.91
INSERT INTO TMP_CALC_HFC_SLOW_CM_TMP SELECT T.CMTSID, T.DOWNID, T.CMID, 0, 0, 0,
 T.DOWN_SNR_CNR_A3, T.DOWN_SNR_CNR_A2, T.DOWN_SNR_CNR_A1, T.DOWN_SNR_CNR_A0, R.S
YSUPTIME, R.DOCSIFSIGQUNERROREDS, R.DOCSIFSIGQCORRECTEDS, R.DOCSIFSIGQUNCORRECTA
BLES, R.DOCSIFSIGQSIGNALNOISE, :B3 , L.PREV_SECONDID, L.PREV_DOCSIFSIGQUNERRORED

3a11s4c86wdu5  1366293986       3.21 db file sequential read              1.85
DELETE FROM CM_RAWDATA WHERE BATCHID = 0 AND PROFINDX = :B1

                                     log buffer space                     1.06

998t5bbdfm5rm  1914870171       3.21 db file sequential read              1.70
INSERT INTO CM_RAWDATA SELECT PROFINDX, 0 BATCHID, TOPOLOGYID, SAMPLETIME, SYSUP
TIME, DOCSIFCMTSCMSTATUSVALUE, DOCSIFCMTSSERVICEINOCTETS, DOCSIFCMTSSERVICEOUTOC
TETS, DOCSIFCMSTATUSTXPOWER, DOCSIFCMTSCMSTATUSRXPOWER, DOCSIFDOWNCHANNELPOWER,
DOCSIFSIGQUNERROREDS, DOCSIFSIGQCORRECTEDS, DOCSIFSIGQUNCORRECTABLES, DOCSIFSIGQ

          -------------------------------------------------------------

Top SQL using literals           DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top Sessions                    DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)
-> '# Samples Active' shows the number of ASH samples in which the session
      was found waiting for that particular event. The percentage shown
      in this column is calculated with respect to wall clock time
      and not total database activity.
-> 'XIDs' shows the number of distinct transaction IDs sampled in ASH
      when the session was waiting for that particular event
-> For sessions running Parallel Queries, this section will NOT aggregate
      the PQ slave activity into the session issuing the PQ. Refer to
      the 'Top Sessions running PQs' section for such statistics.

   Sid, Serial# % Activity Event                             % Event
--------------- ---------- ------------------------------ ----------
User                 Program                          # Samples Active     XIDs
-------------------- ------------------------------ ------------------ --------
      126,    5      33.59 db file sequential read             18.62
STARGUS                                                 493/900 [ 55%]        4

                           CPU + Wait for CPU                   5.52
                                                        146/900 [ 16%]        2

                           db file scattered read               5.02
                                                        133/900 [ 15%]        2

      167,    1      21.80 db file parallel write              21.61
SYS                  oracle@tsukuba (DBW0)              572/900 [ 64%]        0

      166,    1      18.47 log file parallel write             18.21
SYS                  oracle@tsukuba (LGWR)              482/900 [ 54%]        0

      133,  763       9.67 db file sequential read              4.80
STARGUS                                                 127/900 [ 14%]        1

                           direct path write temp               1.74
                                                         46/900 [  5%]        0

                           db file scattered read               1.32
                                                         35/900 [  4%]        0

      152,  618       3.10 db file sequential read              1.10
STARGUS                                                  29/900 [  3%]        1

          -------------------------------------------------------------

Top Blocking Sessions            DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)
-> Blocking session activity percentages are calculated with respect to
      waits on enqueues, latches and "buffer busy" only
-> '% Activity' represents the load on the database caused by
      a particular blocking session
-> '# Samples Active' shows the number of ASH samples in which the
      blocking session was found active.
-> 'XIDs' shows the number of distinct transaction IDs sampled in ASH
      when the blocking session was found active.

   Blocking Sid % Activity Event Caused                      % Event
--------------- ---------- ------------------------------ ----------
User                 Program                          # Samples Active     XIDs
-------------------- ------------------------------ ------------------ --------
      166,    1       5.48 log file sync                        5.48
SYS                  oracle@tsukuba (LGWR)              512/900 [ 57%]        0

          -------------------------------------------------------------

Top Sessions running PQs        DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top DB Objects                   DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)
-> With respect to Application, Cluster, User I/O and buffer busy waits only.

      Object ID % Activity Event                             % Event
--------------- ---------- ------------------------------ ----------
Object Name (Type)                                    Tablespace
----------------------------------------------------- -------------------------
          52652       4.08 db file scattered read               4.08
STARGUS.TMP_CALC_HFC_SLOW_CM_TMP (TABLE)              SYSTEM

          52543       3.32 db file sequential read              3.32
STARGUS.PK_CM_RAWDATA (INDEX)                         TS_STARGUS

          52698       3.21 db file sequential read              2.98
STARGUS.TMP_TOP_SLOW_CM (TABLE)                       SYSTEM

          52542       2.98 db file sequential read              2.98
STARGUS.CM_RAWDATA (TABLE)                            TS_STARGUS

          52699       1.78 db file sequential read              1.78
STARGUS.PK_TMP_TOP_SLOW_CM (INDEX)                    SYSTEM

          -------------------------------------------------------------

Top DB Files                     DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)
-> With respect to Cluster and User I/O events only.

        File ID % Activity Event                             % Event
--------------- ---------- ------------------------------ ----------
File Name                                             Tablespace
----------------------------------------------------- -------------------------
              6      23.31 db file sequential read             19.83
/export/home/oracle10/oradata/cdb10/ts_stargus_01.dbf TS_STARGUS

                           db file scattered read               1.59


                           direct path write temp               1.59


          -------------------------------------------------------------

Top Latches                      DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Activity Over Time              DB/Inst: CDB10/cdb10  (Jul 31 17:52 to 18:07)
-> Analysis period is divided into smaller time slots
-> Top 3 events are reported in each of those slots
-> 'Slot Count' shows the number of ASH samples in that slot
-> 'Event Count' shows the number of ASH samples waiting for
   that event in that slot
-> '% Event' is 'Event Count' over all ASH samples in the analysis period

                         Slot                                   Event
Slot Time (Duration)    Count Event                             Count % Event
-------------------- -------- ------------------------------ -------- -------
17:52:21   (1.7 min)      354 log file parallel write              85    3.21
                              db file sequential read              82    3.10
                              db file parallel write               65    2.46
17:54:00   (2.0 min)      254 CPU + Wait for CPU                   73    2.76
                              db file sequential read              46    1.74
                              log file parallel write              44    1.66
17:56:00   (2.0 min)      323 log file parallel write              94    3.55
                              db file parallel write               85    3.21
                              db file sequential read              85    3.21
17:58:00   (2.0 min)      385 log file parallel write             109    4.12
                              db file parallel write               95    3.59
                              db file sequential read              71    2.68
18:00:00   (2.0 min)      470 db file sequential read             169    6.38
                              db file parallel write               66    2.49
                              log file parallel write              61    2.30
18:02:00   (2.0 min)      277 db file sequential read             139    5.25
                              db file parallel write               58    2.19
                              CPU + Wait for CPU                   39    1.47
18:04:00   (2.0 min)      364 db file parallel write              105    3.97
                              db file scattered read               90    3.40
                              db file sequential read              80    3.02
18:06:00   (1.4 min)      220 db file parallel write               67    2.53
                              db file scattered read               44    1.66
                              db file sequential read              42    1.59
          -------------------------------------------------------------

End of Report
}}}
<<<

Active Session History (ASH) performed an emergency flush. This may mean that ASH is undersized. If emergency flushes are a recurring issue, you may consider increasing ASH size by setting the value of _ASH_SIZE to a sufficiently large value. Currently, ASH size is 16777216 bytes. Both ASH size and the total number of emergency flushes since instance startup can be monitored by running the following query:
 select total_size,awr_flush_emergency_count from v$ash_info;

<<<
''RE: Finding Sessions using AWR Report - ASH'' http://www.evernote.com/shard/s48/sh/733fa2e6-4feb-45cf-ac1a-18a679d9bce5/d6f5a6382d71007a633bc30d0a225db6

http://oracledoug.com/serendipity/index.php?/archives/1614-Network-Events-in-ASH.html

other articles by Doug about ASH 

Alternative Pictures Demo
That Pictures demo in full
Time Matters: Throughput vs. Response Time - Part 2
Diagnosing Locking Problems using ASH/LogMiner – The End
Diagnosing Locking Problems using ASH/LogMiner – Part 9
Diagnosing Locking Problems using ASH/LogMiner – Part 8
Diagnosing Locking Problems using ASH/LogMiner – Part 7
Diagnosing Locking Problems using ASH – Part 6
Diagnosing Locking Problems using ASH – Part 5
Diagnosing Locking Problems using ASH – Part 4
http://www.oaktable.net/content/ukoug-2011-ash-outliers
http://oracledoug.com/serendipity/index.php?/archives/1669-UKOUG-2011-Ash-Outliers.html#comments
http://oracledoug.com/ASHoutliers3c.sql
http://oracledoug.com/adaptive_thresholds_faq.pdf
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1525205200346930663   <-- JB and Graham comments

Visualizing Active Session History (ASH) Data With R http://structureddata.org/2011/12/20/visualizing-active-session-history-ash-data-with-r/
also talks about TIME_WAITED – micro, only the last sample is fixed up, the others will have TIME_WAITED=0
thanks to John Beresniewicz for this info. http://dboptimizer.com/2011/07/20/oracle-time-units-in-v-views/
DAVE ABERCROMBIE research on AAS and ASH
http://aberdave.blogspot.com/search?updated-max=2011-04-02T08:09:00-07:00&max-results=7
http://dboptimizer.com/2011/10/20/tuning-blog-entries/
{{{
ASH

SQL execution times from ASH – using ASH to see SQL execution times and execution time variations
AAS on AWR – my favorite ASH query that shows AAS  wait classes  as an ascii graph
CPU Wait vs CPU Usage
Simulated ASH 2.1
AWR

Wait  Metrics vs v$system_event
Statistic Metrics verses v$sysstat
I/O latency fluctuations
I/O wait histograms
Redo over weeks
AWR mining
Diff’ing AWR reports
Importing AWR repositories
Redo

LGWR redo write times (log file parallel write)
Ratio of Redo bytes to Datablocks writes
Etc

V$ view time units S,CS,MS,US
Parsing 10046 traces
SQL

Display Cursor Explained – what are all those display_cursor options and what exactly is the data
VST – vistual sql tunning

VST in DB Optimizer 3.0
VST with 100 Tables !
SQL Joins using sets
Visualizing SQL Queries
VST – product design
View expansion with VST
Outer Joins Graphically
}}}
* ASM Mind Map
http://jarneil.wordpress.com/2008/08/26/the-asm-mind-map/

* v$asm_disk
http://www.rachelp.nl/index_kb.php?menu=articles&actie=show&id=10



http://www.freelists.org/post/oracle-l/ASM-on-SAN,5
http://www.freelists.org/post/oracle-l/ASM-and-EMC-PowerPath
ASM and shared pool sizing - http://www.evernote.com/shard/s48/sh/c3535415-30fd-42fa-885a-85df36616e6e/288c13d20095240c8882594afed99e8b

Bug 11684854 : ASM ORA-4031 IN LARGE POOL FROM CREATE DISKGROUP
14292825: DEFAULT MEMORY PARAMETER VALUES FOR 11.2 ASM INSTANCES LOW
https://twiki.cern.ch/twiki/bin/view/PDBService/ASM_Internals <-- GOOD STUFF
https://twiki.cern.ch/twiki/bin/view/PDBService/HAandPerf
{{{
ASM considerations on SinglePath and MultiPath across versions (OCR,VD,DATA)

In general you gotta have a facility/mechanism for:

	* multipathing -> persistent naming -> ASM


on 10gR2, 11gR1 for your OCR and VD you must use the following:

	* 
		* clustered filesystem (OCFS2) or NFS
		* raw devices (RHEL4) or udev (RHEL5)


on 11gR2, for your OCR and VD you must use the following:

	* 
		* clustered filesystem or NFS
		* ASM (mirrored at least 3 disks) 

-----------------------
Single Path 
-----------------------

If you have ASMlib you will go with this setup

	* 
		*   ASMlib -> ASM"


If you don't have ASMlib and Powerpath you will go with this setup

	* 
		* 10gR2 and 11g
			* raw devices
			* udev -> ASM

		* 11gR2

			* udev -> ASM

-----------------------
Multi Path
-----------------------

If you have ASMlib and Powerpath you will go with this setup

	* 
		* 10gR2, 11g, 11gR2

			* "powerpath -> ASMlib -> ASM"



If you don't have ASMlib and Powerpath you will go with this setup

	* 
		* 10gR2
			* "dm multipath (dev mapper) -> raw devices -> ASM"


		* 11g and 11gR2
			* "dm multipath (dev mapper) -> ASM"



you can also be flexible and go with 

	* 
		*   "dm multipath (dev mapper) -> ASMlib -> ASM"

-----------------------
Notes
-----------------------

kpartx confuses me..just do this.. 
- assign and share luns on all nodes.
- fdisk the luns and update partition table on all nodes
- configure multipath
- use </dev/mapper/<mpath_alias>
- create asm storage using above devices
https://forums.oracle.com/forums/thread.jspa?threadID=2288213
}}}

http://www.evernote.com/shard/s48/sh/0012dbf5-6648-4792-84ff-825a363f68d3/a744de57fdb99349388e21cdd9c6059a
http://www.pythian.com/news/1078/oracle-11g-asm-diskgroup-compatibility/

http://www.freelists.org/post/oracle-l/Does-ocssdbin-started-from-11gASM-home-support-diskgroups-mounted-by-10g-ASM-instance,5
{{{
Hi Sanjeev,

I'd like to clear some info first.

1st)... the ocssd.bin

the CSS is created when:
- you use ASM as storage
- when you install Clusterware (RAC, but Clusterware has its separate
home already)

  For Oracle Real Application Clusters installations, the CSS daemon
is installed with Oracle Clusterware in a separate Oracle home
directory (also called the Clusterware home directory). For
single-node installations, the CSS daemon is installed in and runs
from the same Oracle home as Oracle Database.

You could identify the Oracle home directory being used to run the CSS daemon:

# cat /etc/oracle/ocr.loc

The output from this command is similar to the following:

[oracle@dbrocaix01 bin]$ cat /etc/oracle/ocr.loc
ocrconfig_loc=/oracle/app/oracle/product/10.2.0/asm_1/cdata/localhost/local.ocr
local_only=TRUE

The ocrconfig_loc parameter specifies the location of the Oracle
Cluster Registry (OCR) used by the CSS daemon. The path up to the
cdata directory is the Oracle home directory where the CSS daemon is
running (/oracle/app/oracle/product/10.2.0/asm_1 in this example). To
confirm you could grep the css deamon and see that it's running on
that home

[oracle@dbrocaix01 bin]$ ps -ef | grep -i css
oracle    4950     1  0 04:23 ?        00:00:00
/oracle/app/oracle/product/10.2.0/asm_1/bin/ocssd.bin
oracle    5806  5609  0 04:26 pts/1    00:00:00 grep -i css

Note:
If the value of the local_only parameter is FALSE, Oracle Clusterware
is installed on this system.


2nd)... ASM and Database compatibility

I'll supply you with some references..

Note 337737.1 Oracle Clusterware - ASM - Database Version Compatibility
Note 363254.1 Applying one-off Oracle Clusterware patches in a mixed
version home environment

and Chapter 4, page 116-120 of Oracle ASM (under the hood & practical
deployment guide) 10g & 11g

In the book it says that there are two types of compatibility settings
between ASM and the RDBMS:
  1) instance-level software compatibility settings
        - the COMPATIBLE parameter (mine is 10.2.0), this defines what
software features are available to the instance. Setting the
COMPATIBLE parameter in the ASM instance
        to 10.1 will not enable you to use 11g ASM new features (variable
extents, etc.)

  2) diskgroup-specific settings
        - COMPATIBLE.ASM and COMPATIBLE.RDBMS which are persistently stored
in the ASM diskgroup metadata..these compatibility settings are
specific to a diskgroup and control which
          attributes are available to the ASM diskgroup and which are
available to the database.
        - COMPATIBLE.RDBMS, which defaults to 10.1 in 11g, is the minimum
COMPATIBLE version setting of a database that can mount the
diskgroup.. once you advanced it, it cannot be reversed
        - COMPATIBLE.ASM, which controls the persistent format of the on-disk
ASM metadata structures. The ASM compatibility defaults to 10.1 in 11g
and must always be greater than or equal to the RDBMS compatibility
level.. once you advanced it, it cannot be reversed

    The combination of the compatibility parameter setting of the
database, the software version of the database, and the RDBMS
compatibility setting of a diskgroup determines whether a database
instance is permitted to mount a given diskgroup. The compatibility
setting also determines which ASM features are available for a
diskgroup.

    An ASM instance can support different RDBMS clients with different
compatibility settings, as long as the database COMPATIBLE init.ora
parameter setting of each database instance is greater than or equal
to the RDBMS compatibility of all diskgroups.

    You could also read more here...
http://download.oracle.com/docs/cd/B28359_01/server.111/b31107/asmdiskgrps.htm#CHDDIGBJ




So the following info will give us some background on your environment

cat /etc/oracle/ocr.loc
ps -ef | grep -i css
cat /etc/oratab
select name, group_number, value from v$asm_attribute order by 2;
select db_name, status,software_version,compatible_version from v$asm_client;
select name,compatibility, database_compatibility from v$asm_diskgroup;



I hope I did not confuse you with all of this info.





- Karl Arao
http://karlarao.wordpress.com
}}}
http://blog.ronnyegner-consulting.de/2009/10/27/asm-resilvering-or-how-to-recovery-your-asm-in-crash-scenarios/
http://www.ardentperf.com/2010/07/15/asm-mirroring-no-hot-spare-disk/
http://asmsupportguy.blogspot.com/2010/05/how-to-map-asmlib-disk-to-device-name.html
http://uhesse.wordpress.com/2010/12/01/database-migration-to-asm-with-short-downtime/
{{{
backup as copy database format '+DATA';
switch database to copy;
}}}
''Migrating Databases from non-ASM to ASM and Vice-Versa'' http://www.idevelopment.info/data/Oracle/DBA_tips/Automatic_Storage_Management/ASM_33.shtml


-- ''OCFS to ASM''
''How to Migrate an Existing RAC database to ASM'' http://www.colestock.com/blogs/2008/05/how-to-migrate-existing-rac-database-to.html
http://oss.oracle.com/pipermail/oracleasm-users/2009-June/000094.html
{{{

[root@uscdcmix30 ~]#  time dd if=/dev/VgCDCMIX30_App/app_new bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    0m39.045s

user    0m0.083s

sys     0m6.467s

[root@uscdcmix30 ~]# time dd if=/dev/oracleasm/disks/DGMIX03 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m1.784s

user    0m0.084s

sys     0m14.914s

[root@uscdcmix30 ~]# time dd if=/dev/oracleasm/disks/DGMIX04 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m17.748s

user    0m0.069s

sys     0m13.409s

[root@uscdcmix30 ~]# time dd if=/dev/oracleasm/disks/DGMIX03 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m2.702s

user    0m0.090s

sys     0m16.682s

[root@uscdcmix30 ~]# time dd if=/dev/oracleasm/disks/DGMIX04 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m19.698s

user    0m0.079s

sys     0m16.774s

[root@uscdcmix30 ~]# time dd if=/dev/oracleasm/disks/DGMIX03 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m2.037s

user    0m0.085s

sys     0m14.386s

[root@uscdcmix30 ~]# time dd if=/dev/oracleasm/disks/DGMIX03 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m2.822s

user    0m0.052s

sys     0m11.703s

[root@uscdcmix30 ~]# oracleasm listdisks

DGCRM01

DGCRM02

DGCRM03

DGCRM04

DGCRM05

DGCRM06

DGMIX01

DGMIX02

DGMIX03

DGMIX04

[root@uscdcmix30 ~]# oracleasm deletedisk DGMIX03

Clearing disk header: done

Dropping disk: done

[root@uscdcmix30 ~]# time dd if=/dev/emcpowers1 bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    1m0.955s

user    0m0.044s

sys     0m11.446s

[root@uscdcmix30 ~]# pvcreate /dev/emcpowers1

  Physical volume "/dev/emcpowers1" successfully created

[root@uscdcmix30 ~]# vgcreate VgTemp /dev/emcpowers1

  /dev/emcpowero: open failed: No such device

  /dev/emcpowero1: open failed: No such device

  Volume group "VgTemp" successfully created

[root@uscdcmix30 ~]# vgs

  VG              #PV #LV #SN Attr   VSize   VFree

  VgCDCCRM30_App    1   1   0 wz--n- 101.14G      0

  VgCDCCRM30_Arch   1   1   0 wz--n- 101.14G      0

  VgCDCMIX30_App    1   1   0 wz--n- 100.00G      0

  VgTemp            1   0   0 wz--n- 100.00G 100.00G

  vg00              1   7   0 wz--n- 136.50G  66.19G

  vg01              1   1   0 wz--n- 101.14G      0

  vg03              2   1   0 wz--n- 505.74G 101.14G

[root@uscdcmix30 ~]# lvcreate -L 102396 -n TestLV VgTemp

  Logical volume "TestLV" created

[root@uscdcmix30 ~]# time dd if=/dev/VgTemp/TestLV bs=8192 count=655360 of=/dev/null

655360+0 records in

655360+0 records out


 
real    0m34.027s

user    0m0.056s

sys     0m4.698s

}}}
How to create ASM filesystem in Oracle 11gR2
http://translate.google.com/translate?sl=auto&tl=en&u=http://www.dbform.com/html/2010/1255.html
OTN ASM
http://www.oracle.com/technology/tech/linux/asmlib/index.html
http://www.oracle.com/technology/tech/linux/asmlib/raw_migration.html
http://www.oracle.com/technology/tech/linux/asmlib/multipath.html
http://www.oracle.com/technology/tech/linux/asmlib/persistence.html

ASM using ASMLib and Raw Devices
http://www.oracle-base.com/articles/10g/ASMUsingASMLibAndRawDevices.php
Raw devices with release 11: Note ID 754305.1
# 
However, the Unbreakable Enterprise Kernel is optional, 
and Oracle Linux continues to include a Red Hat compatible kernel, compiled directly from Red Hat 
Enterprise Linux source code, for customers who require strict RHEL compatibility. Oracle also 
recommends the  Unbreakable Enterprise Kernel when running third party software and third party 
hardware.


# Performance improvements

latencytop?


# ASMlib and virtualization modules in the kernel

Updated Kernel Modules
The Unbreakable Enterprise Kernel includes both OCFS2 1.6 as well as Oracle ASMLib, the kernel 
driver for Oracle’s Automatic Storage Management feature.  There is no need to install separate RPMs 
to implement these kernel features.  Also, the Unbreakable Enterprise Kernel can be run directly on 
bare metal or as a virtual guest on Oracle VM, both in hardware virtualized (HVM) and paravirtualized (PV) mode, as it implements the paravirt_ops instruction set and includes the xen_netfront and 
xen_blkfront drivers.

# 
Unbreakable Enterprise Kernel itself already includes ocfs2 and oracleasm



Questions:
1) Since it will be a new kernel, what if I have a third party module like EMC Powerpath? I'm sure ill have to reinstall it once I use the new 
kernel. But, once reinstalled.. will it be certified with EMC (or vice versa)? 
2) Also, Oracle says, if you have to maintain compatibility with a third party module. You can use the old vanilla kernel. Questions is, since the 
ASMlib module is already integrated on the Unbreakable Kernel, once I use the non-Unbreakable kernel do they also have the old style RPM 
(oracleasm-`uname -r` - kernel driver) for having the ASMlib module? 
OR 
if it's not supported at all and I'm 

ASMLIB has three components.
1. oracleasm-support - user space shell scripts
2. oracleasmlib - user space library (closed source)	
3. oracleasm-`uname -r` - kernel driver		<-- kernel dependent

###############################################################################################3

-- from this thread http://www.freelists.org/post/oracle-l/ASM-and-EMC-PowerPath

! 
! The Storage Report (ASM -> Linux -> EMC)
Below is a sample storage info that you should have, it clearly shows the relationship from the Oracle layer (ASM), Linux, and SAN storage. This info is very useful for you and the storage engineer. So you would know which is which in case of catastrophic problems..

Very useful for storage activities like: 
* SAN Migration
* Add/Remove disk
* Powerpath upgrade
* Kernel upgrade

//(Note: The images below might be too big on your current screen resolution, to have a better view just right click and download the images or ''double click'' on this page to see the full path of the images..)//

[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TaFARe_nqfI/AAAAAAAABOI/jXAshWxpfw8/powerpath1.png]]
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TaFARSJDiLI/AAAAAAAABOE/SoDU7jrddUQ/powerpath2.png]]
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TaFAUat0HcI/AAAAAAAABOM/qe5qoeF3wTw/powerpath3.png]]

! 
! What info do you need to produce the report? 
''You need the following:''
* AWR time series output (my scripts http://karlarao.wordpress.com/scripts-resources)
* output of the command ''powermt display dev=all'' (run as root)
* RDA
* SAR (because I just love looking at the performance data)
* sysreport (run as root)

''You have to collect'' this on each server / instance and properly arrange them per folder so you won't have a hard time documenting the bits of info you need on the Excel sheet
[img[picturename| https://lh4.googleusercontent.com/_F2x5WXOJ6Q8/TaFK4F_SexI/AAAAAAAABPQ/VjSQm0_uUUM/powerdevices4.png]]

''Below is the drill down on each folder'', the data you'll see is from a separate two RAC clusters.. each with it's own SAN storage.. the project I'm working on here is to migrate/consolidate them into a single SAN storage (newly purchased). So I need to collect all these data to help on planning the activity and mitigate the risks/issues. Also the collection of performance data is a must to verify if the IO requirements of the databases can be handled by the new SAN. On this project I have verified that the Capacity exceeds the current requirements. 
* AWR
<<<
per server
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TaFDmcOnhBI/AAAAAAAABOk/lxo8_tbLqX4/powerdevices5-awr.png]]
> per instance
> [img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TaFKbFENV1I/AAAAAAAABPE/nUCFo_HOjHY/powerdevices5-awr2.png]]
>> awr output on each instance
>> [img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TaFKbZB6nnI/AAAAAAAABPI/8MVhDN5Q_rI/powerdevices5-awr3.png]]
<<<
* powermt display dev=all
<<<
[img[picturename| https://lh5.googleusercontent.com/_F2x5WXOJ6Q8/TaFDmG2XayI/AAAAAAAABOg/0Lo8QoDbm_A/powerdevices6-powermt.png]]
<<<
* RDA
<<<
[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TaFDmsNLT2I/AAAAAAAABOs/sHa-KUryYFo/powerdevices7-rda.png]]
<<<
* SAR
<<<
[img[picturename| https://lh6.googleusercontent.com/_F2x5WXOJ6Q8/TaFDmcOnhBI/AAAAAAAABOk/lxo8_tbLqX4/powerdevices5-awr.png]]
> sample output
> [img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TaFDmyLyKAI/AAAAAAAABOw/f5UgyqVu09I/powerdevices8-sar.png]]
<<<
* sysreport 
<<<
[img[picturename| https://lh4.googleusercontent.com/_F2x5WXOJ6Q8/TaFDm08TuYI/AAAAAAAABO0/bZzSwZX6Vqc/powerdevices8-sysreport.png]]
> sample output
> [img[picturename| https://lh4.googleusercontent.com/_F2x5WXOJ6Q8/TaFDnQpFRHI/AAAAAAAABO4/SiDKdZE9kOY/powerdevices8-sysreport2.png]]
<<<

! 
! Putting it all together 
On the Excel sheet, you have to fill in the following sections 
* From RDA
** ASM Library Information
** ASM Library Disk Information
** Disk Partitions
** Operating System Setup->Operating System Packages
** Operating System Setup->Disk Drives->Disk Mounts
** Oracle Cluster Registry (Cluster -> Cluster Information -> ocrcheck)
* From ''powermt'' command
** Logical Device IDs and names
* From sysreport
** raw devices (possible for OCR and Voting Disk)
** fstab (check for OCFS2 mounts)
* Double check from OS commands
** Voting Disk (''crsctl query css votedisk'')
** ls -l /dev/	
** /etc/init.d/oracleasm querydisk <device_name>

''Below are the output from the various sources...'' this will show you how to map the ''ASM disk'' to a particular ''EMC power device'' (follow the ''RED ARROWS'').. you have to do it on all "ASM disks" and the method will also be the same on accounting the ''raw devices'', ''OCFS2'', and ''OCR'' for their mapping on their respective EMC power devices..

To do the correlated report of the ASM, Linux, and SAN storage.. follow the ''BLUE ARROWS''..

You will also see below that having this proper accounting and correlating it from the ASM, Linux, and EMC storage level you will never go wrong and you have the definitive information that you can share with the EMC Storage Engineer which they can also ''double check''.. in that way both the ''DBAs and the Storage guys will be on the same page''.

[img[picturename| https://lh3.googleusercontent.com/_F2x5WXOJ6Q8/TaFvF-b2-tI/AAAAAAAABPk/cdnpkq6yLeg/emcreport10.png]]

Notice above that the ''emcpowerr'' and ''emcpowers'' have no allocations, so what does that mean? can we allocate these devices now? ... mm ''no!'' ... ''stop''...''move back''... ''think''...

I will do the following: 
* Run this query to check if it's recognized as ''FOREIGN'' or ''CANDIDATE''
{{{
set lines 400
col name format a20
col label format a20
col path format a20
col redundancy format a20
select a.group_number, a.name, a.header_status, a.mount_status, a.state, a.total_mb, a.free_mb, a.label, path, a.redundancy
from v$asm_disk a
order by 1,2;

GROUP_NUMBER NAME                 HEADER_STATU STATE      TOTAL_MB    FREE_MB LABEL                PATH                 REDUNDANCY
------------ -------------------- ------------ -------- ---------- ---------- -------------------- -------------------- --------------------
}}}
* I've done some precautions on my data gathering by checking on the ''fstab'' and ''raw devices config'' and found out that ''there are no pointers to the two devices''.. 
** I have an obsessive–compulsive tendencies just to make sure that these devices are not used by some services. If accidentally these EMC power devices were used for something else let's say as a filesystem.. Oracle will still allow you to do the ADD/DROP operation on these devices wiping out all the data on those devices! 
* Another thing I would do is validate it with my storage engineer or the in-house DBA if these disks exist for the purpose of expanding the disk group. 

If everything is okay. I can safely say they are candidate disks for expanding the space of my current disk group and go ahead with the activity.


! 
! From Matt Zito (former EMC solutions architect)
<<<
Hey guys,

I haven't gotten this email address straightened out on Oracle-L yet, but I figured I'd drop you a note, and you could forward it on to the list if you cared to.

The doc you read is correct, powerpath will cheerfully work with any of the devices you send IOs to, because the kernel driver intercepts requests for all devices and routes them through itself before dishing them down the appropriate path.

However, setting scandisks to the emcpower has the administrative benefits of making sure the disks don't show up twice.  However, even if ASM picks the first of the two disks, it will still be load-balanced successfully.

Thanks,
Matt Zito
(former EMC solutions architect)
<<<

https://blogs.oracle.com/XPSONHA/entry/asr_snmp_on_exadata

Oracle Auto Service Request (ASR) [ID 1185493.1]
''ASR Documentation'' http://www.oracle.com/technetwork/server-storage/asr/documentation/index.html?ssSourceSiteId=ocomen


''10mins AWR snap interval, 144 samples in a day, 1008 samples in 7days, 4032 samples in 4weeks, 52560 samples in 1year''

''Good chapter on HOW to read AWR reports'' http://filezone.orapub.com/FF_Book/v4Chap9.pdf

{{{
Understand each field of AWR (Doc ID 884046.1)
AWR report is broken into multiple parts.

1)Instance information:-
This provides information the instance name , number,snapshot ids,total time the report was taken for and the database time during this elapsed time.

Elapsed time= end snapshot time - start snapshot time
Database time= Work done by database during this much elapsed time( CPU and I/o both add to Database time).If this is lesser than the elapsed time by a great margin, then database is idle.Database time does not include time spend by the background processes.

2)Cache Sizes : This shows the size of each SGA region after AMM has changed them. This information
can be compared to the original init.ora parameters at the end of the AWR report.

3)Load Profile: This important section shows important rates expressed in units of per second and
transactions per second.This is very important for understanding how is the instance behaving.This has to be compared to base line report to understand the expected load on the machine and the delta during bad times.

4)Instance Efficiency Percentages (Target 100%): This section talks about how close are the vital ratios like buffer cache hit, library cache hit,parses etc.These can be taken as indicators ,but should not be a cause of worry if they are low.As the ratios cold be low or high based in database activities, and not due to real performance problem.Hence these are not stand alone statistics, should be read for a high level view .

5)Shared Pool Statistics: This summarizes changes to the shared pool during the snapshot
period.

6)Top 5 Timed Events :This is the section which is most relevant for analysis.This section shows what % of database time was the wait event seen for.Till 9i, this was the way to backtrack what was the total database time for the report , as there was no Database time column in 9i.

7)RAC Statistics :This part is seen only incase of cluster instance.This provides important indication on the average time take for block transfer, block receiving , messages ., which can point to performance problems in the Cluster instead of database.

8)Wait Class : This Depicts which wait class was the area of contention and where we need to focus.Was that network, concurrency, cluster, i/o Application, configuration etc.

9)Wait Events Statistics Section: This section shows a breakdown of the main wait events in the
database including foreground and background database wait events as well as time model, operating
system, service, and wait classes statistics.

10)Wait Events: This AWR report section provides more detailed wait event information for foreground
user processes which includes Top 5 wait events and many other wait events that occurred during
the snapshot interval.

11)Background Wait Events: This section is relevant to the background process wait events.

12)Time Model Statistics: Time mode statistics report how database-processing time is spent. This
section contains detailed timing information on particular components participating in database
processing.This gives information about background process timing also which is not included in database time.

13)Operating System Statistics: This section is important from OS server contention point of view.This section shows the main external resources including I/O, CPU, memory, and network usage.

14)Service Statistics: The service statistics section gives information services and their load in terms of CPU seconds, i/o seconds, number of buffer reads etc.

15)SQL Section: This section displays top SQL, ordered by important SQL execution metrics.

a)SQL Ordered by Elapsed Time: Includes SQL statements that took significant execution
time during processing.

b)SQL Ordered by CPU Time: Includes SQL statements that consumed significant CPU time
during its processing.

c)SQL Ordered by Gets: These SQLs performed a high number of logical reads while
retrieving data.

d)SQL Ordered by Reads: These SQLs performed a high number of physical disk reads while
retrieving data.

e)SQL Ordered by Parse Calls: These SQLs experienced a high number of reparsing operations.

f)SQL Ordered by Sharable Memory: Includes SQL statements cursors which consumed a large
amount of SGA shared pool memory.

g)SQL Ordered by Version Count: These SQLs have a large number of versions in shared pool
for some reason.

16)Instance Activity Stats: This section contains statistical information describing how the database
operated during the snapshot period.

17)I/O Section: This section shows the all important I/O activity.This provides time it took to make 1 i/o say Av Rd(ms), and i/o per second say Av Rd/s.This should be compared to the baseline to see if the rate of i/o has always been like this or there is a diversion now.

18)Advisory Section: This section show details of the advisories for the buffer, shared pool, PGA and
Java pool.

19)Buffer Wait Statistics: This important section shows buffer cache waits statistics.

20)Enqueue Activity: This important section shows how enqueue operates in the database. Enqueues are
special internal structures which provide concurrent access to various database resources.

21)Undo Segment Summary: This section gives a summary about how undo segments are used by the database.
Undo Segment Stats: This section shows detailed history information about undo segment activity.

22)Latch Activity: This section shows details about latch statistics. Latches are a lightweight
serialization mechanism that is used to single-thread access to internal Oracle structures.The latch should be checked by its sleeps.The sleepiest Latch is the latch that is under contention , and not the latch with high requests.Hence  run through the sleep breakdown part of this section to arrive at the latch under highest contention.

23)Segment Section: This portion is important to make a guess in which segment and which segment type the contention could be.Tally this with the top 5 wait events.

Segments by Logical Reads: Includes top segments which experienced high number of
logical reads.

Segments by Physical Reads: Includes top segments which experienced high number of disk
physical reads.

Segments by Buffer Busy Waits: These segments have the largest number of buffer waits
caused by their data blocks.

Segments by Row Lock Waits: Includes segments that had a large number of row locks on
their data.

Segments by ITL Waits: Includes segments that had a large contention for Interested
Transaction List (ITL). The contention for ITL can be reduced by increasing INITRANS storage
parameter of the table.

24)Dictionary Cache Stats: This section exposes details about how the data dictionary cache is
operating.

25)Library Cache Activity: Includes library cache statistics  which are needed in case you see library cache in top 5 wait events.You might want to see if the reload/invalidations are causing the contention or there is some other issue with library cache.

26)SGA Memory Summary:This would tell us the difference in the respective pools at the start and end of report.This could be an indicator of setting minimum value for each, when sga)target is being used..

27)init.ora Parameters: This section shows the original init.ora parameters for the instance during
the snapshot period.

There would be more Sections in case of RAC setups to provide details.
}}}


''A SQL Performance History from AWR''
http://www.toadworld.com/BLOGS/tabid/67/EntryId/125/A-SQL-Performance-History-from-AWR.aspx  <-- This could also be possible to graph using my awr_topsqlx.sql

''miTrend AWR Report / StatsPack Gathering Procedures Instructions'' https://community.emc.com/docs/DOC-13949 <-- EMCs tool with nice PPT and paper, also talks about "burst" periods for IO sizing, raid adjusted IOPS, EFDs IOPS

http://pavandba.files.wordpress.com/2009/11/owp_awr_historical_analysis.pdf







{{{
set arraysize 5000

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

ttitle center 'AWR Top SQL Report' skip 2
set pagesize 50000
set linesize 300

col snap_id     format 99999            heading "Snap|ID"
col tm          format a15              heading "Snap|Start|Time"
col inst        format 90               heading "i|n|s|t|#"
col dur         format 990.00          heading "Snap|Dur|(m)"
col sql_id      format a15              heading "SQL|ID"
col phv         format 99999999999      heading "Plan|Hash|Value"
col module      format a20              heading "Module"
col elap        format 999990.00        heading "Elapsed|Time|(s)"
col elapexec    format 999990.00        heading "Elapsed|Time|per exec|(s)"
col cput        format 999990.00        heading "CPU|Time|(s)"
col iowait      format 999990.00        heading "IO|Wait|(s)"
col bget        format 99999999990      heading "LIO"
col dskr        format 99999999990      heading "PIO"
col rowp        format 99999999990      heading "Rows"
col exec        format 9999990          heading "Exec"
col prsc        format 999999990        heading "Parse|Count"
col pxexec      format 9999990          heading "PX|Exec"
col pctdbt      format 990              heading "DB Time|%"
col aas         format 990.00           heading "A|A|S"
col time_rank   format 90               heading "Time|Rank"
col sql_text    format a40              heading "SQL|Text"

     select *
       from (
             select
                  sqt.snap_id snap_id,
                  TO_CHAR(sqt.tm,'MM/DD/YY HH24:MI') tm,
                  sqt.inst inst,
                  sqt.dur dur,
                  sqt.sql_id sql_id,   
                  sqt.phv phv,                
                  to_clob(decode(sqt.module, null, null, sqt.module)) module,
                  nvl((sqt.elap), to_number(null)) elap,
                  nvl((sqt.elapexec), to_number(null)) elapexec,
                  nvl((sqt.cput), to_number(null)) cput,
                  sqt.iowait iowait,
                  sqt.bget bget, 
                  sqt.dskr dskr, 
                  sqt.rowp rowp,
                  sqt.exec exec, 
                  sqt.prsc prsc, 
                  sqt.pxexec pxexec,
                  sqt.aas aas,
                  sqt.time_rank time_rank
                  , nvl(st.sql_text, to_clob('** SQL Text Not Available **')) sql_text     -- PUT/REMOVE COMMENT TO HIDE/SHOW THE SQL_TEXT
             from        (
                          select snap_id, tm, inst, dur, sql_id, phv, module, elap, elapexec, cput, iowait, bget, dskr, rowp, exec, prsc, pxexec, aas, time_rank
                          from
                                             (
                                               select 
                                                      s0.snap_id snap_id,
                                                      s0.END_INTERVAL_TIME tm,
                                                      s0.instance_number inst,
                                                      round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                      e.sql_id sql_id, 
                                                      e.plan_hash_value phv, 
                                                      max(e.module) module,
                                                      sum(e.elapsed_time_delta)/1000000 elap,
                                                      decode((sum(e.executions_delta)), 0, to_number(null), ((sum(e.elapsed_time_delta)) / (sum(e.executions_delta)) / 1000000)) elapexec,
                                                      sum(e.cpu_time_delta)/1000000     cput, 
                                                      sum(e.iowait_delta)/1000000 iowait,
                                                      sum(e.buffer_gets_delta) bget,
                                                      sum(e.disk_reads_delta) dskr, 
                                                      sum(e.rows_processed_delta) rowp,
                                                      sum(e.executions_delta)   exec,
                                                      sum(e.parse_calls_delta) prsc,
                                                      sum(px_servers_execs_delta) pxexec,
                                                      (sum(e.elapsed_time_delta)/1000000) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60) aas,
                                                      DENSE_RANK() OVER (
                                                      PARTITION BY s0.snap_id ORDER BY e.elapsed_time_delta DESC) time_rank
                                               from 
                                                   dba_hist_snapshot s0,
                                                   dba_hist_snapshot s1,
                                                   dba_hist_sqlstat e
                                                   where 
                                                    s0.dbid                   = &_dbid                -- CHANGE THE DBID HERE!
                                                    AND s1.dbid               = s0.dbid
                                                    and e.dbid                = s0.dbid                                                
                                                    AND s0.instance_number    = &_instancenumber      -- CHANGE THE INSTANCE_NUMBER HERE!
                                                    AND s1.instance_number    = s0.instance_number
                                                    and e.instance_number     = s0.instance_number                                                 
                                                    AND s1.snap_id            = s0.snap_id + 1
                                                    and e.snap_id             = s0.snap_id + 1                                              
                                               group by 
                                                    s0.snap_id, s0.END_INTERVAL_TIME, s0.instance_number, e.sql_id, e.plan_hash_value, e.elapsed_time_delta, s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME
                                             )
                          where 
                          time_rank <= 5                                     -- GET TOP 5 SQL ACROSS SNAP_IDs... YOU CAN ALTER THIS TO HAVE MORE DATA POINTS
                         ) 
                        sqt,
                        dba_hist_sqltext st 
             where st.sql_id(+)             = sqt.sql_id
             and st.dbid(+)                 = &_dbid
-- AND TO_CHAR(tm,'D') >= 1                                                  -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900                                          -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- AND snap_id in (338,339)
-- AND snap_id >= 335 and snap_id <= 339
-- AND snap_id = 3172
-- and sqt.sql_id = 'dj3n91vxsyaq5'
-- AND lower(st.sql_text) like 'select%'
-- AND lower(st.sql_text) like 'insert%'
-- AND lower(st.sql_text) like 'update%'
-- AND lower(st.sql_text) like 'merge%'
-- AND pxexec > 0
-- AND aas > .5
             order by 
             -- snap_id                             -- TO GET SQL OUTPUT ACROSS SNAP_IDs SEQUENTIALLY AND ASC
             nvl(sqt.elap, -1) desc, sqt.sql_id     -- TO GET SQL OUTPUT BY ELAPSED TIME
             )
where rownum <= 20
;
}}}
{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR CPU and IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              heading instname        -- instname
col hostname    format a30              heading hostname        -- hostname
col tm          format a17              heading tm              -- "tm"
col id          format 99999            heading id              -- "snapid"
col inst        format 90               heading inst            -- "inst"
col dur         format 999990.00        heading dur             -- "dur"
col cpu         format 90               heading cpu             -- "cpu"
col cap         format 9999990.00       heading cap             -- "capacity"
col dbt         format 999990.00        heading dbt             -- "DBTime"
col dbc         format 99990.00         heading dbc             -- "DBcpu"
col bgc         format 99990.00         heading bgc             -- "BGcpu"
col rman        format 9990.00          heading rman            -- "RMANcpu"
col aas         format 990.0            heading aas             -- "AAS"
col totora      format 9999990.00       heading totora          -- "TotalOracleCPU"
col busy        format 9999990.00       heading busy            -- "BusyTime"
col load        format 990.00           heading load            -- "OSLoad"
col totos       format 9999990.00       heading totos           -- "TotalOSCPU"
col mem         format 999990.00        heading mem             -- "PhysicalMemorymb"
col IORs        format 9990.000         heading IORs            -- "IOPsr"
col IOWs        format 9990.000         heading IOWs            -- "IOPsw"
col IORedo      format 9990.000         heading IORedo          -- "IOPsredo"
col IORmbs      format 9990.000         heading IORmbs          -- "IOrmbs"
col IOWmbs      format 9990.000         heading IOWmbs          -- "IOwmbs"
col redosizesec format 9990.000         heading redosizesec     -- "Redombs"
col logons      format 990              heading logons          -- "Sess"
col logone      format 990              heading logone          -- "SessEnd"
col exsraw      format 99990.000        heading exsraw          -- "Execrawdelta"
col exs         format 9990.000         heading exs             -- "Execs"
col ucs         format 9990.000         heading ucs             -- "UserCalls"
col ucoms       format 9990.000         heading ucoms           -- "Commit"
col urs         format 9990.000         heading urs             -- "Rollback"
col oracpupct   format 990              heading oracpupct       -- "OracleCPUPct"
col rmancpupct  format 990              heading rmancpupct      -- "RMANCPUPct"
col oscpupct    format 990              heading oscpupct        -- "OSCPUPct"
col oscpuusr    format 990              heading oscpuusr        -- "USRPct"
col oscpusys    format 990              heading oscpusys        -- "SYSPct"
col oscpuio     format 990              heading oscpuio         -- "IOPct"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
          s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
  s3t1.value AS cpu,
  (round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value cap,
  (s5t1.value - s5t0.value) / 1000000 as dbt,
  (s6t1.value - s6t0.value) / 1000000 as dbc,
  (s7t1.value - s7t0.value) / 1000000 as bgc,
  round(DECODE(s8t1.value,null,'null',(s8t1.value - s8t0.value) / 1000000),2) as rman,
  ((s5t1.value - s5t0.value) / 1000000)/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,
  round(((s6t1.value - s6t0.value) / 1000000) + ((s7t1.value - s7t0.value) / 1000000),2) totora,
  -- s1t1.value - s1t0.value AS busy,  -- this is osstat BUSY_TIME
  round(s2t1.value,2) AS load,
  (s1t1.value - s1t0.value)/100 AS totos,
  ((round(((s6t1.value - s6t0.value) / 1000000) + ((s7t1.value - s7t0.value) / 1000000),2)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oracpupct,
  ((round(DECODE(s8t1.value,null,'null',(s8t1.value - s8t0.value) / 1000000),2)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as rmancpupct,
  (((s1t1.value - s1t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpupct,
  (((s17t1.value - s17t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpuusr,
  (((s18t1.value - s18t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpusys,
  (((s19t1.value - s19t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpuio
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_osstat s1t0,         -- BUSY_TIME
  dba_hist_osstat s1t1,
  dba_hist_osstat s17t0,        -- USER_TIME
  dba_hist_osstat s17t1,
  dba_hist_osstat s18t0,        -- SYS_TIME
  dba_hist_osstat s18t1,
  dba_hist_osstat s19t0,        -- IOWAIT_TIME
  dba_hist_osstat s19t1,
  dba_hist_osstat s2t1,         -- osstat just get the end value
  dba_hist_osstat s3t1,         -- osstat just get the end value
  dba_hist_sys_time_model s5t0,
  dba_hist_sys_time_model s5t1,
  dba_hist_sys_time_model s6t0,
  dba_hist_sys_time_model s6t1,
  dba_hist_sys_time_model s7t0,
  dba_hist_sys_time_model s7t1,
  dba_hist_sys_time_model s8t0,
  dba_hist_sys_time_model s8t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s1t0.dbid            = s0.dbid
AND s1t1.dbid            = s0.dbid
AND s2t1.dbid            = s0.dbid
AND s3t1.dbid            = s0.dbid
AND s5t0.dbid            = s0.dbid
AND s5t1.dbid            = s0.dbid
AND s6t0.dbid            = s0.dbid
AND s6t1.dbid            = s0.dbid
AND s7t0.dbid            = s0.dbid
AND s7t1.dbid            = s0.dbid
AND s8t0.dbid            = s0.dbid
AND s8t1.dbid            = s0.dbid
AND s17t0.dbid            = s0.dbid
AND s17t1.dbid            = s0.dbid
AND s18t0.dbid            = s0.dbid
AND s18t1.dbid            = s0.dbid
AND s19t0.dbid            = s0.dbid
AND s19t1.dbid            = s0.dbid
AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s1t0.instance_number = s0.instance_number
AND s1t1.instance_number = s0.instance_number
AND s2t1.instance_number = s0.instance_number
AND s3t1.instance_number = s0.instance_number
AND s5t0.instance_number = s0.instance_number
AND s5t1.instance_number = s0.instance_number
AND s6t0.instance_number = s0.instance_number
AND s6t1.instance_number = s0.instance_number
AND s7t0.instance_number = s0.instance_number
AND s7t1.instance_number = s0.instance_number
AND s8t0.instance_number = s0.instance_number
AND s8t1.instance_number = s0.instance_number
AND s17t0.instance_number = s0.instance_number
AND s17t1.instance_number = s0.instance_number
AND s18t0.instance_number = s0.instance_number
AND s18t1.instance_number = s0.instance_number
AND s19t0.instance_number = s0.instance_number
AND s19t1.instance_number = s0.instance_number
AND s1.snap_id           = s0.snap_id + 1
AND s1t0.snap_id         = s0.snap_id
AND s1t1.snap_id         = s0.snap_id + 1
AND s2t1.snap_id         = s0.snap_id + 1
AND s3t1.snap_id         = s0.snap_id + 1
AND s5t0.snap_id         = s0.snap_id
AND s5t1.snap_id         = s0.snap_id + 1
AND s6t0.snap_id         = s0.snap_id
AND s6t1.snap_id         = s0.snap_id + 1
AND s7t0.snap_id         = s0.snap_id
AND s7t1.snap_id         = s0.snap_id + 1
AND s8t0.snap_id         = s0.snap_id
AND s8t1.snap_id         = s0.snap_id + 1
AND s17t0.snap_id         = s0.snap_id
AND s17t1.snap_id         = s0.snap_id + 1
AND s18t0.snap_id         = s0.snap_id
AND s18t1.snap_id         = s0.snap_id + 1
AND s19t0.snap_id         = s0.snap_id
AND s19t1.snap_id         = s0.snap_id + 1
AND s1t0.stat_name       = 'BUSY_TIME'
AND s1t1.stat_name       = s1t0.stat_name
AND s17t0.stat_name       = 'USER_TIME'
AND s17t1.stat_name       = s17t0.stat_name
AND s18t0.stat_name       = 'SYS_TIME'
AND s18t1.stat_name       = s18t0.stat_name
AND s19t0.stat_name       = 'IOWAIT_TIME'
AND s19t1.stat_name       = s19t0.stat_name
AND s2t1.stat_name       = 'LOAD'
AND s3t1.stat_name       = 'NUM_CPUS'
AND s5t0.stat_name       = 'DB time'
AND s5t1.stat_name       = s5t0.stat_name
AND s6t0.stat_name       = 'DB CPU'
AND s6t1.stat_name       = s6t0.stat_name
AND s7t0.stat_name       = 'background cpu time'
AND s7t1.stat_name       = s7t0.stat_name
AND s8t0.stat_name       = 'RMAN cpu time (backup/restore)'
AND s8t1.stat_name       = s8t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (336)
-- aas > 1
-- oracpupct > 50
-- oscpupct > 50
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
{{{

-- TO VIEW DB INFO
set lines 300
select dbid,instance_number,version,db_name,instance_name, host_name 
from dba_hist_database_instance 
where instance_number = (select instance_number from v$instance)
and rownum < 2;

-- TO VIEW RETENTION INFORMATION
select * from dba_hist_wr_control;
set lines 300
select b.name, a.DBID,
   ((TRUNC(SYSDATE) + a.SNAP_INTERVAL - TRUNC(SYSDATE)) * 86400)/60 AS SNAP_INTERVAL_MINS,
   ((TRUNC(SYSDATE) + a.RETENTION - TRUNC(SYSDATE)) * 86400)/60 AS RETENTION_MINS,
   ((TRUNC(SYSDATE) + a.RETENTION - TRUNC(SYSDATE)) * 86400)/60/60/24 AS RETENTION_DAYS,
   TOPNSQL
from dba_hist_wr_control a, v$database b
where a.dbid = b.dbid;

/*
-- SET RETENTION PEROID TO 31 DAYS (UNIT IS MINUTES)
execute dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 43200);
-- SET RETENTION PEROID TO 365 DAYS (UNIT IS MINUTES)
exec dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 525600);

-- Create Snapshot
BEGIN
  DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
END;
/
*/

-- AWR get recent snapshot
set lines 300
select * from 
(SELECT s0.instance_number, s0.snap_id, 
  to_char(s0.startup_time,'yyyy-mon-dd hh24:mi:ss') startup_time,
  TO_CHAR(s0.END_INTERVAL_TIME,'yyyy-mon-dd hh24:mi:ss') snap_start,
  TO_CHAR(s1.END_INTERVAL_TIME,'yyyy-mon-dd hh24:mi:ss') snap_end,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) ela_min
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1
WHERE s1.snap_id           = s0.snap_id + 1
ORDER BY snap_id DESC)
where rownum < 11;

-- MIN/MAX for dba_hist tables
select count(*) snap_count from dba_hist_snapshot;
select min(snap_id) min_snap, max(snap_id) max_snap from dba_hist_snapshot;
select to_char(min(end_interval_time),'yyyy-mon-dd hh24:mi:ss') min_date, to_char(max(end_interval_time),'yyyy-mon-dd hh24:mi:ss') max_date from dba_hist_snapshot;


/*
-- STATSPACK get recent snapshot
	  set lines 300
	  col what format a30
	  set numformat 999999999999999
	  alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
	  select sysdate from dual;
	  select instance, what, job, next_date, next_sec from user_jobs;
	  select * from 
	      (select 
		    s0.instance_number, s0.snap_id snap_id, s0.startup_time,
		    to_char(s0.snap_time,'YYYY-Mon-DD HH24:MI:SS') snap_start,
		    to_char(s1.snap_time,'YYYY-Mon-DD HH24:MI:SS') snap_end,
		    (s1.snap_time-s0.snap_time)*24*60 ela_min,
		    s0.dbid, s0.snap_level, s0.snapshot_exec_time_s 
	      from	stats$snapshot s0,
		      stats$snapshot s1
	      where s1.snap_id  = s0.snap_id + 1
	      ORDER BY s0.snap_id DESC)
	      where rownum < 11;


-- MIN/MAX for statspack tables
col min_dt format a14
col max_dt format a14
col host_name format a12
select	
	t1.dbid, 
	t1.instance_number,
        t2.version,
        t2.db_name,
	t2.instance_name,
        t2.host_name,
	min(to_char(t1.snap_time,'YYYY-Mon-DD HH24')) min_dt,
	max(to_char(t1.snap_time,'YYYY-Mon-DD HH24')) max_dt
from	stats$snapshot t1,
        stats$database_instance t2
where   t1.dbid = t2.dbid
  and   t1.snap_id = t2.snap_id
group by
	t1.dbid, 
	t1.instance_number,
        t2.version,
        t2.db_name,
	t2.instance_name,
        t2.host_name
/
*/


/*
AWR reports:

Running Workload Repository Reports Using Enterprise Manager
Running Workload Repository Compare Period Report Using Enterprise Manager
Running Workload Repository Reports Using SQL Scripts



Running Workload Repository Reports Using SQL Scripts
-----------------------------------------------------

You can view AWR reports by running the following SQL scripts:

The @?/rdbms/admin/awrrpt.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids.

The awrrpti.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids on 
a specified database and instance.

The awrsqrpt.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a 
range of snapshot Ids. Run this report to inspect or debug the performance of a SQL statement.

The awrsqrpi.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a 
range of snapshot Ids on a specified database and instance. Run this report to inspect or debug the performance of a SQL statement on a specific database and instance.

The awrddrpt.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration 
settings between two selected time periods.

The awrddrpi.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration 
settings between two selected time periods on a specific database and instance.

awrsqrpt.sql -- SQL performance report
*/

}}}
{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname       format a15              heading instname            -- instname
col hostname       format a30              heading hostname            -- hostname
col tm             format a17              heading tm                  -- "tm"
col id             format 99999            heading id                  -- "snapid"
col inst           format 90               heading inst                -- "inst"
col dur            format 999990.00        heading dur                 -- "dur"
col cpu            format 90               heading cpu                 -- "cpu"
col cap            format 9999990.00       heading cap                 -- "capacity"
col dbt            format 999990.00        heading dbt                 -- "DBTime"
col dbc            format 99990.00         heading dbc                 -- "DBcpu"
col bgc            format 99990.00         heading bgc                 -- "BGcpu"
col rman           format 9990.00          heading rman                -- "RMANcpu"
col aas            format 990.0            heading aas                 -- "AAS"
col totora         format 9999990.00       heading totora              -- "TotalOracleCPU"
col busy           format 9999990.00       heading busy                -- "BusyTime"
col load           format 990.00           heading load                -- "OSLoad"
col totos          format 9999990.00       heading totos               -- "TotalOSCPU"
col mem            format 999990.00        heading mem                 -- "PhysicalMemorymb"
col IORs           format 99990.000        heading IORs                -- "IOPsr"
col IOWs           format 99990.000        heading IOWs                -- "IOPsw"
col IORedo         format 99990.000        heading IORedo              -- "IOPsredo"
col IORmbs         format 99990.000        heading IORmbs              -- "IOrmbs"
col IOWmbs         format 99990.000        heading IOWmbs              -- "IOwmbs"
col redosizesec    format 99990.000        heading redosizesec         -- "Redombs"
col logons         format 990              heading logons              -- "Sess"
col logone         format 990              heading logone              -- "SessEnd"
col exsraw         format 99990.000        heading exsraw              -- "Execrawdelta"
col exs            format 9990.000         heading exs                 -- "Execs"
col oracpupct      format 990              heading oracpupct           -- "OracleCPUPct"
col rmancpupct     format 990              heading rmancpupct          -- "RMANCPUPct"
col oscpupct       format 990              heading oscpupct            -- "OSCPUPct"
col oscpuusr       format 990              heading oscpuusr            -- "USRPct"
col oscpusys       format 990              heading oscpusys            -- "SYSPct"
col oscpuio        format 990              heading oscpuio             -- "IOPct"
col SIORs          format 99990.000        heading SIORs               -- "IOPsSingleBlockr"
col MIORs          format 99990.000        heading MIORs               -- "IOPsMultiBlockr"
col TIORmbs        format 99990.000        heading TIORmbs             -- "Readmbs"
col SIOWs          format 99990.000        heading SIOWs               -- "IOPsSingleBlockw"
col MIOWs          format 99990.000        heading MIOWs               -- "IOPsMultiBlockw"
col TIOWmbs        format 99990.000        heading TIOWmbs             -- "Writembs"
col TIOR           format 99990.000        heading TIOR                -- "TotalIOPsr"
col TIOW           format 99990.000        heading TIOW                -- "TotalIOPsw"
col TIOALL         format 99990.000        heading TIOALL              -- "TotalIOPsALL"
col ALLRmbs        format 99990.000        heading ALLRmbs             -- "TotalReadmbs"
col ALLWmbs        format 99990.000        heading ALLWmbs             -- "TotalWritembs"
col GRANDmbs       format 99990.000        heading GRANDmbs            -- "TotalmbsALL"
col readratio      format 990              heading readratio           -- "ReadRatio"
col writeratio     format 990              heading writeratio          -- "WriteRatio"
col diskiops       format 99990.000        heading diskiops            -- "HWDiskIOPs"
col numdisks       format 99990.000        heading numdisks            -- "HWNumofDisks"
col flashcache     format 990              heading flashcache          -- "FlashCacheHitsPct"
col cellpiob       format 99990.000        heading cellpiob            -- "CellPIOICmbs"
col cellpiobss     format 99990.000        heading cellpiobss          -- "CellPIOICSmartScanmbs"
col cellpiobpreoff format 99990.000        heading cellpiobpreoff      -- "CellPIOpredoffloadmbs"
col cellpiobsi     format 99990.000        heading cellpiobsi          -- "CellPIOstorageindexmbs"
col celliouncomb   format 99990.000        heading celliouncomb        -- "CellIOuncompmbs"
col cellpiobs      format 99990.000        heading cellpiobs           -- "CellPIOsavedfilecreationmbs"
col cellpiobsrman  format 99990.000        heading cellpiobsrman       -- "CellPIOsavedRMANfilerestorembs"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
         s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
   (((s20t1.value - s20t0.value) - (s21t1.value - s21t0.value)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as SIORs,
   ((s21t1.value - s21t0.value) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as MIORs,
   (((s22t1.value - s22t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as TIORmbs,
   (((s23t1.value - s23t0.value) - (s24t1.value - s24t0.value)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as SIOWs,
   ((s24t1.value - s24t0.value) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as MIOWs,
   (((s25t1.value - s25t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as TIOWmbs,
   ((s13t1.value - s13t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as IORedo, 
   (((s14t1.value - s14t0.value)/1024/1024)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as redosizesec,
    ((s33t1.value - s33t0.value) / (s20t1.value - s20t0.value))*100 as flashcache,
   (((s26t1.value - s26t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiob,
   (((s31t1.value - s31t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobss,
   (((s29t1.value - s29t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobpreoff,
   (((s30t1.value - s30t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobsi,
   (((s32t1.value - s32t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as celliouncomb,
   (((s27t1.value - s27t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobs,
   (((s28t1.value - s28t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobsrman
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_sysstat s13t0,       -- redo writes, diffed
  dba_hist_sysstat s13t1,
  dba_hist_sysstat s14t0,       -- redo size, diffed
  dba_hist_sysstat s14t1,
  dba_hist_sysstat s20t0,       -- physical read total IO requests, diffed
  dba_hist_sysstat s20t1,
  dba_hist_sysstat s21t0,       -- physical read total multi block requests, diffed
  dba_hist_sysstat s21t1,  
  dba_hist_sysstat s22t0,       -- physical read total bytes, diffed
  dba_hist_sysstat s22t1,  
  dba_hist_sysstat s23t0,       -- physical write total IO requests, diffed
  dba_hist_sysstat s23t1,
  dba_hist_sysstat s24t0,       -- physical write total multi block requests, diffed
  dba_hist_sysstat s24t1,
  dba_hist_sysstat s25t0,       -- physical write total bytes, diffed
  dba_hist_sysstat s25t1,
  dba_hist_sysstat s26t0,       -- cell physical IO interconnect bytes, diffed, cellpiob
  dba_hist_sysstat s26t1,
  dba_hist_sysstat s27t0,       -- cell physical IO bytes saved during optimized file creation, diffed, cellpiobs
  dba_hist_sysstat s27t1,
  dba_hist_sysstat s28t0,       -- cell physical IO bytes saved during optimized RMAN file restore, diffed, cellpiobsrman
  dba_hist_sysstat s28t1,
  dba_hist_sysstat s29t0,       -- cell physical IO bytes eligible for predicate offload, diffed, cellpiobpreoff
  dba_hist_sysstat s29t1,
  dba_hist_sysstat s30t0,       -- cell physical IO bytes saved by storage index, diffed, cellpiobsi
  dba_hist_sysstat s30t1,
  dba_hist_sysstat s31t0,       -- cell physical IO interconnect bytes returned by smart scan, diffed, cellpiobss
  dba_hist_sysstat s31t1,
  dba_hist_sysstat s32t0,       -- cell IO uncompressed bytes, diffed, celliouncomb
  dba_hist_sysstat s32t1,
  dba_hist_sysstat s33t0,       -- cell flash cache read hits
  dba_hist_sysstat s33t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s13t0.dbid            = s0.dbid
AND s13t1.dbid            = s0.dbid
AND s14t0.dbid            = s0.dbid
AND s14t1.dbid            = s0.dbid
AND s20t0.dbid            = s0.dbid
AND s20t1.dbid            = s0.dbid
AND s21t0.dbid            = s0.dbid
AND s21t1.dbid            = s0.dbid
AND s22t0.dbid            = s0.dbid
AND s22t1.dbid            = s0.dbid
AND s23t0.dbid            = s0.dbid
AND s23t1.dbid            = s0.dbid
AND s24t0.dbid            = s0.dbid
AND s24t1.dbid            = s0.dbid
AND s25t0.dbid            = s0.dbid
AND s25t1.dbid            = s0.dbid
AND s26t0.dbid            = s0.dbid
AND s26t1.dbid            = s0.dbid
AND s27t0.dbid            = s0.dbid
AND s27t1.dbid            = s0.dbid
AND s28t0.dbid            = s0.dbid
AND s28t1.dbid            = s0.dbid
AND s29t0.dbid            = s0.dbid
AND s29t1.dbid            = s0.dbid
AND s30t0.dbid            = s0.dbid
AND s30t1.dbid            = s0.dbid
AND s31t0.dbid            = s0.dbid
AND s31t1.dbid            = s0.dbid
AND s32t0.dbid            = s0.dbid
AND s32t1.dbid            = s0.dbid
AND s33t0.dbid            = s0.dbid
AND s33t1.dbid            = s0.dbid
AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s13t0.instance_number = s0.instance_number
AND s13t1.instance_number = s0.instance_number
AND s14t0.instance_number = s0.instance_number
AND s14t1.instance_number = s0.instance_number
AND s20t0.instance_number = s0.instance_number
AND s20t1.instance_number = s0.instance_number
AND s21t0.instance_number = s0.instance_number
AND s21t1.instance_number = s0.instance_number
AND s22t0.instance_number = s0.instance_number
AND s22t1.instance_number = s0.instance_number
AND s23t0.instance_number = s0.instance_number
AND s23t1.instance_number = s0.instance_number
AND s24t0.instance_number = s0.instance_number
AND s24t1.instance_number = s0.instance_number
AND s25t0.instance_number = s0.instance_number
AND s25t1.instance_number = s0.instance_number
AND s26t0.instance_number = s0.instance_number
AND s26t1.instance_number = s0.instance_number
AND s27t0.instance_number = s0.instance_number
AND s27t1.instance_number = s0.instance_number
AND s28t0.instance_number = s0.instance_number
AND s28t1.instance_number = s0.instance_number
AND s29t0.instance_number = s0.instance_number
AND s29t1.instance_number = s0.instance_number
AND s30t0.instance_number = s0.instance_number
AND s30t1.instance_number = s0.instance_number
AND s31t0.instance_number = s0.instance_number
AND s31t1.instance_number = s0.instance_number
AND s32t0.instance_number = s0.instance_number
AND s32t1.instance_number = s0.instance_number
AND s33t0.instance_number = s0.instance_number
AND s33t1.instance_number = s0.instance_number
AND s1.snap_id            = s0.snap_id + 1
AND s13t0.snap_id         = s0.snap_id
AND s13t1.snap_id         = s0.snap_id + 1
AND s14t0.snap_id         = s0.snap_id
AND s14t1.snap_id         = s0.snap_id + 1
AND s20t0.snap_id         = s0.snap_id
AND s20t1.snap_id         = s0.snap_id + 1
AND s21t0.snap_id         = s0.snap_id
AND s21t1.snap_id         = s0.snap_id + 1
AND s22t0.snap_id         = s0.snap_id
AND s22t1.snap_id         = s0.snap_id + 1
AND s23t0.snap_id         = s0.snap_id
AND s23t1.snap_id         = s0.snap_id + 1
AND s24t0.snap_id         = s0.snap_id
AND s24t1.snap_id         = s0.snap_id + 1
AND s25t0.snap_id         = s0.snap_id
AND s25t1.snap_id         = s0.snap_id + 1
AND s26t0.snap_id         = s0.snap_id
AND s26t1.snap_id         = s0.snap_id + 1
AND s27t0.snap_id         = s0.snap_id
AND s27t1.snap_id         = s0.snap_id + 1
AND s28t0.snap_id         = s0.snap_id
AND s28t1.snap_id         = s0.snap_id + 1
AND s29t0.snap_id         = s0.snap_id
AND s29t1.snap_id         = s0.snap_id + 1
AND s30t0.snap_id         = s0.snap_id
AND s30t1.snap_id         = s0.snap_id + 1
AND s31t0.snap_id         = s0.snap_id
AND s31t1.snap_id         = s0.snap_id + 1
AND s32t0.snap_id         = s0.snap_id
AND s32t1.snap_id         = s0.snap_id + 1
AND s33t0.snap_id         = s0.snap_id
AND s33t1.snap_id         = s0.snap_id + 1
AND s13t0.stat_name       = 'redo writes'
AND s13t1.stat_name       = s13t0.stat_name
AND s14t0.stat_name       = 'redo size'
AND s14t1.stat_name       = s14t0.stat_name
AND s20t0.stat_name       = 'physical read total IO requests'
AND s20t1.stat_name       = s20t0.stat_name
AND s21t0.stat_name       = 'physical read total multi block requests'
AND s21t1.stat_name       = s21t0.stat_name
AND s22t0.stat_name       = 'physical read total bytes'
AND s22t1.stat_name       = s22t0.stat_name
AND s23t0.stat_name       = 'physical write total IO requests'
AND s23t1.stat_name       = s23t0.stat_name
AND s24t0.stat_name       = 'physical write total multi block requests'
AND s24t1.stat_name       = s24t0.stat_name
AND s25t0.stat_name       = 'physical write total bytes'
AND s25t1.stat_name       = s25t0.stat_name
AND s26t0.stat_name       = 'cell physical IO interconnect bytes'
AND s26t1.stat_name       = s26t0.stat_name
AND s27t0.stat_name       = 'cell physical IO bytes saved during optimized file creation'
AND s27t1.stat_name       = s27t0.stat_name
AND s28t0.stat_name       = 'cell physical IO bytes saved during optimized RMAN file restore'
AND s28t1.stat_name       = s28t0.stat_name
AND s29t0.stat_name       = 'cell physical IO bytes eligible for predicate offload'
AND s29t1.stat_name       = s29t0.stat_name
AND s30t0.stat_name       = 'cell physical IO bytes saved by storage index'
AND s30t1.stat_name       = s30t0.stat_name
AND s31t0.stat_name       = 'cell physical IO interconnect bytes returned by smart scan'
AND s31t1.stat_name       = s31t0.stat_name
AND s32t0.stat_name       = 'cell IO uncompressed bytes'
AND s32t1.stat_name       = s32t0.stat_name
AND s33t0.stat_name       = 'cell flash cache read hits'
AND s33t1.stat_name       = s33t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (338)
-- aas > 1
-- oscpuio > 50
-- rmancpupct > 0
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
{{{
set arraysize 5000

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Services Statistics Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15
col hostname    format a30
col tm          format a15              heading tm           --"Snap|Start|Time"
col id          format 99999            heading id           --"Snap|ID"
col inst        format 90               heading inst         --"i|n|s|t|#"
col dur         format 999990.00        heading dur          --"Snap|Dur|(m)"
col cpu         format 90               heading cpu          --"C|P|U"
col cap         format 9999990.00       heading cap          --"***|Total|CPU|Time|(s)"
col dbt         format 999990.00        heading dbt          --"DB|Time"
col dbc         format 99990.00         heading dbc          --"DB|CPU"
col bgc         format 99990.00         heading bgc          --"Bg|CPU"
col rman        format 9990.00          heading rman         --"RMAN|CPU"
col aas         format 990.0            heading aas          --"A|A|S"
col totora      format 9999990.00       heading totora       --"***|Total|Oracle|CPU|(s)"
col busy        format 9999990.00       heading busy         --"Busy|Time"
col load        format 990.00           heading load         --"OS|Load"
col totos       format 9999990.00       heading totos        --"***|Total|OS|CPU|(s)"
col mem         format 999990.00        heading mem          --"Physical|Memory|(mb)"
col IORs        format 9990.000         heading IORs         --"IOPs|r"
col IOWs        format 9990.000         heading IOWs         --"IOPs|w"
col IORedo      format 9990.000         heading IORedo       --"IOPs|redo"
col IORmbs      format 9990.000         heading IORmbs       --"IO r|(mb)/s"
col IOWmbs      format 9990.000         heading IOWmbs       --"IO w|(mb)/s"
col redosizesec format 9990.000         heading redosizesec  --"Redo|(mb)/s"
col logons      format 990              heading logons       --"Sess"
col logone      format 990              heading logone       --"Sess|End"
col exsraw      format 99990.000        heading exsraw       --"Exec|raw|delta"
col exs         format 9990.000         heading exs          --"Exec|/s"
col oracpupct   format 990              heading oracpupct    --"Oracle|CPU|%"
col rmancpupct  format 990              heading rmancpupct   --"RMAN|CPU|%"
col oscpupct    format 990              heading oscpupct     --"OS|CPU|%"
col oscpuusr    format 990              heading oscpuusr     --"U|S|R|%"
col oscpusys    format 990              heading oscpusys     --"S|Y|S|%"
col oscpuio     format 990              heading oscpuio      --"I|O|%"
col phy_reads   format 99999990.00      heading phy_reads    --"physical|reads"
col log_reads   format 99999990.00      heading log_reads    --"logical|reads"

select  trim('&_instname') instname, trim('&_dbid') db_id, trim('&_hostname') hostname, snap_id,
        TO_CHAR(tm,'MM/DD/YY HH24:MI:SS') tm, 
        inst,
        dur,
        service_name, 
        round(db_time / 1000000, 1) as dbt, 
        round(db_cpu  / 1000000, 1) as dbc,
        phy_reads, 
        log_reads,
        aas
 from (select 
          s1.snap_id,
          s1.tm,
          s1.inst,
          s1.dur,
          s1.service_name, 
          sum(decode(s1.stat_name, 'DB time', s1.diff, 0)) db_time,
          sum(decode(s1.stat_name, 'DB CPU',  s1.diff, 0)) db_cpu,
          sum(decode(s1.stat_name, 'physical reads', s1.diff, 0)) phy_reads,
          sum(decode(s1.stat_name, 'session logical reads', s1.diff, 0)) log_reads,
          round(sum(decode(s1.stat_name, 'DB time', s1.diff, 0))/1000000,1)/60 / s1.dur as aas
   from
     (select s0.snap_id snap_id,
             s0.END_INTERVAL_TIME tm,
             s0.instance_number inst,
            round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
             e.service_name     service_name, 
             e.stat_name        stat_name, 
             e.value - b.value  diff
       from dba_hist_snapshot s0,
            dba_hist_snapshot s1,
            dba_hist_service_stat b,
            dba_hist_service_stat e
       where 
         s0.dbid                  = &_dbid            -- CHANGE THE DBID HERE!
         and s1.dbid              = s0.dbid
         and b.dbid               = s0.dbid
         and e.dbid               = s0.dbid
         and s0.instance_number   = &_instancenumber  -- CHANGE THE INSTANCE_NUMBER HERE!
         and s1.instance_number   = s0.instance_number
         and b.instance_number    = s0.instance_number
         and e.instance_number    = s0.instance_number
         and s1.snap_id           = s0.snap_id + 1
         and b.snap_id            = s0.snap_id
         and e.snap_id            = s0.snap_id + 1
         and b.stat_id            = e.stat_id
         and b.service_name_hash  = e.service_name_hash) s1
   group by 
     s1.snap_id, s1.tm, s1.inst, s1.dur, s1.service_name
   order by 
     snap_id asc, aas desc, service_name)
-- where 
-- AND TO_CHAR(tm,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- snap_id = 338
-- and snap_id >= 335 and snap_id <= 339
-- aas > .5
;
}}}
{{{
trx/sec = [UCOMS]+[URS]
}}}

{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR CPU and IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              heading instname        -- instname
col hostname    format a30              heading hostname        -- hostname
col tm          format a17              heading tm              -- "tm"
col id          format 99999            heading id              -- "snapid"
col inst        format 90               heading inst            -- "inst"
col dur         format 999990.00        heading dur             -- "dur"
col cpu         format 90               heading cpu             -- "cpu"
col cap         format 9999990.00       heading cap             -- "capacity"
col dbt         format 999990.00        heading dbt             -- "DBTime"
col dbc         format 99990.00         heading dbc             -- "DBcpu"
col bgc         format 99990.00         heading bgc             -- "BGcpu"
col rman        format 9990.00          heading rman            -- "RMANcpu"
col aas         format 990.0            heading aas             -- "AAS"
col totora      format 9999990.00       heading totora          -- "TotalOracleCPU"
col busy        format 9999990.00       heading busy            -- "BusyTime"
col load        format 990.00           heading load            -- "OSLoad"
col totos       format 9999990.00       heading totos           -- "TotalOSCPU"
col mem         format 999990.00        heading mem             -- "PhysicalMemorymb"
col IORs        format 9990.000         heading IORs            -- "IOPsr"
col IOWs        format 9990.000         heading IOWs            -- "IOPsw"
col IORedo      format 9990.000         heading IORedo          -- "IOPsredo"
col IORmbs      format 9990.000         heading IORmbs          -- "IOrmbs"
col IOWmbs      format 9990.000         heading IOWmbs          -- "IOwmbs"
col redosizesec format 9990.000         heading redosizesec     -- "Redombs"
col logons      format 990              heading logons          -- "Sess"
col logone      format 990              heading logone          -- "SessEnd"
col exsraw      format 99990.000        heading exsraw          -- "Execrawdelta"
col exs         format 9990.000         heading exs             -- "Execs"
col ucs         format 9990.000         heading ucs             -- "UserCalls"
col ucoms       format 9990.000         heading ucoms           -- "Commit"
col urs         format 9990.000         heading urs             -- "Rollback"
col lios        format 9999990.00       heading lios            -- "LIOs"
col oracpupct   format 990              heading oracpupct       -- "OracleCPUPct"
col rmancpupct  format 990              heading rmancpupct      -- "RMANCPUPct"
col oscpupct    format 990              heading oscpupct        -- "OSCPUPct"
col oscpuusr    format 990              heading oscpuusr        -- "USRPct"
col oscpusys    format 990              heading oscpusys        -- "SYSPct"
col oscpuio     format 990              heading oscpuio         -- "IOPct"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
          s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
  round(s4t1.value/1024/1024/1024,2) AS memgb,
  round(s37t1.value/1024/1024/1024,2) AS sgagb,
  round(s36t1.value/1024/1024/1024,2) AS pgagb,
     s9t0.value logons, 
   ((s10t1.value - s10t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as exs, 
   ((s40t1.value - s40t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as ucs, 
   ((s38t1.value - s38t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as ucoms, 
   ((s39t1.value - s39t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as urs,
   ((s41t1.value - s41t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as lios
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_osstat s4t1,         -- osstat just get the end value 
  (select snap_id, dbid, instance_number, sum(value) value from dba_hist_sga group by snap_id, dbid, instance_number) s37t1, -- total SGA allocated, just get the end value
  dba_hist_pgastat s36t1,		-- total PGA allocated, just get the end value 
  dba_hist_sysstat s9t0,        -- logons current, sysstat absolute value should not be diffed
  dba_hist_sysstat s10t0,       -- execute count, diffed
  dba_hist_sysstat s10t1,
  dba_hist_sysstat s38t0,       -- user commits, diffed
  dba_hist_sysstat s38t1,
  dba_hist_sysstat s39t0,       -- user rollbacks, diffed
  dba_hist_sysstat s39t1,
  dba_hist_sysstat s40t0,       -- user calls, diffed
  dba_hist_sysstat s40t1,
  dba_hist_sysstat s41t0,       -- session logical reads, diffed
  dba_hist_sysstat s41t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s4t1.dbid            = s0.dbid
AND s9t0.dbid            = s0.dbid
AND s10t0.dbid            = s0.dbid
AND s10t1.dbid            = s0.dbid
AND s36t1.dbid            = s0.dbid
AND s37t1.dbid            = s0.dbid
AND s38t0.dbid            = s0.dbid
AND s38t1.dbid            = s0.dbid
AND s39t0.dbid            = s0.dbid
AND s39t1.dbid            = s0.dbid
AND s40t0.dbid            = s0.dbid
AND s40t1.dbid            = s0.dbid
AND s41t0.dbid            = s0.dbid
AND s41t1.dbid            = s0.dbid
AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s4t1.instance_number = s0.instance_number
AND s9t0.instance_number = s0.instance_number
AND s10t0.instance_number = s0.instance_number
AND s10t1.instance_number = s0.instance_number
AND s36t1.instance_number = s0.instance_number
AND s37t1.instance_number = s0.instance_number
AND s38t0.instance_number = s0.instance_number
AND s38t1.instance_number = s0.instance_number
AND s39t0.instance_number = s0.instance_number
AND s39t1.instance_number = s0.instance_number
AND s40t0.instance_number = s0.instance_number
AND s40t1.instance_number = s0.instance_number
AND s41t0.instance_number = s0.instance_number
AND s41t1.instance_number = s0.instance_number
AND s1.snap_id           = s0.snap_id + 1
AND s4t1.snap_id         = s0.snap_id + 1
AND s36t1.snap_id        = s0.snap_id + 1
AND s37t1.snap_id        = s0.snap_id + 1
AND s9t0.snap_id         = s0.snap_id
AND s10t0.snap_id         = s0.snap_id
AND s10t1.snap_id         = s0.snap_id + 1
AND s38t0.snap_id         = s0.snap_id
AND s38t1.snap_id         = s0.snap_id + 1
AND s39t0.snap_id         = s0.snap_id
AND s39t1.snap_id         = s0.snap_id + 1
AND s40t0.snap_id         = s0.snap_id
AND s40t1.snap_id         = s0.snap_id + 1
AND s41t0.snap_id         = s0.snap_id
AND s41t1.snap_id         = s0.snap_id + 1
AND s4t1.stat_name       = 'PHYSICAL_MEMORY_BYTES'
AND s36t1.name           = 'total PGA allocated'
AND s9t0.stat_name       = 'logons current'
AND s10t0.stat_name       = 'execute count'
AND s10t1.stat_name       = s10t0.stat_name
AND s38t0.stat_name       = 'user commits'
AND s38t1.stat_name       = s38t0.stat_name
AND s39t0.stat_name       = 'user rollbacks'
AND s39t1.stat_name       = s39t0.stat_name
AND s40t0.stat_name       = 'user calls'
AND s40t1.stat_name       = s40t0.stat_name
AND s41t0.stat_name       = 'session logical reads'
AND s41t1.stat_name       = s41t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (336)
-- aas > 1
-- oracpupct > 50
-- oscpupct > 50
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
{{{
set arraysize 5000

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Top Events Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              
col hostname    format a30              
col snap_id     format 99999            heading snap_id       -- "snapid"   
col tm          format a17              heading tm            -- "tm"       
col inst        format 90               heading inst          -- "inst"     
col dur         format 999990.00        heading dur           -- "dur"      
col event       format a55              heading event         -- "Event"    
col event_rank  format 90               heading event_rank    -- "EventRank"
col waits       format 9999999990.00    heading waits         -- "Waits"    
col time        format 9999999990.00    heading time          -- "Timesec"  
col avgwt       format 99990.00         heading avgwt         -- "Avgwtms"  
col pctdbt      format 9990.0           heading pctdbt        -- "DBTimepct"
col aas         format 990.0            heading aas           -- "Aas"      
col wait_class  format a15              heading wait_class    -- "WaitClass"

spool awr_topevents-tableau-&_instname-&_hostname..csv
select trim('&_instname') instname, trim('&_dbid') db_id, trim('&_hostname') hostname, snap_id, tm, inst, dur, event, event_rank, waits, time, avgwt, pctdbt, aas, wait_class
from 
      (select snap_id, TO_CHAR(tm,'MM/DD/YY HH24:MI:SS') tm, inst, dur, event, waits, time, avgwt, pctdbt, aas, wait_class, 
            DENSE_RANK() OVER (
          PARTITION BY snap_id ORDER BY time DESC) event_rank
      from 
              (
              select * from 
                    (select * from 
                          (select 
                            s0.snap_id snap_id,
                            s0.END_INTERVAL_TIME tm,
                            s0.instance_number inst,
                            round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                            e.event_name event,
                            e.total_waits - nvl(b.total_waits,0)       waits,
                            round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)  time,     -- THIS IS EVENT (sec)
                            round (decode ((e.total_waits - nvl(b.total_waits, 0)), 0, to_number(NULL), ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000) / (e.total_waits - nvl(b.total_waits,0))), 2) avgwt,
                            ((round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS EVENT (sec) / DB TIME (sec)
                            (round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,     -- THIS IS EVENT (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                            e.wait_class wait_class
                            from 
                                 dba_hist_snapshot s0,
                                 dba_hist_snapshot s1,
                                 dba_hist_system_event b,
                                 dba_hist_system_event e,
                                 dba_hist_sys_time_model s5t0,
                                 dba_hist_sys_time_model s5t1
                            where 
                              s0.dbid                   = &_dbid            -- CHANGE THE DBID HERE!
                              AND s1.dbid               = s0.dbid
                              and b.dbid(+)             = s0.dbid
                              and e.dbid                = s0.dbid
                              AND s5t0.dbid             = s0.dbid
                              AND s5t1.dbid             = s0.dbid
                              AND s0.instance_number    = &_instancenumber  -- CHANGE THE INSTANCE_NUMBER HERE!
                              AND s1.instance_number    = s0.instance_number
                              and b.instance_number(+)  = s0.instance_number
                              and e.instance_number     = s0.instance_number
                              AND s5t0.instance_number = s0.instance_number
                              AND s5t1.instance_number = s0.instance_number
                              AND s1.snap_id            = s0.snap_id + 1
                              AND b.snap_id(+)          = s0.snap_id
                              and e.snap_id             = s0.snap_id + 1
                              AND s5t0.snap_id         = s0.snap_id
                              AND s5t1.snap_id         = s0.snap_id + 1
                              AND s5t0.stat_name       = 'DB time'
                              AND s5t1.stat_name       = s5t0.stat_name
                                    and b.event_id            = e.event_id
                                    and e.wait_class          != 'Idle'
                                    and e.total_waits         > nvl(b.total_waits,0)
                                    and e.event_name not in ('smon timer', 
                                                             'pmon timer', 
                                                             'dispatcher timer',
                                                             'dispatcher listen timer',
                                                             'rdbms ipc message')
                                  order by snap_id, time desc, waits desc, event)
                    union all
                              select 
                                       s0.snap_id snap_id,
                                       s0.END_INTERVAL_TIME tm,
                                       s0.instance_number inst,
                                       round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                        'CPU time',
                                        0,
                                        round ((s6t1.value - s6t0.value) / 1000000, 2) as time,     -- THIS IS DB CPU (sec)
                                        0,
                                        ((round ((s6t1.value - s6t0.value) / 1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS DB CPU (sec) / DB TIME (sec)..TO GET % OF DB CPU ON DB TIME FOR TOP 5 TIMED EVENTS SECTION
                                        (round ((s6t1.value - s6t0.value) / 1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,  -- THIS IS DB CPU (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                                        'CPU'
                                      from 
                                        dba_hist_snapshot s0,
                                        dba_hist_snapshot s1,
                                        dba_hist_sys_time_model s6t0,
                                        dba_hist_sys_time_model s6t1,
                                        dba_hist_sys_time_model s5t0,
                                        dba_hist_sys_time_model s5t1
                                      WHERE 
                                      s0.dbid                   = &_dbid              -- CHANGE THE DBID HERE!
                                      AND s1.dbid               = s0.dbid
                                      AND s6t0.dbid            = s0.dbid
                                      AND s6t1.dbid            = s0.dbid
                                      AND s5t0.dbid            = s0.dbid
                                      AND s5t1.dbid            = s0.dbid
                                      AND s0.instance_number    = &_instancenumber    -- CHANGE THE INSTANCE_NUMBER HERE!
                                      AND s1.instance_number    = s0.instance_number
                                      AND s6t0.instance_number = s0.instance_number
                                      AND s6t1.instance_number = s0.instance_number
                                      AND s5t0.instance_number = s0.instance_number
                                      AND s5t1.instance_number = s0.instance_number
                                      AND s1.snap_id            = s0.snap_id + 1
                                      AND s6t0.snap_id         = s0.snap_id
                                      AND s6t1.snap_id         = s0.snap_id + 1
                                      AND s5t0.snap_id         = s0.snap_id
                                      AND s5t1.snap_id         = s0.snap_id + 1
                                      AND s6t0.stat_name       = 'DB CPU'
                                      AND s6t1.stat_name       = s6t0.stat_name
                                      AND s5t0.stat_name       = 'DB time'
                                      AND s5t1.stat_name       = s5t0.stat_name
                    union all
                                      (select 
                                               dbtime.snap_id,
                                               dbtime.tm,
                                               dbtime.inst,
                                               dbtime.dur,
                                               'CPU wait',
                                                0,
                                                round(dbtime.time - accounted_dbtime.time, 2) time,     -- THIS IS UNACCOUNTED FOR DB TIME (sec)
                                                0,
                                                ((dbtime.aas - accounted_dbtime.aas)/ NULLIF(nvl(dbtime.aas,0),0))*100 as pctdbt,     -- THIS IS UNACCOUNTED FOR DB TIME (sec) / DB TIME (sec)
                                                round(dbtime.aas - accounted_dbtime.aas, 2) aas,     -- AAS OF UNACCOUNTED FOR DB TIME
                                                'CPU wait'
                                      from
                                                  (select  
                                                     s0.snap_id, 
                                                     s0.END_INTERVAL_TIME tm,
                                                     s0.instance_number inst,
                                                    round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                    'DB time',
                                                    0,
                                                    round ((s5t1.value - s5t0.value) / 1000000, 2) as time,     -- THIS IS DB time (sec)
                                                    0,
                                                    0,
                                                     (round ((s5t1.value - s5t0.value) / 1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,
                                                    'DB time'
                                                  from 
                                                                    dba_hist_snapshot s0,
                                                                    dba_hist_snapshot s1,
                                                                    dba_hist_sys_time_model s5t0,
                                                                    dba_hist_sys_time_model s5t1
                                                                  WHERE 
                                                                  s0.dbid                   = &_dbid              -- CHANGE THE DBID HERE!
                                                                  AND s1.dbid               = s0.dbid
                                                                  AND s5t0.dbid            = s0.dbid
                                                                  AND s5t1.dbid            = s0.dbid
                                                                  AND s0.instance_number    = &_instancenumber    -- CHANGE THE INSTANCE_NUMBER HERE!
                                                                  AND s1.instance_number    = s0.instance_number
                                                                  AND s5t0.instance_number = s0.instance_number
                                                                  AND s5t1.instance_number = s0.instance_number
                                                                  AND s1.snap_id            = s0.snap_id + 1
                                                                  AND s5t0.snap_id         = s0.snap_id
                                                                  AND s5t1.snap_id         = s0.snap_id + 1
                                                                  AND s5t0.stat_name       = 'DB time'
                                                                  AND s5t1.stat_name       = s5t0.stat_name) dbtime, 
                                                  (select snap_id, sum(time) time, sum(AAS) aas from 
                                                          (select * from (select 
                                                                s0.snap_id snap_id,
                                                                s0.END_INTERVAL_TIME tm,
                                                                s0.instance_number inst,
                                                                round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                        + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                        + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                        + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                                e.event_name event,
                                                                e.total_waits - nvl(b.total_waits,0)       waits,
                                                                round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)  time,     -- THIS IS EVENT (sec)
                                                                round (decode ((e.total_waits - nvl(b.total_waits, 0)), 0, to_number(NULL), ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000) / (e.total_waits - nvl(b.total_waits,0))), 2) avgwt,
                                                                ((round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS EVENT (sec) / DB TIME (sec)
                                                                (round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                                + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                                + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                                + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,     -- THIS IS EVENT (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                                                                e.wait_class wait_class
                                                          from 
                                                               dba_hist_snapshot s0,
                                                               dba_hist_snapshot s1,
                                                               dba_hist_system_event b,
                                                               dba_hist_system_event e,
                                                               dba_hist_sys_time_model s5t0,
                                                               dba_hist_sys_time_model s5t1
                                                          where 
                                                            s0.dbid                   = &_dbid            -- CHANGE THE DBID HERE!
                                                            AND s1.dbid               = s0.dbid
                                                            and b.dbid(+)             = s0.dbid
                                                            and e.dbid                = s0.dbid
                                                            AND s5t0.dbid             = s0.dbid
                                                            AND s5t1.dbid             = s0.dbid
                                                            AND s0.instance_number    = &_instancenumber  -- CHANGE THE INSTANCE_NUMBER HERE!
                                                            AND s1.instance_number    = s0.instance_number
                                                            and b.instance_number(+)  = s0.instance_number
                                                            and e.instance_number     = s0.instance_number
                                                            AND s5t0.instance_number = s0.instance_number
                                                            AND s5t1.instance_number = s0.instance_number
                                                            AND s1.snap_id            = s0.snap_id + 1
                                                            AND b.snap_id(+)          = s0.snap_id
                                                            and e.snap_id             = s0.snap_id + 1
                                                            AND s5t0.snap_id         = s0.snap_id
                                                            AND s5t1.snap_id         = s0.snap_id + 1
                                                      AND s5t0.stat_name       = 'DB time'
                                                      AND s5t1.stat_name       = s5t0.stat_name
                                                            and b.event_id            = e.event_id
                                                            and e.wait_class          != 'Idle'
                                                            and e.total_waits         > nvl(b.total_waits,0)
                                                            and e.event_name not in ('smon timer', 
                                                                                     'pmon timer', 
                                                                                     'dispatcher timer',
                                                                                     'dispatcher listen timer',
                                                                                     'rdbms ipc message')
                                                          order by snap_id, time desc, waits desc, event)
                                                    union all
                                                          select 
                                                                   s0.snap_id snap_id,
                                                                   s0.END_INTERVAL_TIME tm,
                                                                   s0.instance_number inst,
                                                                   round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                        + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                        + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                        + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                                    'CPU time',
                                                                    0,
                                                                    round ((s6t1.value - s6t0.value) / 1000000, 2) as time,     -- THIS IS DB CPU (sec)
                                                                    0,
                                                                    ((round ((s6t1.value - s6t0.value) / 1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS DB CPU (sec) / DB TIME (sec)..TO GET % OF DB CPU ON DB TIME FOR TOP 5 TIMED EVENTS SECTION
                                                                    (round ((s6t1.value - s6t0.value) / 1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                                + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                                + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                                + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,  -- THIS IS DB CPU (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                                                                    'CPU'
                                                                  from 
                                                                    dba_hist_snapshot s0,
                                                                    dba_hist_snapshot s1,
                                                                    dba_hist_sys_time_model s6t0,
                                                                    dba_hist_sys_time_model s6t1,
                                                                    dba_hist_sys_time_model s5t0,
                                                                    dba_hist_sys_time_model s5t1
                                                                  WHERE 
                                                                  s0.dbid                   = &_dbid              -- CHANGE THE DBID HERE!
                                                                  AND s1.dbid               = s0.dbid
                                                                  AND s6t0.dbid            = s0.dbid
                                                                  AND s6t1.dbid            = s0.dbid
                                                                  AND s5t0.dbid            = s0.dbid
                                                                  AND s5t1.dbid            = s0.dbid
                                                                  AND s0.instance_number    = &_instancenumber    -- CHANGE THE INSTANCE_NUMBER HERE!
                                                                  AND s1.instance_number    = s0.instance_number
                                                                  AND s6t0.instance_number = s0.instance_number
                                                                  AND s6t1.instance_number = s0.instance_number
                                                                  AND s5t0.instance_number = s0.instance_number
                                                                  AND s5t1.instance_number = s0.instance_number
                                                                  AND s1.snap_id            = s0.snap_id + 1
                                                                  AND s6t0.snap_id         = s0.snap_id
                                                                  AND s6t1.snap_id         = s0.snap_id + 1
                                                                  AND s5t0.snap_id         = s0.snap_id
                                                                  AND s5t1.snap_id         = s0.snap_id + 1
                                                                  AND s6t0.stat_name       = 'DB CPU'
                                                                  AND s6t1.stat_name       = s6t0.stat_name
                                                                  AND s5t0.stat_name       = 'DB time'
                                                                  AND s5t1.stat_name       = s5t0.stat_name
                                                          ) group by snap_id) accounted_dbtime
                                                            where dbtime.snap_id = accounted_dbtime.snap_id 
                                        )
                    )
              )
      )
WHERE event_rank <= 5
-- AND tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- AND TO_CHAR(tm,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- and snap_id = 495
-- and snap_id >= 495 and snap_id <= 496
-- and event = 'db file sequential read'
-- and event like 'CPU%'
-- and avgwt > 5
-- and aas > .5
-- and wait_class = 'CPU'
-- and wait_class like '%I/O%'
-- and event_rank in (1,2,3)
ORDER BY snap_id;
}}}
If you'd like to be detailed and not only give you the top5 across snap_ids.. then comment the following lines below
<<<
where 
                          time_rank <= 5
<<<
then put filters like SQL_ID or AAS after the line 
<<<
-- where rownum <= 20
<<<


{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Top SQL Report' skip 2
set pagesize 50000
set linesize 550

col snap_id             format 99999            heading -- "Snap|ID"
col tm                  format a15              heading -- "Snap|Start|Time"
col inst                format 90               heading -- "i|n|s|t|#"
col dur                 format 990.00           heading -- "Snap|Dur|(m)"
col sql_id              format a15              heading -- "SQL|ID"
col phv                 format 99999999999      heading -- "Plan|Hash|Value"
col module              format a50
col elap                format 999990.00        heading -- "Ela|Time|(s)"
col elapexec            format 999990.00        heading -- "Ela|Time|per|exec|(s)"
col cput                format 999990.00        heading -- "CPU|Time|(s)"
col iowait              format 999990.00        heading -- "IO|Wait|(s)"
col appwait             format 999990.00        heading -- "App|Wait|(s)"
col concurwait          format 999990.00        heading -- "Ccr|Wait|(s)"
col clwait              format 999990.00        heading -- "Cluster|Wait|(s)"
col bget                format 99999999990      heading -- "LIO"
col dskr                format 99999999990      heading -- "PIO"
col dpath               format 99999999990      heading -- "Direct|Writes"
col rowp                format 99999999990      heading -- "Rows"
col exec                format 9999990          heading -- "Exec"
col prsc                format 999999990        heading -- "Parse|Count"
col pxexec              format 9999990          heading -- "PX|Server|Exec"
col icbytes             format 99999990         heading -- "IC|MB"           
col offloadbytes        format 99999990         heading -- "Offload|MB"
col offloadreturnbytes  format 99999990         heading -- "Offload|return|MB"
col flashcachereads     format 99999990         heading -- "Flash|Cache|MB"   
col uncompbytes         format 99999990         heading -- "Uncomp|MB"       
col pctdbt              format 990              heading -- "DB Time|%"
col aas                 format 990.00           heading -- "A|A|S"
col time_rank           format 90               heading -- "Time|Rank"
col sql_text            format a6               heading -- "SQL|Text"

     select *
       from (
             select
                  trim('&_instname') instname, 
                  trim('&_dbid') db_id, 
                  trim('&_hostname') hostname, 
                  sqt.snap_id snap_id,
                  TO_CHAR(sqt.tm,'MM/DD/YY HH24:MI:SS') tm,
                  sqt.inst inst,
                  sqt.dur dur,
                  sqt.aas aas,
                  nvl((sqt.elap), to_number(null)) elap,
                  nvl((sqt.elapexec), 0) elapexec,
                  nvl((sqt.cput), to_number(null)) cput,
                  sqt.iowait iowait,
                  sqt.appwait appwait,
                  sqt.concurwait concurwait,
                  sqt.clwait clwait,
                  sqt.bget bget, 
                  sqt.dskr dskr, 
                  sqt.dpath dpath,
                  sqt.rowp rowp,
                  sqt.exec exec, 
                  sqt.prsc prsc, 
                  sqt.pxexec pxexec,
                  sqt.icbytes, 
                  sqt.offloadbytes, 
                  sqt.offloadreturnbytes, 
                  sqt.flashcachereads, 
                  sqt.uncompbytes,
                  sqt.time_rank time_rank,
                  sqt.sql_id sql_id,   
                  sqt.phv phv,                
                  substr(to_clob(decode(sqt.module, null, null, sqt.module)),1,50) module, 
                  st.sql_text sql_text     -- PUT/REMOVE COMMENT TO HIDE/SHOW THE SQL_TEXT
             from        (
                          select snap_id, tm, inst, dur, sql_id, phv, module, elap, elapexec, cput, iowait, appwait, concurwait, clwait, bget, dskr, dpath, rowp, exec, prsc, pxexec, icbytes, offloadbytes, offloadreturnbytes, flashcachereads, uncompbytes, aas, time_rank
                          from
                                             (
                                               select 
                                                      s0.snap_id snap_id,
                                                      s0.END_INTERVAL_TIME tm,
                                                      s0.instance_number inst,
                                                      round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                      e.sql_id sql_id, 
                                                      e.plan_hash_value phv, 
                                                      max(e.module) module,
                                                      sum(e.elapsed_time_delta)/1000000 elap,
                                                      decode((sum(e.executions_delta)), 0, to_number(null), ((sum(e.elapsed_time_delta)) / (sum(e.executions_delta)) / 1000000)) elapexec,
                                                      sum(e.cpu_time_delta)/1000000     cput, 
                                                      sum(e.iowait_delta)/1000000 iowait,
                                                      sum(e.apwait_delta)/1000000 appwait,
                                                      sum(e.ccwait_delta)/1000000 concurwait,
                                                      sum(e.clwait_delta)/1000000 clwait,
                                                      sum(e.buffer_gets_delta) bget,
                                                      sum(e.disk_reads_delta) dskr, 
                                                      sum(e.direct_writes_delta) dpath,
                                                      sum(e.rows_processed_delta) rowp,
                                                      sum(e.executions_delta)   exec,
                                                      sum(e.parse_calls_delta) prsc,
                                                      sum(e.px_servers_execs_delta) pxexec,
                                                      sum(e.io_interconnect_bytes_delta)/1024/1024 icbytes,  
                                                      sum(e.io_offload_elig_bytes_delta)/1024/1024 offloadbytes,  
                                                      sum(e.io_offload_return_bytes_delta)/1024/1024 offloadreturnbytes,   
                                                      (sum(e.optimized_physical_reads_delta)* &_blocksize)/1024/1024 flashcachereads,   
                                                      sum(e.cell_uncompressed_bytes_delta)/1024/1024 uncompbytes, 
                                                      (sum(e.elapsed_time_delta)/1000000) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60) aas,
                                                      DENSE_RANK() OVER (
                                                      PARTITION BY s0.snap_id ORDER BY e.elapsed_time_delta DESC) time_rank
                                               from 
                                                   dba_hist_snapshot s0,
                                                   dba_hist_snapshot s1,
                                                   dba_hist_sqlstat e
                                                   where 
                                                    s0.dbid                   = &_dbid                -- CHANGE THE DBID HERE!
                                                    AND s1.dbid               = s0.dbid
                                                    and e.dbid                = s0.dbid                                                
                                                    AND s0.instance_number    = &_instancenumber      -- CHANGE THE INSTANCE_NUMBER HERE!
                                                    AND s1.instance_number    = s0.instance_number
                                                    and e.instance_number     = s0.instance_number                                                 
                                                    AND s1.snap_id            = s0.snap_id + 1
                                                    and e.snap_id             = s0.snap_id + 1                                              
                                               group by 
                                                    s0.snap_id, s0.END_INTERVAL_TIME, s0.instance_number, e.sql_id, e.plan_hash_value, e.elapsed_time_delta, s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME
                                             )
                          where 
                          time_rank <= 5                                     -- GET TOP 5 SQL ACROSS SNAP_IDs... YOU CAN ALTER THIS TO HAVE MORE DATA POINTS
                         ) 
                        sqt,
                        (select sql_id, dbid, nvl(b.name, a.command_type) sql_text from dba_hist_sqltext a, audit_actions b where a.command_type =  b.action(+)) st
             where st.sql_id(+)             = sqt.sql_id
             and st.dbid(+)                 = &_dbid
-- AND TO_CHAR(tm,'D') >= 1                                                  -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900                                          -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- AND snap_id in (338,339)
-- AND snap_id = 338
-- AND snap_id >= 335 and snap_id <= 339
-- AND lower(st.sql_text) like 'select%'
-- AND lower(st.sql_text) like 'insert%'
-- AND lower(st.sql_text) like 'update%'
-- AND lower(st.sql_text) like 'merge%'
-- AND pxexec > 0
-- AND aas > .5
             order by 
             snap_id                             -- TO GET SQL OUTPUT ACROSS SNAP_IDs SEQUENTIALLY AND ASC
             -- nvl(sqt.elap, -1) desc, sqt.sql_id     -- TO GET SQL OUTPUT BY ELAPSED TIME
             )
-- where rownum <= 20
;

}}}
http://gavinsoorma.com/2009/07/exporting-and-importing-awr-snapshot-data/

http://dboptimizer.com/2011/11/08/importing-awr-repositories-from-cloned-databases/  <-- this is to change the DBIDs
https://sites.google.com/site/oraclemonitor/dba_hist_active_sess_history#TOC-Force-importing-a-in-AWR   <-- this is to ''FORCE'' import ASH data 


{{{


###################################
on the source env
###################################

CREATE DIRECTORY AWR_DATA AS '/oracle/app/oracle/awrdata';

@?/rdbms/admin/awrextr.sql


~~~~~~~~~~~~~
AWR EXTRACT
~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  This script will extract the AWR data for a range of snapshots  ~
~  into a dump file.  The script will prompt users for the         ~
~  following information:                                          ~
~     (1) database id                                              ~
~     (2) snapshot range to extract                                ~
~     (3) name of directory object                                 ~
~     (4) name of dump file                                        ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Databases in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     DB Name      Host
------------ ------------ ------------
* 2607950532 IVRS         dbrocaix01.b
                          ayantel.com


The default database id is the local one: '2607950532'.  To use this
database id, press <return> to continue, otherwise enter an alternative.

Enter value for dbid: 2607950532


Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 235
Begin Snapshot Id specified: 235

Enter value for end_snap: 3333


Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~

Directory Name                 Directory Path
------------------------------ -------------------------------------------------
ADMIN_DIR                      /oracle/app/oracle/product/10.2.0/db_1/md/admin
AWR_DATA                       /oracle/app/oracle/awrdata
DATA_PUMP_DIR                  /flash_reco/flash_recovery_area/IVRS/expdp
DATA_PUMP_LOG                  /home/oracle/logs
SQLT$STAGE                     /oracle/app/oracle/admin/ivrs/udump
SQLT$UDUMP                     /oracle/app/oracle/admin/ivrs/udump
WORK_DIR                       /oracle/app/oracle/product/10.2.0/db_1/work

Choose a Directory Name from the above list (case-sensitive).

Enter value for directory_name: AWR_DATA

Using the dump directory: AWR_DATA

Specify the Name of the Extract Dump File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The prefix for the default dump file name is awrdat_235_3333.
To use this name, press <return> to continue, otherwise enter
an alternative.

Enter value for file_name: awrexp



###################################
on the target env
###################################

CREATE DIRECTORY AWR_DATA AS '/oracle/app/oracle/awrdata';

@?/rdbms/admin/awrload.sql

-- on target before the load 
-- MIN/MAX for dba_hist tables
  2  select min(snap_id) min_snap_id, max(snap_id) max_snap_id from dba_hist_snapshot;
  3  select to_char(min(end_interval_time),'yyyy-mon-dd hh24:mi:ss') min_date, to_char(max(end_interval_time),'yyyy-mon-dd hh24:mi:ss') max_date from dba_hist_snapshot;

  4    5    6    7    8    9   10   11
INSTANCE_NUMBER    SNAP_ID STARTUP_TIME         SNAP_START           SNAP_END                ELA_MIN
--------------- ---------- -------------------- -------------------- -------------------- ----------
              1        238 2011-jan-27 08:52:09 2011-jan-27 09:30:31 2011-jan-27 09:40:34      10.05
              1        237 2011-jan-27 08:52:09 2011-jan-27 09:20:28 2011-jan-27 09:30:31      10.04
              1        236 2011-jan-27 08:52:09 2011-jan-27 09:10:26 2011-jan-27 09:20:28      10.04
              1        235 2011-jan-27 08:52:09 2011-jan-27 09:03:24 2011-jan-27 09:10:26       7.03
              1        234 2009-dec-15 13:41:20 2009-dec-15 14:00:32 2011-jan-27 09:03:24  587222.87
              1        233 2009-dec-15 12:08:35 2009-dec-15 13:00:49 2009-dec-15 14:00:32      59.72
              1        232 2009-dec-15 12:08:35 2009-dec-15 12:19:42 2009-dec-15 13:00:49      41.12
              1        231 2009-dec-15 07:58:35 2009-dec-15 08:09:41 2009-dec-15 12:19:42     250.01
              1        230 2009-dec-14 23:35:11 2009-dec-14 23:46:20 2009-dec-15 08:09:41     503.35
              1        229 2009-dec-10 11:27:30 2009-dec-11 04:00:38 2009-dec-14 23:46:20     5505.7

10 rows selected.

sys@IVRS> sys@IVRS> sys@IVRS>
MIN_SNAP_ID MAX_SNAP_ID
----------- -----------
        213         239

sys@IVRS>
MIN_DATE             MAX_DATE
-------------------- --------------------
2009-dec-10 11:38:56 2011-jan-27 09:40:34



~~~~~~~~~~
AWR LOAD
~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  This script will load the AWR data from a dump file. The   ~
~  script will prompt users for the following information:    ~
~     (1) name of directory object                            ~
~     (2) name of dump file                                   ~
~     (3) staging schema name to load AWR data into           ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~

Directory Name                 Directory Path
------------------------------ -------------------------------------------------
ADMIN_DIR                      /oracle/app/oracle/product/10.2.0/db_1/md/admin
AWR_DATA                       /oracle/app/oracle/awrdata
DATA_PUMP_DIR                  /flash_reco/flash_recovery_area/IVRS/expdp
DATA_PUMP_LOG                  /home/oracle/logs
SQLT$STAGE                     /oracle/app/oracle/admin/ivrs/udump
SQLT$UDUMP                     /oracle/app/oracle/admin/ivrs/udump
WORK_DIR                       /oracle/app/oracle/product/10.2.0/db_1/work

Choose a Directory Name from the list above (case-sensitive).

Enter value for directory_name: AWR_DATA

Using the dump directory: AWR_DATA

Specify the Name of the Dump File to Load
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please specify the prefix of the dump file (.dmp) to load:

Enter value for file_name: awrexp


Enter value for schema_name:

Using the staging schema name: AWR_STAGE

Choose the Default tablespace for the AWR_STAGE user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Choose the AWR_STAGE users's default tablespace.  This is the
tablespace in which the AWR data will be staged.

TABLESPACE_NAME                CONTENTS  DEFAULT TABLESPACE
------------------------------ --------- ------------------
CCDATA                         PERMANENT
CCINDEX                        PERMANENT
PSE                            PERMANENT
SOE                            PERMANENT
SOEINDEX                       PERMANENT
SYSAUX                         PERMANENT *
TPCCTAB                        PERMANENT
TPCHTAB                        PERMANENT
USERS                          PERMANENT

Pressing <return> will result in the recommended default
tablespace (identified by *) being used.

Enter value for default_tablespace:


Using tablespace SYSAUX as the default tablespace for the AWR_STAGE


Choose the Temporary tablespace for the AWR_STAGE user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Choose the AWR_STAGE user's temporary tablespace.

TABLESPACE_NAME                CONTENTS  DEFAULT TEMP TABLESPACE
------------------------------ --------- -----------------------
TEMP                           TEMPORARY *

Pressing <return> will result in the database's default temporary
tablespace (identified by *) being used.

Enter value for temporary_tablespace:




Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at 12:46:07
begin
*
ERROR at line 1:
ORA-20105: unable to move AWR data to SYS
ORA-06512: at "SYS.DBMS_SWRF_INTERNAL", line 1760
ORA-20107: not allowed to move AWR data for local dbid
ORA-06512: at line 3


... Dropping AWR_STAGE user

End of AWR Load
}}}
-- from http://www.perfvision.com/statspack/awr.txt

{{{
WORKLOAD REPOSITORY report for
DB Name         DB Id    Instance     Inst Num Release     RAC Host
              Snap Id      Snap Time      Sessions Curs/Sess
Cache Sizes
Load Profile
Instance Efficiency Percentages (Target 100%)
Top 5 Timed Events                                         Avg %Total
Time Model Statistics
Wait Class
Wait Events
Background Wait Events
Operating System Statistics
Service Statistics
Service Wait Class Stats
SQL ordered by Elapsed Time
SQL ordered by CPU Time
SQL ordered by Gets
SQL ordered by Reads
SQL ordered by Executions
SQL ordered by Parse Calls
SQL ordered by Sharable Memory
SQL ordered by Version Count
Instance Activity Stats
Instance Activity Stats - Absolute Values
Instance Activity Stats - Thread Activity
Tablespace IO Stats
File IO Stats
Buffer Pool Statistics
Instance Recovery Stats
Buffer Pool Advisory
PGA Aggr Summary
PGA Aggr Target Histogram
PGA Memory Advisory
Shared Pool Advisory
SGA Target Advisory
Streams Pool Advisory
Java Pool Advisory
Buffer Wait Statistics
Enqueue Activity
Undo Segment Summary
Latch Activity
Latch Sleep Breakdown
Latch Miss Sources
Parent Latch Statistics
Segments by Logical Reads
Segments by Physical Reads
Segments by Row Lock Waits
Segments by ITL Waits
Segments by Buffer Busy Waits
Dictionary Cache Stats
Library Cache Activity
Process Memory Summary
SGA Memory Summary
SGA regions                     Begin Size (Bytes)      (if different)
SGA breakdown difference
Streams CPU/IO Usage
Streams Capture
Streams Apply
Buffered Queues
Buffered Subscribers
Rule Set
Resource Limit Stats
init.ora Parameters

}}}
{{{
WORKLOAD REPOSITORY report for
DB Name         DB Id    Instance     Inst Num Release     RAC Host
              Snap Id      Snap Time      Sessions Curs/Sess
Cache Sizes
Load Profile
Instance Efficiency Percentages (Target 100%)
Top 5 Timed Events     Avg wait %Total Call
Time Model Statistics
Wait Class
Wait Events
Background Wait Events
Operating System Statistics
Service Statistics
Service Wait Class Stats
SQL ordered by Elapsed Time
SQL ordered by CPU Time
SQL ordered by Gets
SQL ordered by Reads
SQL ordered by Executions
SQL ordered by Parse Calls
SQL ordered by Sharable Memory
SQL ordered by Version Count
Instance Activity Stats
Instance Activity Stats - Absolute Values
Instance Activity Stats - Thread Activity
Tablespace IO Stats
File IO Stats
Buffer Pool Statistics
Instance Recovery Stats
Buffer Pool Advisory
PGA Aggr Summary
PGA Aggr Target Stats     <-- new in 10.2.0.3
PGA Aggr Target Histogram
PGA Memory Advisory
Shared Pool Advisory
SGA Target Advisory
Streams Pool Advisory
Java Pool Advisory
Buffer Wait Statistics
Enqueue Activity
Undo Segment Summary
Undo Segment Stats     <-- new in 10.2.0.3
Latch Activity
Latch Sleep Breakdown
Latch Miss Sources
Parent Latch Statistics
Child Latch Statistics     <-- new in 10.2.0.3
Segments by Logical Reads
Segments by Physical Reads
Segments by Row Lock Waits
Segments by ITL Waits
Segments by Buffer Busy Waits
Dictionary Cache Stats
Library Cache Activity
Process Memory Summary
SGA Memory Summary
SGA breakdown difference
Streams CPU/IO Usage
Streams Capture
Streams Apply
Buffered Queues
Buffered Subscribers
Rule Set
Resource Limit Stats
init.ora Parameters
}}}
-- from http://www.perfvision.com/statspack/awrrpt_1_122_123.txt


{{{
WORKLOAD REPOSITORY report for

DB Name         DB Id    Instance     Inst Num Release     RAC Host
------------ ----------- ------------ -------- ----------- --- ------------
CDB10         1193559071 cdb10               1 10.2.0.1.0  NO  tsukuba

              Snap Id      Snap Time      Sessions Curs/Sess
            --------- ------------------- -------- ---------
Begin Snap:       122 31-Jul-07 17:00:40        36      24.9
  End Snap:       123 31-Jul-07 18:00:56        37      25.0
   Elapsed:               60.26 (mins)
   DB Time:               89.57 (mins)

Cache Sizes
~~~~~~~~~~~                       Begin        End
                             ---------- ----------
               Buffer Cache:        28M        28M  Std Block Size:         8K
           Shared Pool Size:       128M       128M      Log Buffer:     6,256K

Load Profile
~~~~~~~~~~~~                            Per Second       Per Transaction
                                   ---------------       ---------------
                  Redo size:            404,585.37            714,975.12
              Logical reads:              8,318.76             14,700.74
              Block changes:              2,744.42              4,849.89
             Physical reads:                111.18                196.48
            Physical writes:                 48.07                 84.96
                 User calls:                154.96                273.84
                     Parses:                  3.17                  5.60
                Hard parses:                  0.07                  0.13
                      Sorts:                  9.07                 16.04
                     Logons:                  0.05                  0.09
                   Executes:                150.07                265.20
               Transactions:                  0.57

  % Blocks changed per Read:   32.99    Recursive Call %:    16.44
 Rollback per transaction %:   21.11       Rows per Sort:    57.60

Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Buffer Nowait %:  100.00       Redo NoWait %:   99.98
            Buffer  Hit   %:   98.70    In-memory Sort %:  100.00
            Library Hit   %:   99.94        Soft Parse %:   97.71
         Execute to Parse %:   97.89         Latch Hit %:  100.00
Parse CPU to Parse Elapsd %:    3.60     % Non-Parse CPU:   99.62

 Shared Pool Statistics        Begin    End
                              ------  ------
             Memory Usage %:   91.89   91.86
    % SQL with executions>1:   75.28   73.08
  % Memory for SQL w/exec>1:   73.58   70.06

Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
log file parallel write               2,819       2,037    723   37.9 System I/O
db file parallel write               32,625       1,949     60   36.3 System I/O
db file sequential read             268,447       1,761      7   32.8   User I/O
log file sync                         1,850       1,117    604   20.8     Commit
log buffer space                      1,189         866    728   16.1 Configurat
          -------------------------------------------------------------
Time Model Statistics                    DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total time in database user-calls (DB Time): 5374.1s
-> Statistics including the word "background" measure background process
   time, and so do not contribute to the DB time statistic
-> Ordered by % or DB time desc, Statistic name

Statistic Name                                       Time (s) % of DB Time
------------------------------------------ ------------------ ------------
sql execute elapsed time                              4,409.2         82.0
DB CPU                                                  488.2          9.1
parse time elapsed                                       48.5           .9
hard parse elapsed time                                  45.8           .9
PL/SQL execution elapsed time                            24.0           .4
sequence load elapsed time                                6.1           .1
connection management call elapsed time                   3.6           .1
failed parse elapsed time                                 0.8           .0
hard parse (sharing criteria) elapsed time                0.1           .0
repeated bind elapsed time                                0.0           .0
DB time                                               5,374.1          N/A
background elapsed time                               4,199.3          N/A
background cpu time                                      76.0          N/A
          -------------------------------------------------------------

Wait Class                                DB/Inst: CDB10/cdb10  Snaps: 122-123
-> s  - second
-> cs - centisecond -     100th of a second
-> ms - millisecond -    1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc

                                                                  Avg
                                       %Time       Total Wait    wait     Waits
Wait Class                      Waits  -outs         Time (s)    (ms)      /txn
-------------------- ---------------- ------ ---------------- ------- ---------
System I/O                     63,959     .0            4,080      64      31.3
User I/O                      286,652     .0            2,337       8     140.1
Commit                          1,850   47.2            1,117     604       0.9
Configuration                   4,319   79.1            1,081     250       2.1
Concurrency                       211   14.7               64     301       0.1
Application                     1,432     .3               29      21       0.7
Network                       566,962     .0               20       0     277.1
Other                             499    1.2                9      19       0.2
          -------------------------------------------------------------

Wait Events                              DB/Inst: CDB10/cdb10  Snaps: 122-123
-> s  - second
-> cs - centisecond -     100th of a second
-> ms - millisecond -    1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc (idle events last)

                                                                   Avg
                                             %Time  Total Wait    wait     Waits
Event                                 Waits  -outs    Time (s)    (ms)      /txn
---------------------------- -------------- ------ ----------- ------- ---------
log file parallel write               2,819     .0       2,037     723       1.4
db file parallel write               32,625     .0       1,949      60      15.9
db file sequential read             268,447     .0       1,761       7     131.2
log file sync                         1,850   47.2       1,117     604       0.9
log buffer space                      1,189   51.9         866     728       0.6
db file scattered read               16,589     .0         449      27       8.1
log file switch completion              182   35.2         109     597       0.1
control file parallel write           2,134     .0          87      41       1.0
direct path write temp                  415     .0          78     188       0.2
log file switch (checkpoint             120   24.2          53     444       0.1
buffer busy waits                       155   18.1          49     315       0.1
free buffer waits                     2,387   95.0          43      18       1.2
enq: RO - fast object reuse              60    6.7          23     379       0.0
SQL*Net more data to dblink           1,723     .0          19      11       0.8
direct path read temp                   350     .0          16      46       0.2
local write wait                        164    1.8          15      90       0.1
direct path write                       304     .0          13      42       0.1
write complete waits                     11   90.9          10     923       0.0
latch: In memory undo latch               5     .0           8    1592       0.0
os thread startup                        40    7.5           7     171       0.0
enq: CF - contention                     25     .0           7     272       0.0
SQL*Net break/reset to clien          1,372     .0           7       5       0.7
control file sequential read         26,253     .0           5       0      12.8
db file parallel read                   149     .0           4      29       0.1
direct path read                        233     .0           1       6       0.1
latch: cache buffers lru cha             10     .0           1     132       0.0
latch: object queue header o              2     .0           1     460       0.0
SQL*Net message to client           557,769     .0           1       0     272.6
log file single write                    64     .0           1      13       0.0
SQL*Net more data to client           1,806     .0           0       0       0.9
LGWR wait for redo copy                 125    4.8           0       1       0.1
rdbms ipc reply                         298     .0           0       0       0.1
SQL*Net more data from clien             93     .0           0       1       0.0
latch free                                2     .0           0      17       0.0
latch: redo allocation                    1     .0           0      21       0.0
latch: shared pool                        2     .0           0      10       0.0
log file sequential read                 64     .0           0       0       0.0
reliable message                         36     .0           0       1       0.0
read by other session                     1     .0           0      15       0.0
SQL*Net message to dblink             5,565     .0           0       0       2.7
latch: library cache                      4     .0           0       1       0.0
undo segment extension                  430   99.3           0       0       0.2
latch: cache buffers chains               4     .0           0       0       0.0
latch: library cache pin                  1     .0           0       0       0.0
SQL*Net more data from dblin              6     .0           0       0       0.0
SQL*Net message from client         557,767     .0      51,335      92     272.6
Streams AQ: waiting for time             50   40.0       3,796   75924       0.0
wait for unread message on b          3,588   99.5       3,522     982       1.8
Streams AQ: qmn slave idle w            128     .0       3,520   27498       0.1
Streams AQ: qmn coordinator             275   53.5       3,520   12799       0.1
virtual circuit status                  120  100.0       3,503   29191       0.1
Streams AQ: waiting for mess            725   97.7       3,498    4825       0.4
jobq slave wait                       1,133   97.5       3,284    2898       0.6
PL/SQL lock timer                       977   99.9       2,862    2929       0.5
SQL*Net message from dblink           5,566     .0         540      97       2.7
class slave wait                          2  100.0          10    4892       0.0
single-task message                       2     .0           0     103       0.0
          -------------------------------------------------------------

Background Wait Events                   DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by wait time desc, waits desc (idle events last)

                                                                   Avg
                                             %Time  Total Wait    wait     Waits
Event                                 Waits  -outs    Time (s)    (ms)      /txn
---------------------------- -------------- ------ ----------- ------- ---------
log file parallel write               2,820     .0       2,037     722       1.4
db file parallel write               32,625     .0       1,949      60      15.9
control file parallel write           2,134     .0          87      41       1.0
direct path write                       231     .0          13      55       0.1
db file sequential read                 935     .0          12      13       0.5
log buffer space                         13   53.8          10     791       0.0
events in waitclass Other               415    1.4           8      19       0.2
os thread startup                        40    7.5           7     171       0.0
db file scattered read                  115     .0           3      27       0.1
log file sync                             3   66.7           2     828       0.0
direct path read                        231     .0           1       6       0.1
buffer busy waits                        21     .0           1      63       0.0
control file sequential read          2,550     .0           1       0       1.2
log file single write                    64     .0           1      13       0.0
log file sequential read                 64     .0           0       0       0.0
latch: shared pool                        1     .0           0       7       0.0
latch: library cache                      2     .0           0       1       0.0
latch: cache buffers chains               1     .0           0       0       0.0
rdbms ipc message                    13,865   72.8      27,604    1991       6.8
Streams AQ: waiting for time             50   40.0       3,796   75924       0.0
pmon timer                            1,272   98.6       3,526    2772       0.6
Streams AQ: qmn slave idle w            128     .0       3,520   27498       0.1
Streams AQ: qmn coordinator             275   53.5       3,520   12799       0.1
smon timer                              178    3.4       3,360   18875       0.1
          -------------------------------------------------------------

Operating System Statistics               DB/Inst: CDB10/cdb10  Snaps: 122-123

Statistic                                       Total
-------------------------------- --------------------
AVG_BUSY_TIME                                 204,954
AVG_IDLE_TIME                                 155,940
AVG_IOWAIT_TIME                                     0
AVG_SYS_TIME                                   15,979
AVG_USER_TIME                                 188,638
BUSY_TIME                                     410,601
IDLE_TIME                                     312,370
IOWAIT_TIME                                         0
SYS_TIME                                       32,591
USER_TIME                                     378,010
LOAD                                                1
OS_CPU_WAIT_TIME                              228,200
RSRC_MGR_CPU_WAIT_TIME                              0
VM_IN_BYTES                               338,665,472
VM_OUT_BYTES                              397,410,304
PHYSICAL_MEMORY_BYTES                   6,388,301,824
NUM_CPUS                                            2
          -------------------------------------------------------------

Service Statistics                       DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by DB Time

                                                             Physical    Logical
Service Name                      DB Time (s)   DB CPU (s)      Reads      Reads
-------------------------------- ------------ ------------ ---------- ----------
SYS$USERS                             4,666.5        429.9    348,141 ##########
cdb10                                   701.4         58.1     51,046    224,419
SYS$BACKGROUND                            0.0          0.0      2,830     18,255
cdb10XDB                                  0.0          0.0          0          0
          -------------------------------------------------------------

Service Wait Class Stats                  DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Wait Class info for services in the Service Statistics section.
-> Total Waits and Time Waited displayed for the following wait
   classes:  User I/O, Concurrency, Administrative, Network
-> Time Waited (Wt Time) in centisecond (100th of a second)

Service Name
----------------------------------------------------------------
 User I/O  User I/O  Concurcy  Concurcy     Admin     Admin   Network   Network
Total Wts   Wt Time Total Wts   Wt Time Total Wts   Wt Time Total Wts   Wt Time
--------- --------- --------- --------- --------- --------- --------- ---------
SYS$USERS
   271425    210890        65       602         0         0    532492      1979
cdb10
    12969     18550        81      4945         0         0     34068        15
SYS$BACKGROUND
     2261      4306        65       815         0         0         0         0
          -------------------------------------------------------------

SQL ordered by Elapsed Time              DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------
       797        134            1      796.6    14.8 f1qcyh20550cf
Call CALC_QOS_SLOW(:1, :2, :3, :4)

       773         58            1      773.2    14.4 fj6gjgsshtxyx
Call CALC_DELETE_OLD_DATA(:1)

       354         25            1      354.3     6.6 0cjsxw5ndqdbc
Call CALC_HFC_SLOW(:1, :2, :3, :4)

       275         29            1      275.3     5.1 8t8as9usk11qw
Call CALC_TOPOLOGY_SLOW(:1, :2, :3, :4)

       202          4            4       50.5     3.8 dr1rkrznhh95b
Call CALC_TOPOLOGY_MEDIUM(:1, :2, :3, :4)

       158         16            0        N/A     2.9 10dkqv3kr8xa5
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

       139          7            1      139.2     2.6 38zhkf4jdyff4
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN ash.collect(3,1200); :mydate := next_date; IF broken THEN :b := 1
; ELSE :b := 0; END IF; END;

       137         72            1      136.8     2.5 298wmz1kxjs1m
INSERT INTO CM_QOS_PROF SELECT :B1 , R.TOPOLOGYID, :B1 - :B4 , P.NODE_PROFILE_ID
, R.DOCSIFCMTSSERVICEQOSPROFILE FROM CM_SID_RAWDATA R, ( SELECT DISTINCT T.CMID,
 P.QOS_PROF_IDX, P.NODE_PROFILE_ID FROM TMP_TOP_SLOW_CM T, CMTS_QOS_PROF P WHERE
 T.CMTSID = P.TOPOLOGYID AND P.SECONDID = :B1 ) P WHERE R.BATCHID = :B3 AND R.PR

       130          9            1      130.5     2.4 6n0d6cv6w6krs
DELETE FROM CM_VA WHERE SECONDID <= :B1

       130          9            1      130.0     2.4 86m0m9q8fw9bj
DELETE FROM CM_QOS_PROF WHERE SECONDID <= :B1

       126          3            1      125.6     2.3 33bpz9dh1w5jk
Module: Lab128
--lab128 select /*+rule*/ owner, segment_name||decode(partition_name,null,nul
l,' ('||partition_name||')') name, segment_type,tablespace_name, extent_id,f
ile_id,block_id, blocks,bytes/1048576 bytes from dba_extents

       124          9            1      124.5     2.3 gyqv6h5pft4mj
DELETE FROM CM_BYTES WHERE SECONDID <= :B1

       121          2           56        2.2     2.3 6gvch1xu9ca3g
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); :mydate := next_date
; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;

       120          2            4       30.0     2.2 4zjg6w4mwu0wv
INSERT INTO TMP_TOP_MED_DN SELECT M.CMTSID, M.VENDOR_DESC, M.MODEL_DESC, MAC_L.T
OPOLOGYID, DOWN_L.TOPOLOGYID, M.UP_SNR_CNR_A3, M.UP_SNR_CNR_A2, M.UP_SNR_CNR_A1,
 M.UP_SNR_CNR_A0, M.MAC_SLOTS_OPEN, M.MAC_SLOTS_USED, M.CMTS_REBOOT, 0 FROM TMP_
TOP_MED_CMTS M, TOPOLOGY_LINK DOWN_L, TOPOLOGY_NODE DOWN_N, TOPOLOGY_LINK MAC_L

       119          9            1      119.1     2.2 aywfs0n7wwwhn
DELETE FROM CM_POWER_2 WHERE SECONDID <= :B1
SQL ordered by Elapsed Time              DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------

       117          9            1      117.4     2.2 0fnnktt50m86h
DELETE FROM CM_ERRORS WHERE SECONDID <= :B1

       116          1          977        0.1     2.1 5jh6zfmvpu77f
UPDATE ASH.DBIDS@REPO SET ASHSEQ = :B2 WHERE DBID = :B1

       108          9            1      107.5     2.0 21jqxqyf80cn8
DELETE FROM CM_POWER_1 WHERE SECONDID <= :B1

       107         11            1      107.0     2.0 87gy6mxtk7f3z
DELETE FROM CM_POLL_STATUS WHERE TOPOLOGYID IN ( SELECT DISTINCT TOPOLOGYID FROM
 CM_RAWDATA WHERE BATCHID = :B1 )

        96          6            1       95.9     1.8 2r6jnnf1hzb4z
select power.TOPOLOGYID, power.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, BITSPERSYM
BOL, TXPOWER_UP FROM CM_POWER_2 power, TOPOLOGY_LINK link, UPSTREAM_CHANNEL chan
nel WHERE power.SECONDID = :1 AND link.TOPOLOGYID = power.TOPOLOGYID AND link.PA
RENTLEN = 1 AND link.STATEID = 1 AND link.LINKTYPEID = 1 AND link.PARENTID = cha

        95          1            1       95.1     1.8 1qp1yn30gajjw
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, M.
TOPOLOGYID UP_ID, T.UP_DESC UP_DESC, T.MAC_ID
 MAC_ID, T.CMTS_ID CMTS_ID, M.MAX_PERCENT_UTI
L, M.MAX_PACKETS_PER_SEC, M.AVG_PACKET_SIZE,

        94          5            1       93.9     1.7 fxvdq915s3qpt
DELETE FROM TMP_CALC_HFC_SLOW_CM_LAST

        87          4            1       86.9     1.6 axyukfdx12pu4
Call CALC_DELETE_SLOW_RAWDATA(:1, :2)

        85          9            1       84.6     1.6 998t5bbdfm5rm
INSERT INTO CM_RAWDATA SELECT PROFINDX, 0 BATCHID, TOPOLOGYID, SAMPLETIME, SYSUP
TIME, DOCSIFCMTSCMSTATUSVALUE, DOCSIFCMTSSERVICEINOCTETS, DOCSIFCMTSSERVICEOUTOC
TETS, DOCSIFCMSTATUSTXPOWER, DOCSIFCMTSCMSTATUSRXPOWER, DOCSIFDOWNCHANNELPOWER,
DOCSIFSIGQUNERROREDS, DOCSIFSIGQCORRECTEDS, DOCSIFSIGQUNCORRECTABLES, DOCSIFSIGQ

        84          5            1       83.8     1.6 3a11s4c86wdu5
DELETE FROM CM_RAWDATA WHERE BATCHID = 0 AND PROFINDX = :B1

        77         22      150,832        0.0     1.4 5zm9acqtd51h7
insert into cm_sid_rawdata (profindx, batchid, topologyid, sid, sampletime, docs
IfCmtsServiceQosProfile) values (:1, :2, :3, :4, :5, :6)

        74          9            1       73.6     1.4 3whpusvtv0qq1
INSERT INTO TMP_CALC_QOS_SLOW_CM_TMP SELECT T.CMTSID, T.DOWNID, T.UPID, T.CMID,
GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), R.DO
CSIFCMTSSERVICEINOCTETS, R.DOCSIFCMTSSERVICEOUTOCTETS, S.SID, L.PREV_SECONDID, L
.PREV_IFINOCTETS, L.PREV_IFOUTOCTETS, L.PREV_SID FROM TMP_TOP_SLOW_CM T, CM_RAWD

        74          8            1       73.5     1.4 9h99br1t3qq3a
INSERT INTO TMP_CALC_HFC_SLOW_CM_LAST SELECT * FROM TMP_CALC_HFC_SLOW_CM_LAST_TM
P

        72          7            1       72.0     1.3 4qunm1qbf8cyk
select power.TOPOLOGYID, power.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, CHANNELWID
TH, RXPOWER_UP, RXPOWER UPSTREAM_AVG_RX FROM CM_POWER_1 power, TOPOLOGY_LINK lin
k, UPSTREAM_CHANNEL channel, UPSTREAM_POWER_1 upstream_rx WHERE power.SECONDID =
 :1 and power.SECONDID = upstream_rx.secondid AND link.TOPOLOGYID = power.TOPOLO
SQL ordered by Elapsed Time              DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------

        68          3            1       68.4     1.3 bzmccctnyjb3z
INSERT INTO DOWNSTREAM_ERRORS SELECT T2.SECONDID, T1.DOWNID, ROUND(AVG(T2.SAMPLE
_LENGTH), 0), ROUND(AVG(DECODE(T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRECTABLES
,0,0, T2.UNCORRECTABLES / ( T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRECTABLES )
* 100)) ,2) AVG_CER, ROUND(AVG(DECODE(T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRE

        64          7            1       63.6     1.2 fqcwt6uak8x3w
INSERT INTO TMP_CALC_QOS_SLOW_CM_LAST SELECT * FROM TMP_CALC_QOS_SLOW_CM_LAST_TM
P

        59          6            1       58.8     1.1 fd6a0p6333g8z
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

          -------------------------------------------------------------

SQL ordered by CPU Time                  DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
       134        797            1      133.81    14.8 f1qcyh20550cf
Call CALC_QOS_SLOW(:1, :2, :3, :4)

        72        137            1       71.96     2.5 298wmz1kxjs1m
INSERT INTO CM_QOS_PROF SELECT :B1 , R.TOPOLOGYID, :B1 - :B4 , P.NODE_PROFILE_ID
, R.DOCSIFCMTSSERVICEQOSPROFILE FROM CM_SID_RAWDATA R, ( SELECT DISTINCT T.CMID,
 P.QOS_PROF_IDX, P.NODE_PROFILE_ID FROM TMP_TOP_SLOW_CM T, CMTS_QOS_PROF P WHERE
 T.CMTSID = P.TOPOLOGYID AND P.SECONDID = :B1 ) P WHERE R.BATCHID = :B3 AND R.PR

        58        773            1       57.60    14.4 fj6gjgsshtxyx
Call CALC_DELETE_OLD_DATA(:1)

        29        275            1       29.25     5.1 8t8as9usk11qw
Call CALC_TOPOLOGY_SLOW(:1, :2, :3, :4)

        25        354            1       24.50     6.6 0cjsxw5ndqdbc
Call CALC_HFC_SLOW(:1, :2, :3, :4)

        22         77      150,832        0.00     1.4 5zm9acqtd51h7
insert into cm_sid_rawdata (profindx, batchid, topologyid, sid, sampletime, docs
IfCmtsServiceQosProfile) values (:1, :2, :3, :4, :5, :6)

        19         52      150,324        0.00     1.0 6xz6vg8q1zygu
insert into cm_rawdata (profindx, batchid, topologyid, sampletime, docsifcmtscms
tatusvalue, docsifcmtsserviceinoctets, docsifcmtsserviceoutoctets, docsifcmtscms
tatusrxpower, cmtscm_unerr, cmtscm_corr, cmtscm_uncorr, cmtscm_snr, cmtscm_timin
goffset) values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13)

        18         40      150,259        0.00     0.7 c2a2g4fqnm25h
insert into cm_rawdata (profindx, batchid, topologyid, sampletime, sysuptime, do
csifcmstatustxpower, docsifdownchannelpower, docsifsigqunerroreds, docsifsigqcor
recteds, docsifsigquncorrectables, docsifsigqsignalnoise, sysobjectid) values (:
1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12)

        16        158            0         N/A     2.9 10dkqv3kr8xa5
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

        11        107            1       10.68     2.0 87gy6mxtk7f3z
DELETE FROM CM_POLL_STATUS WHERE TOPOLOGYID IN ( SELECT DISTINCT TOPOLOGYID FROM
 CM_RAWDATA WHERE BATCHID = :B1 )

         9        130            1        9.26     2.4 86m0m9q8fw9bj
DELETE FROM CM_QOS_PROF WHERE SECONDID <= :B1

         9        130            1        9.03     2.4 6n0d6cv6w6krs
DELETE FROM CM_VA WHERE SECONDID <= :B1

         9        108            1        9.01     2.0 21jqxqyf80cn8
DELETE FROM CM_POWER_1 WHERE SECONDID <= :B1

         9         74            1        8.99     1.4 3whpusvtv0qq1
INSERT INTO TMP_CALC_QOS_SLOW_CM_TMP SELECT T.CMTSID, T.DOWNID, T.UPID, T.CMID,
GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), R.DO
CSIFCMTSSERVICEINOCTETS, R.DOCSIFCMTSSERVICEOUTOCTETS, S.SID, L.PREV_SECONDID, L
.PREV_IFINOCTETS, L.PREV_IFOUTOCTETS, L.PREV_SID FROM TMP_TOP_SLOW_CM T, CM_RAWD

         9        117            1        8.96     2.2 0fnnktt50m86h
SQL ordered by CPU Time                  DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
DELETE FROM CM_ERRORS WHERE SECONDID <= :B1

         9        124            1        8.88     2.3 gyqv6h5pft4mj
DELETE FROM CM_BYTES WHERE SECONDID <= :B1

         9        119            1        8.87     2.2 aywfs0n7wwwhn
DELETE FROM CM_POWER_2 WHERE SECONDID <= :B1

         9         85            1        8.52     1.6 998t5bbdfm5rm
INSERT INTO CM_RAWDATA SELECT PROFINDX, 0 BATCHID, TOPOLOGYID, SAMPLETIME, SYSUP
TIME, DOCSIFCMTSCMSTATUSVALUE, DOCSIFCMTSSERVICEINOCTETS, DOCSIFCMTSSERVICEOUTOC
TETS, DOCSIFCMSTATUSTXPOWER, DOCSIFCMTSCMSTATUSRXPOWER, DOCSIFDOWNCHANNELPOWER,
DOCSIFSIGQUNERROREDS, DOCSIFSIGQCORRECTEDS, DOCSIFSIGQUNCORRECTABLES, DOCSIFSIGQ

         8         74            1        7.66     1.4 9h99br1t3qq3a
INSERT INTO TMP_CALC_HFC_SLOW_CM_LAST SELECT * FROM TMP_CALC_HFC_SLOW_CM_LAST_TM
P

         7         64            1        7.43     1.2 fqcwt6uak8x3w
INSERT INTO TMP_CALC_QOS_SLOW_CM_LAST SELECT * FROM TMP_CALC_QOS_SLOW_CM_LAST_TM
P

         7        139            1        7.13     2.6 38zhkf4jdyff4
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN ash.collect(3,1200); :mydate := next_date; IF broken THEN :b := 1
; ELSE :b := 0; END IF; END;

         7         72            1        6.69     1.3 4qunm1qbf8cyk
select power.TOPOLOGYID, power.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, CHANNELWID
TH, RXPOWER_UP, RXPOWER UPSTREAM_AVG_RX FROM CM_POWER_1 power, TOPOLOGY_LINK lin
k, UPSTREAM_CHANNEL channel, UPSTREAM_POWER_1 upstream_rx WHERE power.SECONDID =
 :1 and power.SECONDID = upstream_rx.secondid AND link.TOPOLOGYID = power.TOPOLO

         6         59            1        6.12     1.1 fd6a0p6333g8z
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

         6         96            1        5.82     1.8 2r6jnnf1hzb4z
select power.TOPOLOGYID, power.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, BITSPERSYM
BOL, TXPOWER_UP FROM CM_POWER_2 power, TOPOLOGY_LINK link, UPSTREAM_CHANNEL chan
nel WHERE power.SECONDID = :1 AND link.TOPOLOGYID = power.TOPOLOGYID AND link.PA
RENTLEN = 1 AND link.STATEID = 1 AND link.LINKTYPEID = 1 AND link.PARENTID = cha

         5         84            1        5.23     1.6 3a11s4c86wdu5
DELETE FROM CM_RAWDATA WHERE BATCHID = 0 AND PROFINDX = :B1

         5         94            1        5.19     1.7 fxvdq915s3qpt
DELETE FROM TMP_CALC_HFC_SLOW_CM_LAST

         4        202            4        1.11     3.8 dr1rkrznhh95b
Call CALC_TOPOLOGY_MEDIUM(:1, :2, :3, :4)

         4         87            1        3.68     1.6 axyukfdx12pu4
Call CALC_DELETE_SLOW_RAWDATA(:1, :2)

         3        126            1        2.92     2.3 33bpz9dh1w5jk
Module: Lab128
--lab128 select /*+rule*/ owner, segment_name||decode(partition_name,null,nul
SQL ordered by CPU Time                  DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
l,' ('||partition_name||')') name, segment_type,tablespace_name, extent_id,f
ile_id,block_id, blocks,bytes/1048576 bytes from dba_extents

         3         68            1        2.66     1.3 bzmccctnyjb3z
INSERT INTO DOWNSTREAM_ERRORS SELECT T2.SECONDID, T1.DOWNID, ROUND(AVG(T2.SAMPLE
_LENGTH), 0), ROUND(AVG(DECODE(T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRECTABLES
,0,0, T2.UNCORRECTABLES / ( T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRECTABLES )
* 100)) ,2) AVG_CER, ROUND(AVG(DECODE(T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRE

         2        121           56        0.04     2.3 6gvch1xu9ca3g
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); :mydate := next_date
; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;

         2        120            4        0.42     2.2 4zjg6w4mwu0wv
INSERT INTO TMP_TOP_MED_DN SELECT M.CMTSID, M.VENDOR_DESC, M.MODEL_DESC, MAC_L.T
OPOLOGYID, DOWN_L.TOPOLOGYID, M.UP_SNR_CNR_A3, M.UP_SNR_CNR_A2, M.UP_SNR_CNR_A1,
 M.UP_SNR_CNR_A0, M.MAC_SLOTS_OPEN, M.MAC_SLOTS_USED, M.CMTS_REBOOT, 0 FROM TMP_
TOP_MED_CMTS M, TOPOLOGY_LINK DOWN_L, TOPOLOGY_NODE DOWN_N, TOPOLOGY_LINK MAC_L

         1         95            1        1.19     1.8 1qp1yn30gajjw
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, M.
TOPOLOGYID UP_ID, T.UP_DESC UP_DESC, T.MAC_ID
 MAC_ID, T.CMTS_ID CMTS_ID, M.MAX_PERCENT_UTI
L, M.MAX_PACKETS_PER_SEC, M.AVG_PACKET_SIZE,

         1        116          977        0.00     2.1 5jh6zfmvpu77f
UPDATE ASH.DBIDS@REPO SET ASHSEQ = :B2 WHERE DBID = :B1

          -------------------------------------------------------------

SQL ordered by Gets                      DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> Total Buffer Gets:      30,077,723
-> Captured SQL account for     169.4% of Total

                                Gets              CPU     Elapsed
  Buffer Gets   Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ------------ ------------ ------ -------- --------- -------------
    16,494,914            1 ############   54.8   133.81    796.60 f1qcyh20550cf
Call CALC_QOS_SLOW(:1, :2, :3, :4)

    11,322,501            1 ############   37.6    71.96    136.75 298wmz1kxjs1m
INSERT INTO CM_QOS_PROF SELECT :B1 , R.TOPOLOGYID, :B1 - :B4 , P.NODE_PROFILE_ID
, R.DOCSIFCMTSSERVICEQOSPROFILE FROM CM_SID_RAWDATA R, ( SELECT DISTINCT T.CMID,
 P.QOS_PROF_IDX, P.NODE_PROFILE_ID FROM TMP_TOP_SLOW_CM T, CMTS_QOS_PROF P WHERE
 T.CMTSID = P.TOPOLOGYID AND P.SECONDID = :B1 ) P WHERE R.BATCHID = :B3 AND R.PR

     3,835,310            1  3,835,310.0   12.8    57.60    773.15 fj6gjgsshtxyx
Call CALC_DELETE_OLD_DATA(:1)

     2,140,461            1  2,140,461.0    7.1    24.50    354.27 0cjsxw5ndqdbc
Call CALC_HFC_SLOW(:1, :2, :3, :4)

     1,434,233            1  1,434,233.0    4.8    29.25    275.28 8t8as9usk11qw
Call CALC_TOPOLOGY_SLOW(:1, :2, :3, :4)

     1,400,037            1  1,400,037.0    4.7     8.99     73.62 3whpusvtv0qq1
INSERT INTO TMP_CALC_QOS_SLOW_CM_TMP SELECT T.CMTSID, T.DOWNID, T.UPID, T.CMID,
GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), R.DO
CSIFCMTSSERVICEINOCTETS, R.DOCSIFCMTSSERVICEOUTOCTETS, S.SID, L.PREV_SECONDID, L
.PREV_IFINOCTETS, L.PREV_IFOUTOCTETS, L.PREV_SID FROM TMP_TOP_SLOW_CM T, CM_RAWD

     1,213,966            1  1,213,966.0    4.0     6.05     14.45 553hp60qv7vyh
select errors.TOPOLOGYID, errors.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, CHANNELW
IDTH, BITSPERSYMBOL, SNR_DOWN, RXPOWER_DOWN FROM CM_ERRORS errors, CM_POWER_2 po
wer, TOPOLOGY_LINK link, DOWNSTREAM_CHANNEL channel where errors.SECONDID = powe
r.SECONDID AND errors.SECONDID = :1 AND errors.TOPOLOGYID = power.TOPOLOGYID AND

     1,065,052            1  1,065,052.0    3.5     6.69     72.01 4qunm1qbf8cyk
select power.TOPOLOGYID, power.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, CHANNELWID
TH, RXPOWER_UP, RXPOWER UPSTREAM_AVG_RX FROM CM_POWER_1 power, TOPOLOGY_LINK lin
k, UPSTREAM_CHANNEL channel, UPSTREAM_POWER_1 upstream_rx WHERE power.SECONDID =
 :1 and power.SECONDID = upstream_rx.secondid AND link.TOPOLOGYID = power.TOPOLO

     1,011,784            1  1,011,784.0    3.4     8.52     84.62 998t5bbdfm5rm
INSERT INTO CM_RAWDATA SELECT PROFINDX, 0 BATCHID, TOPOLOGYID, SAMPLETIME, SYSUP
TIME, DOCSIFCMTSCMSTATUSVALUE, DOCSIFCMTSSERVICEINOCTETS, DOCSIFCMTSSERVICEOUTOC
TETS, DOCSIFCMSTATUSTXPOWER, DOCSIFCMTSCMSTATUSRXPOWER, DOCSIFDOWNCHANNELPOWER,
DOCSIFSIGQUNERROREDS, DOCSIFSIGQCORRECTEDS, DOCSIFSIGQUNCORRECTABLES, DOCSIFSIGQ

       776,443            1    776,443.0    2.6     7.66     73.54 9h99br1t3qq3a
INSERT INTO TMP_CALC_HFC_SLOW_CM_LAST SELECT * FROM TMP_CALC_HFC_SLOW_CM_LAST_TM
P

       762,710            1    762,710.0    2.5     5.82     95.88 2r6jnnf1hzb4z
select power.TOPOLOGYID, power.SAMPLE_LENGTH, UNIQUE_CMS, ACTIVE_CMS, BITSPERSYM
BOL, TXPOWER_UP FROM CM_POWER_2 power, TOPOLOGY_LINK link, UPSTREAM_CHANNEL chan
nel WHERE power.SECONDID = :1 AND link.TOPOLOGYID = power.TOPOLOGYID AND link.PA
RENTLEN = 1 AND link.STATEID = 1 AND link.LINKTYPEID = 1 AND link.PARENTID = cha

       724,267            1    724,267.0    2.4     7.43     63.59 fqcwt6uak8x3w
INSERT INTO TMP_CALC_QOS_SLOW_CM_LAST SELECT * FROM TMP_CALC_QOS_SLOW_CM_LAST_TM
P

       669,534            1    669,534.0    2.2     6.37     38.97 094vgzny6jvm4
INSERT INTO CM_VA ( SECONDID, TOPOLOGYID, CER, CCER, SNR, STATUSVALUE, TIMINGOFF
SET ) SELECT :B3 , TOPOLOGYID, CASE WHEN (CMTSCM_UNERR_D IS NULL OR CMTSCM_CORR_
D IS NULL OR CMTSCM_UNCORR_D IS NULL) THEN NULL ELSE 100 * CMTSCM_UNCORR_D/TOTAL
SQL ordered by Gets                      DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> Total Buffer Gets:      30,077,723
-> Captured SQL account for     169.4% of Total

                                Gets              CPU     Elapsed
  Buffer Gets   Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ------------ ------------ ------ -------- --------- -------------
_D END CER, CASE WHEN (CMTSCM_UNERR_D IS NULL OR CMTSCM_CORR_D IS NULL OR CMTSCM

       633,947      150,259          4.2    2.1    18.21     40.04 c2a2g4fqnm25h
insert into cm_rawdata (profindx, batchid, topologyid, sampletime, sysuptime, do
csifcmstatustxpower, docsifdownchannelpower, docsifsigqunerroreds, docsifsigqcor
recteds, docsifsigquncorrectables, docsifsigqsignalnoise, sysobjectid) values (:
1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12)

       618,871      150,324          4.1    2.1    18.56     51.78 6xz6vg8q1zygu
insert into cm_rawdata (profindx, batchid, topologyid, sampletime, docsifcmtscms
tatusvalue, docsifcmtsserviceinoctets, docsifcmtsserviceoutoctets, docsifcmtscms
tatusrxpower, cmtscm_unerr, cmtscm_corr, cmtscm_uncorr, cmtscm_snr, cmtscm_timin
goffset) values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13)

       615,244            1    615,244.0    2.0     9.03    130.46 6n0d6cv6w6krs
DELETE FROM CM_VA WHERE SECONDID <= :B1

       615,129            1    615,129.0    2.0     9.26    130.03 86m0m9q8fw9bj
DELETE FROM CM_QOS_PROF WHERE SECONDID <= :B1

       614,747            1    614,747.0    2.0     8.96    117.43 0fnnktt50m86h
DELETE FROM CM_ERRORS WHERE SECONDID <= :B1

       614,661            1    614,661.0    2.0     8.88    124.47 gyqv6h5pft4mj
DELETE FROM CM_BYTES WHERE SECONDID <= :B1

       614,649            1    614,649.0    2.0    10.68    107.01 87gy6mxtk7f3z
DELETE FROM CM_POLL_STATUS WHERE TOPOLOGYID IN ( SELECT DISTINCT TOPOLOGYID FROM
 CM_RAWDATA WHERE BATCHID = :B1 )

       613,965            1    613,965.0    2.0     8.87    119.15 aywfs0n7wwwhn
DELETE FROM CM_POWER_2 WHERE SECONDID <= :B1

       613,256            1    613,256.0    2.0     9.01    107.53 21jqxqyf80cn8
DELETE FROM CM_POWER_1 WHERE SECONDID <= :B1

       598,348      150,832          4.0    2.0    22.39     76.71 5zm9acqtd51h7
insert into cm_sid_rawdata (profindx, batchid, topologyid, sid, sampletime, docs
IfCmtsServiceQosProfile) values (:1, :2, :3, :4, :5, :6)

       343,903            1    343,903.0    1.1     2.45     11.06 8b7g4s4qa5r1d
INSERT INTO UPSTREAM_POWER_1 SELECT :B4 , T.UPID, :B4 - :B3 , ROUND(AVG(C.DOCSIF
CMTSCMSTATUSRXPOWER), 0) FROM CM_RAWDATA C, TMP_TOP_SLOW_CM T WHERE C.TOPOLOGYID
 = T.CMID AND C.BATCHID = :B2 AND C.PROFINDX = :B1 GROUP BY T.UPID

       301,471            1    301,471.0    1.0     2.66     68.37 bzmccctnyjb3z
INSERT INTO DOWNSTREAM_ERRORS SELECT T2.SECONDID, T1.DOWNID, ROUND(AVG(T2.SAMPLE
_LENGTH), 0), ROUND(AVG(DECODE(T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRECTABLES
,0,0, T2.UNCORRECTABLES / ( T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRECTABLES )
* 100)) ,2) AVG_CER, ROUND(AVG(DECODE(T2.UNERROREDS + T2.CORRECTEDS + T2.UNCORRE

          -------------------------------------------------------------

SQL ordered by Reads                     DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Disk Reads:         401,992
-> Captured SQL account for    134.7% of Total

                               Reads              CPU     Elapsed
Physical Reads  Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ----------- ------------- ------ -------- --------- -------------
       192,597           1     192,597.0   47.9   133.81    796.60 f1qcyh20550cf
Call CALC_QOS_SLOW(:1, :2, :3, :4)

       144,969           1     144,969.0   36.1    71.96    136.75 298wmz1kxjs1m
INSERT INTO CM_QOS_PROF SELECT :B1 , R.TOPOLOGYID, :B1 - :B4 , P.NODE_PROFILE_ID
, R.DOCSIFCMTSSERVICEQOSPROFILE FROM CM_SID_RAWDATA R, ( SELECT DISTINCT T.CMID,
 P.QOS_PROF_IDX, P.NODE_PROFILE_ID FROM TMP_TOP_SLOW_CM T, CMTS_QOS_PROF P WHERE
 T.CMTSID = P.TOPOLOGYID AND P.SECONDID = :B1 ) P WHERE R.BATCHID = :B3 AND R.PR

        28,436           4       7,109.0    7.1     4.42    201.93 dr1rkrznhh95b
Call CALC_TOPOLOGY_MEDIUM(:1, :2, :3, :4)

        22,352           1      22,352.0    5.6    24.50    354.27 0cjsxw5ndqdbc
Call CALC_HFC_SLOW(:1, :2, :3, :4)

        21,907           1      21,907.0    5.4    57.60    773.15 fj6gjgsshtxyx
Call CALC_DELETE_OLD_DATA(:1)

        15,834           0           N/A    3.9    15.56    158.02 10dkqv3kr8xa5
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

        15,050           1      15,050.0    3.7    29.25    275.28 8t8as9usk11qw
Call CALC_TOPOLOGY_SLOW(:1, :2, :3, :4)

        13,424           1      13,424.0    3.3     6.12     58.83 fd6a0p6333g8z
 SELECT trunc(SYSDATE, 'HH24') HOUR_STAMP, CM_ID, MA
X(SUBSTR(CM_DESC, 1, 12)) CM_DESC, MAX(UP_ID) UP_ID, MA
X(DOWN_ID) DOWN_ID, MAX(MAC_ID) MAC_ID, MAX(CMTS_
ID) CMTS_ID, SUM(BYTES_UP) SUM_BYTES_UP, SUM(BY

        10,667           1      10,667.0    2.7     2.92    125.63 33bpz9dh1w5jk
Module: Lab128
--lab128 select /*+rule*/ owner, segment_name||decode(partition_name,null,nul
l,' ('||partition_name||')') name, segment_type,tablespace_name, extent_id,f
ile_id,block_id, blocks,bytes/1048576 bytes from dba_extents

         9,156           4       2,289.0    2.3     1.68    119.84 4zjg6w4mwu0wv
INSERT INTO TMP_TOP_MED_DN SELECT M.CMTSID, M.VENDOR_DESC, M.MODEL_DESC, MAC_L.T
OPOLOGYID, DOWN_L.TOPOLOGYID, M.UP_SNR_CNR_A3, M.UP_SNR_CNR_A2, M.UP_SNR_CNR_A1,
 M.UP_SNR_CNR_A0, M.MAC_SLOTS_OPEN, M.MAC_SLOTS_USED, M.CMTS_REBOOT, 0 FROM TMP_
TOP_MED_CMTS M, TOPOLOGY_LINK DOWN_L, TOPOLOGY_NODE DOWN_N, TOPOLOGY_LINK MAC_L

         8,700           1       8,700.0    2.2     3.68     86.86 axyukfdx12pu4
Call CALC_DELETE_SLOW_RAWDATA(:1, :2)

         6,878           1       6,878.0    1.7     8.99     73.62 3whpusvtv0qq1
INSERT INTO TMP_CALC_QOS_SLOW_CM_TMP SELECT T.CMTSID, T.DOWNID, T.UPID, T.CMID,
GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), GREATEST(T.CMTS_REBOOT, T.UP_REBOOT), R.DO
CSIFCMTSSERVICEINOCTETS, R.DOCSIFCMTSSERVICEOUTOCTETS, S.SID, L.PREV_SECONDID, L
.PREV_IFINOCTETS, L.PREV_IFOUTOCTETS, L.PREV_SID FROM TMP_TOP_SLOW_CM T, CM_RAWD

         5,338           1       5,338.0    1.3     6.37     38.97 094vgzny6jvm4
INSERT INTO CM_VA ( SECONDID, TOPOLOGYID, CER, CCER, SNR, STATUSVALUE, TIMINGOFF
SET ) SELECT :B3 , TOPOLOGYID, CASE WHEN (CMTSCM_UNERR_D IS NULL OR CMTSCM_CORR_
D IS NULL OR CMTSCM_UNCORR_D IS NULL) THEN NULL ELSE 100 * CMTSCM_UNCORR_D/TOTAL
_D END CER, CASE WHEN (CMTSCM_UNERR_D IS NULL OR CMTSCM_CORR_D IS NULL OR CMTSCM

SQL ordered by Reads                     DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Disk Reads:         401,992
-> Captured SQL account for    134.7% of Total

                               Reads              CPU     Elapsed
Physical Reads  Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ----------- ------------- ------ -------- --------- -------------
         4,337           4       1,084.3    1.1     0.36      5.60 46jpzuthyv6wa
Module: Lab128
--lab128 select se.fa_se, uit.ui, uipt.uip, uist.uis, fr_s.fr_se, t.dt from (se
lect /*+ all_rows */ count(*) fa_se from (select ts#,max(length) m from sys.fet$
 group by ts#) f, sys.seg$ s where s.ts#=f.ts# and extsize>m) se, (select count(
*) ui from sys.ind$ where bitand(flags,1)=1) uit, (select count(*) uip from sys.

         4,197           1       4,197.0    1.0     2.45     11.06 8b7g4s4qa5r1d
INSERT INTO UPSTREAM_POWER_1 SELECT :B4 , T.UPID, :B4 - :B3 , ROUND(AVG(C.DOCSIF
CMTSCMSTATUSRXPOWER), 0) FROM CM_RAWDATA C, TMP_TOP_SLOW_CM T WHERE C.TOPOLOGYID
 = T.CMID AND C.BATCHID = :B2 AND C.PROFINDX = :B1 GROUP BY T.UPID

          -------------------------------------------------------------

SQL ordered by Executions                DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Executions:         542,597
-> Captured SQL account for     86.2% of Total

                                              CPU per    Elap per
 Executions   Rows Processed  Rows per Exec   Exec (s)   Exec (s)     SQL Id
------------ --------------- -------------- ---------- ----------- -------------
     150,832         150,324            1.0       0.00        0.00 5zm9acqtd51h7
insert into cm_sid_rawdata (profindx, batchid, topologyid, sid, sampletime, docs
IfCmtsServiceQosProfile) values (:1, :2, :3, :4, :5, :6)

     150,324         150,324            1.0       0.00        0.00 6xz6vg8q1zygu
insert into cm_rawdata (profindx, batchid, topologyid, sampletime, docsifcmtscms
tatusvalue, docsifcmtsserviceinoctets, docsifcmtsserviceoutoctets, docsifcmtscms
tatusrxpower, cmtscm_unerr, cmtscm_corr, cmtscm_uncorr, cmtscm_snr, cmtscm_timin
goffset) values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13)

     150,259         150,259            1.0       0.00        0.00 c2a2g4fqnm25h
insert into cm_rawdata (profindx, batchid, topologyid, sampletime, sysuptime, do
csifcmstatustxpower, docsifdownchannelpower, docsifsigqunerroreds, docsifsigqcor
recteds, docsifsigquncorrectables, docsifsigqsignalnoise, sysobjectid) values (:
1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12)

       8,128           8,128            1.0       0.00        0.01 12a0nrhpk3hym
UPDATE TOPOLOGY_LINK SET DATETO=sysdate, STATEID=0 WHERE TOPOLOGYID=:1 AND PAREN
TID=:2 AND STATEID=1

         977             977            1.0       0.00        0.12 5jh6zfmvpu77f
UPDATE ASH.DBIDS@REPO SET ASHSEQ = :B2 WHERE DBID = :B1

         624             624            1.0       0.00        0.00 7h35uxf5uhmm1
select sysdate from dual

         624               0            0.0       0.00        0.00 apuw5pk7p77hc
ALTER SESSION SET ISOLATION_LEVEL = READ COMMITTED

         595           7,140           12.0       0.01        0.01 d5vf5a1ffcskb
Module: Lab128
--lab128 select replace(stat_name,'TICKS','TIME') stat_name,value from v$osstat
 where substr(stat_name,1,3) !='AVG'

         567             567            1.0       0.00        0.00 bsa0wjtftg3uw
select file# from file$ where ts#=:1

         556             556            1.0       0.01        0.02 7gtztzv329wg0
select c.name, u.name from con$ c, cdef$ cd, user$ u where c.con# = cd.con# and
 cd.enabled = :1 and c.owner# = u.user#

          -------------------------------------------------------------

SQL ordered by Parse Calls               DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Parse Calls:          11,460
-> Captured SQL account for      56.7% of Total

                            % Total
 Parse Calls  Executions     Parses    SQL Id
------------ ------------ --------- -------------
         624          624      5.45 7h35uxf5uhmm1
select sysdate from dual

         624          624      5.45 apuw5pk7p77hc
ALTER SESSION SET ISOLATION_LEVEL = READ COMMITTED

         567          567      4.95 bsa0wjtftg3uw
select file# from file$ where ts#=:1

         556          556      4.85 7gtztzv329wg0
select c.name, u.name from con$ c, cdef$ cd, user$ u where c.con# = cd.con# and
 cd.enabled = :1 and c.owner# = u.user#

         508      150,832      4.43 5zm9acqtd51h7
insert into cm_sid_rawdata (profindx, batchid, topologyid, sid, sampletime, docs
IfCmtsServiceQosProfile) values (:1, :2, :3, :4, :5, :6)

         448          448      3.91 0h6b2sajwb74n
select privilege#,level from sysauth$ connect by grantee#=prior privilege# and p
rivilege#>0 start with grantee#=:1 and privilege#>0

         411          411      3.59 9qgtwh66xg6nz
update seg$ set type#=:4,blocks=:5,extents=:6,minexts=:7,maxexts=:8,extsize=:9,e
xtpct=:10,user#=:11,iniexts=:12,lists=decode(:13, 65535, NULL, :13),groups=decod
e(:14, 65535, NULL, :14), cachehint=:15, hwmincr=:16, spare1=DECODE(:17,0,NULL,:
17),scanhint=:18 where ts#=:1 and file#=:2 and block#=:3

         297          297      2.59 350f5yrnnmshs
lock table sys.mon_mods$ in exclusive mode nowait

         297          297      2.59 g00cj285jmgsw
update sys.mon_mods$ set inserts = inserts + :ins, updates = updates + :upd, del
etes = deletes + :del, flags = (decode(bitand(flags, :flag), :flag, flags, flags
 + :flag)), drop_segments = drop_segments + :dropseg, timestamp = :time where ob
j# = :objn

         181          181      1.58 6129566gyvx21
Module: OEM.SystemPool
SELECT INSTANTIABLE, supertype_owner, supertype_name, LOCAL_ATTRIBUTES FROM all_
types WHERE type_name = :1 AND owner = :2

         144          144      1.26 0k8522rmdzg4k
select privilege# from sysauth$ where (grantee#=:1 or grantee#=1) and privilege#
>0

         128          128      1.12 cp8ygp2mr8j6s
select * from TOPOLOGY_NODETYPE where NODETYPEID < 0

         117          117      1.02 2b064ybzkwf1y
Module: OEM.SystemPool
BEGIN EMD_NOTIFICATION.QUEUE_READY(:1, :2, :3); END;

         117          117      1.02 9p1um1wd886xb
select o.owner#, u.name, o.name, o.namespace, o.obj#, d.d
_timestamp, nvl(d.property,0), o.type#, o.subname, d.d_attrs from dependency$ d
, obj$ o, user$ u where d.p_obj#=:1 and (d.p_timestamp=:2 or d.property=2)
and d.d_obj#=o.obj# and o.owner#=u.user# order by o.obj#

         116          116      1.01 9zg6y3ucgy8kb
select n.intcol# from ntab$ n, col$ c where n.obj#=:1 and c.obj#=:1 and c.intco
SQL ordered by Parse Calls               DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Parse Calls:          11,460
-> Captured SQL account for      56.7% of Total

                            % Total
 Parse Calls  Executions     Parses    SQL Id
------------ ------------ --------- -------------
l#=n.intcol# and bitand(c.property, 32768)!=32768

          -------------------------------------------------------------

SQL ordered by Sharable Memory           DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

SQL ordered by Version Count             DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Instance Activity Stats                  DB/Inst: CDB10/cdb10  Snaps: 122-123

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
CPU used by this session                     48,802           13.5          23.9
CPU used when call started                   49,725           13.8          24.3
CR blocks created                             1,548            0.4           0.8
Cached Commit SCN referenced                  4,257            1.2           2.1
Commit SCN cached                                19            0.0           0.0
DB time                                   2,051,539          567.4       1,002.7
DBWR checkpoint buffers written               7,052            2.0           3.5
DBWR checkpoints                                 78            0.0           0.0
DBWR object drop buffers written                352            0.1           0.2
DBWR revisited being-written buf                281            0.1           0.1
DBWR thread checkpoint buffers w              6,008            1.7           2.9
DBWR transaction table writes                   169            0.1           0.1
DBWR undo block writes                       86,711           24.0          42.4
IMU CR rollbacks                                196            0.1           0.1
IMU Flushes                                   1,921            0.5           0.9
IMU Redo allocation size                  4,831,688        1,336.3       2,361.5
IMU commits                                   1,095            0.3           0.5
IMU contention                                   51            0.0           0.0
IMU ktichg flush                                 11            0.0           0.0
IMU pool not allocated                          261            0.1           0.1
IMU recursive-transaction flush                   5            0.0           0.0
IMU undo allocation size                  8,282,272        2,290.7       4,048.0
IMU- failed to get a private str                261            0.1           0.1
PX local messages recv'd                          0            0.0           0.0
PX local messages sent                            0            0.0           0.0
SMON posted for undo segment shr                  8            0.0           0.0
SQL*Net roundtrips to/from clien            557,524          154.2         272.5
SQL*Net roundtrips to/from dblin              5,571            1.5           2.7
active txn count during cleanout            667,416          184.6         326.2
application wait time                         2,949            0.8           1.4
auto extends on undo tablespace                   0            0.0           0.0
background checkpoints completed                 33            0.0           0.0
background checkpoints started                   32            0.0           0.0
background timeouts                          10,887            3.0           5.3
branch node splits                               14            0.0           0.0
buffer is not pinned count               16,308,390        4,510.5       7,970.9
buffer is pinned count                   37,217,420       10,293.4      18,190.3
bytes received via SQL*Net from          54,299,124       15,017.8      26,539.2
bytes received via SQL*Net from             702,510          194.3         343.4
bytes sent via SQL*Net to client         59,493,239       16,454.4      29,077.8
bytes sent via SQL*Net to dblink          4,758,313        1,316.0       2,325.7
calls to get snapshot scn: kcmgs            102,555           28.4          50.1
calls to kcmgas                             122,772           34.0          60.0
calls to kcmgcs                             666,871          184.4         325.9
change write time                            93,636           25.9          45.8
cleanout - number of ktugct call            694,894          192.2         339.6
cleanouts and rollbacks - consis                524            0.1           0.3
cleanouts only - consistent read             16,400            4.5           8.0
cluster key scan block gets                  62,504           17.3          30.6
cluster key scans                            44,624           12.3          21.8
commit batch performed                            5            0.0           0.0
commit batch requested                            5            0.0           0.0
commit batch/immediate performed                 49            0.0           0.0
commit batch/immediate requested                 49            0.0           0.0
commit cleanout failures: block              10,148            2.8           5.0
commit cleanout failures: buffer                 39            0.0           0.0
commit cleanout failures: callba                 93            0.0           0.1
commit cleanout failures: cannot                  2            0.0           0.0
commit cleanouts                             49,810           13.8          24.4
commit cleanouts successfully co             39,528           10.9          19.3
Instance Activity Stats                  DB/Inst: CDB10/cdb10  Snaps: 122-123

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
commit immediate performed                       44            0.0           0.0
commit immediate requested                       44            0.0           0.0
commit txn count during cleanout             37,416           10.4          18.3
concurrency wait time                         6,361            1.8           3.1
consistent changes                          375,588          103.9         183.6
consistent gets                          19,788,311        5,473.0       9,671.7
consistent gets - examination            15,781,101        4,364.7       7,713.2
consistent gets direct                            2            0.0           0.0
consistent gets from cache               19,788,309        5,473.0       9,671.7
current blocks converted for CR                   1            0.0           0.0
cursor authentications                           60            0.0           0.0
data blocks consistent reads - u              7,046            2.0           3.4
db block changes                          9,922,875        2,744.4       4,849.9
db block gets                            10,289,412        2,845.8       5,029.0
db block gets direct                          3,341            0.9           1.6
db block gets from cache                 10,286,071        2,844.9       5,027.4
deferred (CURRENT) block cleanou             10,217            2.8           5.0
dirty buffers inspected                     142,881           39.5          69.8
enqueue conversions                          13,940            3.9           6.8
enqueue releases                             71,947           19.9          35.2
enqueue requests                             71,973           19.9          35.2
enqueue timeouts                                 34            0.0           0.0
enqueue waits                                    65            0.0           0.0
exchange deadlocks                                0            0.0           0.0
execute count                               542,597          150.1         265.2
free buffer inspected                       536,842          148.5         262.4
free buffer requested                       511,414          141.4         250.0
global undo segment hints helped                  0            0.0           0.0
global undo segment hints were s                  0            0.0           0.0
heap block compress                          23,794            6.6          11.6
hot buffers moved to head of LRU             35,300            9.8          17.3
immediate (CR) block cleanout ap             16,924            4.7           8.3
immediate (CURRENT) block cleano             40,644           11.2          19.9
index fast full scans (full)                     11            0.0           0.0
index fetch by key                        9,609,838        2,657.9       4,696.9
index scans kdiixs1                         540,504          149.5         264.2
leaf node 90-10 splits                        3,675            1.0           1.8
leaf node splits                              7,868            2.2           3.9
lob reads                                        10            0.0           0.0
lob writes                                      597            0.2           0.3
lob writes unaligned                            597            0.2           0.3
logons cumulative                               179            0.1           0.1
messages received                            36,800           10.2          18.0
messages sent                                36,800           10.2          18.0
no buffer to keep pinned count                    0            0.0           0.0
no work - consistent read gets            3,414,669          944.4       1,669.0
opened cursors cumulative                    11,030            3.1           5.4
parse count (failures)                           11            0.0           0.0
parse count (hard)                              263            0.1           0.1
parse count (total)                          11,460            3.2           5.6
parse time cpu                                  184            0.1           0.1
parse time elapsed                            5,105            1.4           2.5
physical read IO requests                   286,506           79.2         140.0
physical read bytes                   3,293,118,464      910,795.7   1,609,539.8
physical read total IO requests             312,883           86.5         152.9
physical read total bytes             3,723,894,784    1,029,937.9   1,820,085.4
physical read total multi block              16,936            4.7           8.3
physical reads                              401,992          111.2         196.5
physical reads cache                        391,309          108.2         191.3
physical reads cache prefetch               106,160           29.4          51.9
Instance Activity Stats                  DB/Inst: CDB10/cdb10  Snaps: 122-123

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
physical reads direct                        10,683            3.0           5.2
physical reads direct (lob)                       2            0.0           0.0
physical reads direct temporary              10,450            2.9           5.1
physical write IO requests                  124,209           34.4          60.7
physical write bytes                  1,423,941,632      393,827.3     695,963.7
physical write total IO requests            135,013           37.3          66.0
physical write total bytes            3,039,874,048      840,754.5   1,485,764.4
physical write total multi block              9,946            2.8           4.9
physical writes                             173,821           48.1          85.0
physical writes direct                       15,138            4.2           7.4
physical writes direct (lob)                      3            0.0           0.0
physical writes direct temporary             13,312            3.7           6.5
physical writes from cache                  158,683           43.9          77.6
physical writes non checkpoint              171,458           47.4          83.8
pinned buffers inspected                      1,327            0.4           0.7
prefetched blocks aged out befor                971            0.3           0.5
process last non-idle time                    5,863            1.6           2.9
recovery blocks read                              0            0.0           0.0
recursive calls                             110,227           30.5          53.9
recursive cpu usage                          28,845            8.0          14.1
redo blocks read for recovery                     0            0.0           0.0
redo blocks written                       2,951,190          816.2       1,442.4
redo buffer allocation retries                4,972            1.4           2.4
redo entries                              4,971,193        1,374.9       2,429.7
redo log space requests                       1,018            0.3           0.5
redo log space wait time                     16,736            4.6           8.2
redo ordering marks                          86,212           23.8          42.1
redo size                             1,462,839,100      404,585.4     714,975.1
redo synch time                             114,641           31.7          56.0
redo synch writes                             5,072            1.4           2.5
redo wastage                                773,164          213.8         377.9
redo write time                             208,649           57.7         102.0
redo writer latching time                         9            0.0           0.0
redo writes                                   2,820            0.8           1.4
rollback changes - undo records               7,908            2.2           3.9
rollbacks only - consistent read              1,010            0.3           0.5
rows fetched via callback                 6,732,803        1,862.1       3,290.7
session connect time                              0            0.0           0.0
session cursor cache hits                     6,009            1.7           2.9
session logical reads                    30,077,723        8,318.8      14,700.7
session pga memory                       87,991,760       24,336.4      43,006.7
session pga memory max                  128,361,936       35,501.8      62,738.0
session uga memory                  262,000,976,040   72,463,036.0 #############
session uga memory max                  122,117,960       33,774.8      59,686.2
shared hash latch upgrades - no             918,434          254.0         448.9
shared hash latch upgrades - wai                  3            0.0           0.0
sorts (disk)                                      0            0.0           0.0
sorts (memory)                               32,808            9.1          16.0
sorts (rows)                              1,889,801          522.7         923.7
sql area purged                                  58            0.0           0.0
summed dirty queue length                 2,498,747          691.1       1,221.3
switch current to new buffer                 10,984            3.0           5.4
table fetch by rowid                     20,173,244        5,579.4       9,859.9
table fetch continued row                         9            0.0           0.0
table scan blocks gotten                    227,381           62.9         111.1
table scan rows gotten                   22,027,503        6,092.3      10,766.1
table scans (cache partitions)                    0            0.0           0.0
table scans (long tables)                       176            0.1           0.1
table scans (short tables)                    5,560            1.5           2.7
total number of times SMON poste                172            0.1           0.1
Instance Activity Stats                  DB/Inst: CDB10/cdb10  Snaps: 122-123

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
transaction rollbacks                            49            0.0           0.0
transaction tables consistent re                  7            0.0           0.0
transaction tables consistent re                254            0.1           0.1
undo change vector size                 619,905,088      171,450.5     302,983.9
user I/O wait time                          233,992           64.7         114.4
user calls                                  560,283          155.0         273.8
user commits                                  1,614            0.5           0.8
user rollbacks                                  432            0.1           0.2
workarea executions - onepass                     4            0.0           0.0
workarea executions - optimal                36,889           10.2          18.0
write clones created in backgrou                169            0.1           0.1
write clones created in foregrou                830            0.2           0.4
          -------------------------------------------------------------

Instance Activity Stats - Absolute ValuesDB/Inst: CDB10/cdb10  Snaps: 122-123
-> Statistics with absolute values (should not be diffed)

Statistic                            Begin Value       End Value
-------------------------------- --------------- ---------------
session cursor cache count                36,864          38,406
opened cursors current                       895             925
workarea memory allocated                 33,293          34,475
logons current                                36              37
          -------------------------------------------------------------

Instance Activity Stats - Thread Activity DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Statistics identified by '(derived)' come from sources other than SYSSTAT

Statistic                                     Total  per Hour
-------------------------------- ------------------ ---------
log switches (derived)                           32     31.86
          -------------------------------------------------------------

Tablespace IO Stats                      DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by IOs (Reads + Writes) desc

Tablespace
------------------------------
                 Av      Av     Av                       Av     Buffer Av Buf
         Reads Reads/s Rd(ms) Blks/Rd       Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
TS_STARGUS
       194,616      54    8.3     1.2       43,074       12          0    0.0
TEMP
        73,213      20    5.1     1.4       13,433        4          0    0.0
UNDOTBS1
           998       0   34.5     1.0       65,474       18        152  325.0
SYSTEM
         9,656       3   12.1     5.1          254        0          2  300.0
SYSAUX
         6,768       2   16.5     1.1        1,773        0          2   10.0
PERFSTAT
           661       0   35.7     1.0          271        0          0    0.0
EXAMPLE
           482       0   13.4     1.0           33        0          0    0.0
USERS
           105       0    8.7     1.0           33        0          0    0.0
          -------------------------------------------------------------

File IO Stats                            DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by Tablespace, File

Tablespace               Filename
------------------------ ----------------------------------------------------
                 Av      Av     Av                       Av     Buffer Av Buf
         Reads Reads/s Rd(ms) Blks/Rd       Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
EXAMPLE                  /export/home/oracle10/oradata/cdb10/example01.dbf
           482       0   13.4     1.0           33        0          0    0.0
PERFSTAT                 /export/home/oracle10/oradata/cdb10/perfstat01.dbf
           661       0   35.7     1.0          271        0          0    0.0
SYSAUX                   /export/home/oracle10/oradata/cdb10/sysaux01.dbf
         6,768       2   16.5     1.1        1,773        0          2   10.0
SYSTEM                   /export/home/oracle10/oradata/cdb10/system01.dbf
         9,656       3   12.1     5.1          254        0          2  300.0
TEMP                     /export/home/oracle10/oradata/cdb10/temp01.dbf
        73,213      20    5.1     1.4       13,433        4          0    N/A
TS_STARGUS               /export/home/oracle10/oradata/cdb10/ts_stargus_01.db
       194,616      54    8.3     1.2       43,074       12          0    0.0
UNDOTBS1                 /export/home/oracle10/oradata/cdb10/undotbs01.dbf
           998       0   34.5     1.0       65,474       18        152  325.0
USERS                    /export/home/oracle10/oradata/cdb10/users01.dbf
           105       0    8.7     1.0           33        0          0    0.0
          -------------------------------------------------------------

Buffer Pool Statistics                   DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Standard block size Pools  D: default,  K: keep,  R: recycle
-> Default Pools for other block sizes: 2k, 4k, 8k, 16k, 32k

                                                            Free Writ     Buffer
     Number of Pool         Buffer     Physical    Physical Buff Comp       Busy
P      Buffers Hit%           Gets        Reads      Writes Wait Wait      Waits
--- ---------- ---- -------------- ------------ ----------- ---- ---- ----------
D        3,465   99     30,072,012      391,303     159,176 ####    8        156
          -------------------------------------------------------------

Instance Recovery Stats                   DB/Inst: CDB10/cdb10  Snaps: 122-123
-> B: Begin snapshot,  E: End snapshot

  Targt  Estd                                  Log File Log Ckpt     Log Ckpt
  MTTR   MTTR   Recovery  Actual    Target       Size    Timeout     Interval
   (s)    (s)   Estd IOs Redo Blks Redo Blks  Redo Blks Redo Blks   Redo Blks
- ----- ----- ---------- --------- --------- ---------- --------- ------------
B     0    20       1046    147434    184320     184320    483666          N/A
E     0    16        764     94387    184320     184320    441470          N/A
          -------------------------------------------------------------

Buffer Pool Advisory                           DB/Inst: CDB10/cdb10  Snap: 123
-> Only rows with estimated physical reads >0 are displayed
-> ordered by Block Size, Buffers For Estimate

                                        Est
                                       Phys
    Size for   Size      Buffers for   Read          Estimated
P    Est (M) Factor         Estimate Factor     Physical Reads
--- -------- ------ ---------------- ------ ------------------
D          4     .1              495    2.6          5,966,703
D          8     .3              990    1.4          3,331,760
D         12     .4            1,485    1.4          3,181,146
D         16     .6            1,980    1.3          3,073,609
D         20     .7            2,475    1.3          2,965,522
D         24     .9            2,970    1.0          2,373,562
D         28    1.0            3,465    1.0          2,334,724
D         32    1.1            3,960    1.0          2,309,994
D         36    1.3            4,455    1.0          2,278,012
D         40    1.4            4,950    1.0          2,253,921
D         44    1.6            5,445    1.0          2,231,246
D         48    1.7            5,940    0.9          2,212,530
D         52    1.9            6,435    0.9          2,184,378
D         56    2.0            6,930    0.9          2,146,358
          -------------------------------------------------------------

PGA Aggr Summary                         DB/Inst: CDB10/cdb10  Snaps: 122-123
-> PGA cache hit % - percentage of W/A (WorkArea) data processed only in-memory

PGA Cache Hit %   W/A MB Processed  Extra W/A MB Read/Written
--------------- ------------------ --------------------------
           93.7              3,557                        241
          -------------------------------------------------------------

PGA Aggr Target Stats                     DB/Inst: CDB10/cdb10  Snaps: 122-123
-> B: Begin snap   E: End snap (rows dentified with B or E contain data
   which is absolute i.e. not diffed over the interval)
-> Auto PGA Target - actual workarea memory target
-> W/A PGA Used    - amount of memory used for all Workareas (manual + auto)
-> %PGA W/A Mem    - percentage of PGA memory allocated to workareas
-> %Auto W/A Mem   - percentage of workarea memory controlled by Auto Mem Mgmt
-> %Man W/A Mem    - percentage of workarea memory under manual control

                                                %PGA  %Auto   %Man
    PGA Aggr   Auto PGA   PGA Mem    W/A PGA     W/A    W/A    W/A Global Mem
   Target(M)  Target(M)  Alloc(M)    Used(M)     Mem    Mem    Mem   Bound(K)
- ---------- ---------- ---------- ---------- ------ ------ ------ ----------
B        200        127      141.6       32.5   23.0  100.0     .0     40,960
E        200        125      144.8       33.7   23.2  100.0     .0     40,960
          -------------------------------------------------------------

PGA Aggr Target Histogram                 DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Optimal Executions are purely in-memory operations

  Low     High
Optimal Optimal    Total Execs  Optimal Execs 1-Pass Execs M-Pass Execs
------- ------- -------------- -------------- ------------ ------------
     2K      4K         33,637         33,637            0            0
    64K    128K             25             25            0            0
   128K    256K              3              3            0            0
   256K    512K             26             26            0            0
   512K   1024K          2,273          2,273            0            0
     1M      2M            895            895            0            0
     4M      8M             10              8            2            0
     8M     16M             12             12            0            0
    16M     32M              2              2            0            0
    64M    128M              2              0            2            0
          -------------------------------------------------------------

PGA Memory Advisory                            DB/Inst: CDB10/cdb10  Snap: 123
-> When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value
   where Estd PGA Overalloc Count is 0

                                       Estd Extra    Estd PGA   Estd PGA
PGA Target    Size           W/A MB   W/A MB Read/      Cache  Overalloc
  Est (MB)   Factr        Processed Written to Disk     Hit %      Count
---------- ------- ---------------- ---------------- -------- ----------
        25     0.1         56,190.1          4,876.0     92.0        353
        50     0.3         56,190.1          3,846.0     94.0        203
       100     0.5         56,190.1            406.6     99.0          0
       150     0.8         56,190.1            278.9    100.0          0
       200     1.0         56,190.1            278.9    100.0          0
       240     1.2         56,190.1            215.7    100.0          0
       280     1.4         56,190.1            215.7    100.0          0
       320     1.6         56,190.1            215.7    100.0          0
       360     1.8         56,190.1            215.7    100.0          0
       400     2.0         56,190.1            215.7    100.0          0
       600     3.0         56,190.1            215.7    100.0          0
       800     4.0         56,190.1            215.7    100.0          0
     1,200     6.0         56,190.1            215.7    100.0          0
     1,600     8.0         56,190.1            215.7    100.0          0
          -------------------------------------------------------------

Shared Pool Advisory                          DB/Inst: CDB10/cdb10  Snap: 123
-> SP: Shared Pool     Est LC: Estimated Library Cache   Factr: Factor
-> Note there is often a 1:Many correlation between a single logical object
   in the Library Cache, and the physical number of memory objects associated
   with it.  Therefore comparing the number of Lib Cache objects (e.g. in
   v$librarycache), with the number of Lib Cache Memory Objects is invalid.

                                        Est LC Est LC  Est LC Est LC
    Shared    SP   Est LC                 Time   Time    Load   Load      Est LC
      Pool  Size     Size       Est LC   Saved  Saved    Time   Time         Mem
   Size(M) Factr      (M)      Mem Obj     (s)  Factr     (s)  Factr    Obj Hits
---------- ----- -------- ------------ ------- ------ ------- ------ -----------
        96    .8       19        2,407 #######    1.0     882    2.0   3,172,239
       112    .9       33        3,038 #######    1.0     538    1.2   3,190,425
       128   1.0       47        4,150 #######    1.0     433    1.0   3,193,792
       144   1.1       62        5,909 #######    1.0     430    1.0   3,194,235
       160   1.3       77        7,196 #######    1.0     427    1.0   3,194,510
       176   1.4       92        8,955 #######    1.0     427    1.0   3,194,594
       192   1.5      107       10,579 #######    1.0     426    1.0   3,194,828
       208   1.6      122       12,029 #######    1.0     426    1.0   3,195,128
       224   1.8      137       13,603 #######    1.0     424    1.0   3,195,555
       240   1.9      152       14,744 #######    1.0     423    1.0   3,195,770
       256   2.0      167       15,773 #######    1.0     423    1.0   3,195,906
          -------------------------------------------------------------

SGA Target Advisory                            DB/Inst: CDB10/cdb10  Snap: 123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Streams Pool Advisory                          DB/Inst: CDB10/cdb10  Snap: 123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Java Pool Advisory                             DB/Inst: CDB10/cdb10  Snap: 123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Buffer Wait Statistics                    DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by wait time desc, waits desc

Class                    Waits Total Wait Time (s)  Avg Time (ms)
------------------ ----------- ------------------- --------------
undo header                152                  49            325
data block                   4                   1            155
          -------------------------------------------------------------

Enqueue Activity                         DB/Inst: CDB10/cdb10  Snaps: 122-123
-> only enqueues with waits are shown
-> Enqueue stats gathered prior to 10g should not be compared with 10g data
-> ordered by Wait Time desc, Waits desc

Enqueue Type (Request Reason)
------------------------------------------------------------------------------
    Requests    Succ Gets Failed Gets       Waits  Wt Time (s) Av Wt Time(ms)
------------ ------------ ----------- ----------- ------------ --------------
RO-Multiple Object Reuse (fast object reuse)
         414          414           0          46           23         505.78
CF-Controlfile Transaction
       2,004        2,003           1          19            7         366.58
          -------------------------------------------------------------

Undo Segment Summary                     DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Min/Max TR (mins) - Min and Max Tuned Retention (minutes)
-> STO - Snapshot Too Old count,  OOS - Out of Space count
-> Undo segment block stats:
-> uS - unexpired Stolen,   uR - unexpired Released,   uU - unexpired reUsed
-> eS - expired   Stolen,   eR - expired   Released,   eU - expired   reUsed

Undo   Num Undo       Number of  Max Qry   Max Tx Min/Max   STO/     uS/uR/uU/
 TS# Blocks (K)    Transactions  Len (s) Concurcy TR (mins) OOS      eS/eR/eU
---- ---------- --------------- -------- -------- --------- ----- --------------
   1       82.3          16,347      253        6 15/15.25  0/0   0/0/0/0/0/0
          -------------------------------------------------------------

Undo Segment Stats                        DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Most recent 35 Undostat rows, ordered by Time desc

                Num Undo    Number of Max Qry  Max Tx Tun Ret STO/    uS/uR/uU/
End Time          Blocks Transactions Len (s)   Concy  (mins) OOS     eS/eR/eU
------------ ----------- ------------ ------- ------- ------- ----- ------------
31-Jul 17:54      17,588        4,451      13       6      15 0/0   0/0/0/0/0/0
31-Jul 17:44      11,302        4,215       0       4      15 0/0   0/0/0/0/0/0
31-Jul 17:34       8,066        1,832       0       4      15 0/0   0/0/0/0/0/0
31-Jul 17:24      17,412          861      90       5      15 0/0   0/0/0/0/0/0
31-Jul 17:14      15,100          892     137       3      15 0/0   0/0/0/0/0/0
31-Jul 17:04      12,857        4,096     253       6      15 0/0   0/0/0/0/0/0
          -------------------------------------------------------------

Latch Activity                           DB/Inst: CDB10/cdb10  Snaps: 122-123
-> "Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
   willing-to-wait latch get requests
-> "NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
-> "Pct Misses" for both should be very close to 0.0

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
AWR Alerted Metric Eleme         13,936    0.0    N/A      0            0    N/A
Consistent RBA                    2,852    0.0    N/A      0            0    N/A
FOB s.o list latch                  333    0.0    N/A      0            0    N/A
In memory undo latch             30,230    0.0    0.7      8        4,148    0.0
JS mem alloc latch                    3    0.0    N/A      0            0    N/A
JS queue access latch                 3    0.0    N/A      0            0    N/A
JS queue state obj latch         25,990    0.0    N/A      0            0    N/A
JS slv state obj latch              115    0.0    N/A      0            0    N/A
KMG MMAN ready and start          1,201    0.0    N/A      0            0    N/A
KTF sga latch                        10    0.0    N/A      0        1,006    0.0
KWQMN job cache list lat            116    0.0    N/A      0            0    N/A
KWQP Prop Status                      1    0.0    N/A      0            0    N/A
MQL Tracking Latch                    0    N/A    N/A      0           72    0.0
Memory Management Latch               0    N/A    N/A      0        1,201    0.0
OS process                          573    0.0    N/A      0            0    N/A
OS process allocation             1,584    0.0    N/A      0            0    N/A
OS process: request allo            235    0.0    N/A      0            0    N/A
PL/SQL warning settings             935    0.0    N/A      0            0    N/A
SQL memory manager latch              2    0.0    N/A      0        1,177    0.0
SQL memory manager worka         92,470    0.0    N/A      0            0    N/A
Shared B-Tree                       137    0.0    N/A      0            0    N/A
active checkpoint queue          34,292    0.0    N/A      0            0    N/A
active service list               8,119    0.0    N/A      0        1,272    0.0
archive control                   1,017    0.0    N/A      0            0    N/A
begin backup scn array               92    0.0    N/A      0            0    N/A
cache buffer handles             22,997    0.0    N/A      0            0    N/A
cache buffers chains         66,867,303    0.0    0.0      0      665,222    0.0
cache buffers lru chain       1,026,321    0.1    0.0      1      135,882    0.1
cache table scan latch                0    N/A    N/A      0       16,587    0.0
channel handle pool latc            570    0.0    N/A      0            0    N/A
channel operations paren         25,362    0.1    0.0      0            0    N/A
checkpoint queue latch          369,985    0.0    0.0      0      140,728    0.0
client/application info           2,329    0.0    N/A      0            0    N/A
commit callback allocati             97    0.0    N/A      0            0    N/A
compile environment latc          7,185    0.0    N/A      0            0    N/A
dictionary lookup                    55    0.0    N/A      0            0    N/A
dml lock allocation              21,178    0.0    N/A      0            0    N/A
dummy allocation                    357    0.0    N/A      0            0    N/A
enqueue hash chains             157,981    0.0    0.0      0        5,754    0.0
enqueues                         97,190    0.0    0.0      0            0    N/A
event group latch                   118    0.0    N/A      0            0    N/A
file cache latch                    995    0.0    N/A      0            0    N/A
global KZLD latch for me             81    0.0    N/A      0            0    N/A
global tx hash mapping           10,377    0.0    N/A      0            0    N/A
hash table column usage             163    0.0    N/A      0       72,097    0.0
hash table modification             129    0.0    N/A      0            0    N/A
job workq parent latch                0    N/A    N/A      0          122    0.0
job_queue_processes para            120    0.0    N/A      0            0    N/A
kks stats                           504    0.0    N/A      0            0    N/A
ksuosstats global area            1,435    0.0    N/A      0            0    N/A
ktm global data                     194    0.0    N/A      0            0    N/A
kwqbsn:qsga                         137    0.0    N/A      0            0    N/A
lgwr LWN SCN                      2,855    0.0    0.0      0            0    N/A
library cache                 1,239,482    0.0    0.0      0          322    0.0
library cache load lock              90    0.0    N/A      0            7    0.0
library cache lock               55,083    0.0    N/A      0            0    N/A
library cache lock alloc          1,753    0.0    N/A      0            0    N/A
library cache pin             1,158,486    0.0    0.0      0            0    N/A
library cache pin alloca            584    0.0    N/A      0            0    N/A
list of block allocation          1,340    0.0    N/A      0            0    N/A
Latch Activity                           DB/Inst: CDB10/cdb10  Snaps: 122-123
-> "Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
   willing-to-wait latch get requests
-> "NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
-> "Pct Misses" for both should be very close to 0.0

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
loader state object free            570    0.0    N/A      0            0    N/A
longop free list parent               1    0.0    N/A      0            1    0.0
message pool operations             568    0.0    N/A      0            0    N/A
messages                         99,560    0.0    0.0      0            0    N/A
mostly latch-free SCN             2,865    0.2    0.0      0            0    N/A
multiblock read objects          35,166    0.0    N/A      0            0    N/A
ncodef allocation latch              71    0.0    N/A      0            0    N/A
object queue header heap          7,276    0.0    N/A      0        7,237    0.0
object queue header oper      1,520,984    0.0    0.0      1            0    N/A
object stats modificatio            360    1.1    0.0      0            0    N/A
parallel query alloc buf            472    0.0    N/A      0            0    N/A
parameter list                      643    0.0    N/A      0            0    N/A
parameter table allocati            240    0.0    N/A      0            0    N/A
post/wait queue                   9,658    0.1    0.0      0        3,466    0.0
process allocation                  235    0.0    N/A      0          118    0.0
process group creation              235    0.0    N/A      0            0    N/A
qmn task queue latch                512    0.0    N/A      0            0    N/A
redo allocation                  25,223    0.1    0.0      0    4,972,609    0.0
redo copy                             0    N/A    N/A      0    4,972,708    0.0
redo writing                     46,698    0.0    0.0      0            0    N/A
resmgr group change latc            533    0.0    N/A      0            0    N/A
resmgr:actses active lis            950    0.0    N/A      0            0    N/A
resmgr:actses change gro            142    0.0    N/A      0            0    N/A
resmgr:free threads list            353    0.0    N/A      0            0    N/A
resmgr:schema config                597    0.0    N/A      0            0    N/A
row cache objects               231,601    0.0    0.0      0          448    0.0
rules engine aggregate s             17    0.0    N/A      0            0    N/A
rules engine rule set st            134    0.0    N/A      0            0    N/A
sequence cache                    4,464    0.0    N/A      0            0    N/A
session allocation               42,421    0.0    N/A      0            0    N/A
session idle bit              1,127,557    0.0    0.0      0            0    N/A
session state list latch            494    0.0    N/A      0            0    N/A
session switching                    71    0.0    N/A      0            0    N/A
session timer                     1,272    0.0    N/A      0            0    N/A
shared pool                      26,428    0.0    0.4      0            0    N/A
simulator hash latch          2,137,589    0.0    N/A      0            0    N/A
simulator lru latch           2,051,579    0.0    0.0      0       46,222    0.1
slave class                           2    0.0    N/A      0            0    N/A
slave class create                    8    0.0    N/A      0            0    N/A
sort extent pool                  4,406    0.1    0.0      0            0    N/A
state object free list                2    0.0    N/A      0            0    N/A
statistics aggregation              140    0.0    N/A      0            0    N/A
temp lob duration state               2    0.0    N/A      0            0    N/A
threshold alerts latch              305    0.0    N/A      0            0    N/A
transaction allocation          875,726    0.0    N/A      0            0    N/A
transaction branch alloc          2,031    0.0    N/A      0            0    N/A
undo global data                804,587    0.0    0.0      0            0    N/A
user lock                           444    0.0    N/A      0            0    N/A
          -------------------------------------------------------------

Latch Sleep Breakdown                    DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by misses desc

Latch Name
----------------------------------------
  Get Requests      Misses      Sleeps  Spin Gets   Sleep1   Sleep2   Sleep3
-------------- ----------- ----------- ---------- -------- -------- --------
cache buffers chains
    66,867,303       1,726           4      1,722        0        0        0
cache buffers lru chain
     1,026,321       1,124          10      1,114        0        0        0
simulator lru latch
     2,051,579         537           2        535        0        0        0
library cache
     1,239,482         149           4        145        0        0        0
object queue header operation
     1,520,984         123           2        121        0        0        0
library cache pin
     1,158,486          33           1         32        0        0        0
redo allocation
        25,223          33           1         32        0        0        0
In memory undo latch
        30,230           7           5          2        0        0        0
shared pool
        26,428           5           2          3        0        0        0
          -------------------------------------------------------------

Latch Miss Sources                       DB/Inst: CDB10/cdb10  Snaps: 122-123
-> only latches with sleeps are shown
-> ordered by name, sleeps desc

                                                     NoWait              Waiter
Latch Name               Where                       Misses     Sleeps   Sleeps
------------------------ -------------------------- ------- ---------- --------
In memory undo latch     ktiFlush: child                  0          5        4
cache buffers chains     kcbgtcr: kslbegin excl           0          4        0
cache buffers chains     kcbgtcr: fast path               0          2        1
cache buffers chains     kcbchg: kslbegin: call CR        0          1        1
cache buffers chains     kcbgtcr: kslbegin shared         0          1        0
cache buffers lru chain  kcbzgws_1                        0          6        9
cache buffers lru chain  kcbzar: KSLNBEGIN                0          2        0
cache buffers lru chain  kcbbic2                          0          1        1
cache buffers lru chain  kcbbwlru                         0          1        0
library cache            kglhdiv: child                   0          1        0
library cache lock       kgllkdl: child: no lock ha       0          2        0
library cache pin        kglpndl                          0          1        1
object queue header oper kcbo_switch_cq                   0          1        1
object queue header oper kcbw_link_q                      0          1        0
redo allocation          kcrfw_redo_gen: redo alloc       0          1        0
shared pool              kghalp                           0          1        0
shared pool              kghfrunp: clatch: nowait         0          1        0
shared pool              kghupr1                          0          1        0
simulator lru latch      kcbs_simulate: simulate se       0          2        1
          -------------------------------------------------------------

Parent Latch Statistics                  DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Child Latch Statistics                    DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Segments by Logical Reads                DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Logical Reads:      30,077,723
-> Captured Segments account for   88.6% of Total

           Tablespace                      Subobject  Obj.       Logical
Owner         Name    Object Name            Name     Type         Reads  %Total
---------- ---------- -------------------- ---------- ----- ------------ -------
STARGUS    TEMP       PK_TMP_TOP_SLOW_CM              INDEX    5,264,912   17.50
STARGUS    TEMP       TMP_TOP_SLOW_CM                 TABLE    5,244,192   17.44
STARGUS    TS_STARGUS PK_CM_RAWDATA                   INDEX    2,271,232    7.55
STARGUS    TS_STARGUS CM_RAWDATA                      TABLE    1,899,472    6.32
STARGUS    TS_STARGUS CM_SID_RAWDATA                  TABLE    1,440,752    4.79
          -------------------------------------------------------------

Segments by Physical Reads                DB/Inst: CDB10/cdb10  Snaps: 122-123
-> Total Physical Reads:         401,992
-> Captured Segments account for    67.7% of Total

           Tablespace                      Subobject  Obj.      Physical
Owner         Name    Object Name            Name     Type         Reads  %Total
---------- ---------- -------------------- ---------- ----- ------------ -------
STARGUS    TS_STARGUS PK_CM_SID_RAWDATA               INDEX       42,629   10.60
STARGUS    TEMP       TMP_TOP_SLOW_CM                 TABLE       38,818    9.66
STARGUS    TS_STARGUS CM_SID_RAWDATA                  TABLE       38,588    9.60
STARGUS    TEMP       PK_TMP_TOP_SLOW_CM              INDEX       31,020    7.72
STARGUS    TS_STARGUS TOPOLOGY_LINK                   TABLE       30,360    7.55
          -------------------------------------------------------------

Segments by Row Lock Waits               DB/Inst: CDB10/cdb10  Snaps: 122-123
-> % of Capture shows % of row lock waits for each top segment compared
-> with total row lock waits for all segments captured by the Snapshot

                                                                     Row
           Tablespace                      Subobject  Obj.          Lock    % of
Owner         Name    Object Name            Name     Type         Waits Capture
---------- ---------- -------------------- ---------- ----- ------------ -------
SYS        SYSTEM     SMON_SCN_TIME                   TABLE            4   30.77
SYSMAN     SYSAUX     MGMT_METRICS_1HOUR_P            INDEX            2   15.38
PERFSTAT   PERFSTAT   STATS$EVENT_HISTOGRA            INDEX            2   15.38
PERFSTAT   PERFSTAT   STATS$LATCH_PK                  INDEX            2   15.38
SYS        SYSAUX     WRH$_SERVICE_STAT_PK 559071_106 INDEX            2   15.38
          -------------------------------------------------------------

Segments by ITL Waits                     DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Segments by Buffer Busy Waits             DB/Inst: CDB10/cdb10  Snaps: 122-123
-> % of Capture shows % of Buffer Busy Waits for each top segment compared
-> with total Buffer Busy Waits for all segments captured by the Snapshot

                                                                  Buffer
           Tablespace                      Subobject  Obj.          Busy    % of
Owner         Name    Object Name            Name     Type         Waits Capture
---------- ---------- -------------------- ---------- ----- ------------ -------
SYS        SYSTEM     JOB$                            TABLE            2   66.67
SYSMAN     SYSAUX     MGMT_CURRENT_METRICS            INDEX            1   33.33
          -------------------------------------------------------------

Dictionary Cache Stats                   DB/Inst: CDB10/cdb10  Snaps: 122-123
-> "Pct Misses"  should be very low (< 2% in most cases)
-> "Final Usage" is the number of cache entries being used

                                   Get    Pct    Scan   Pct      Mod      Final
Cache                         Requests   Miss    Reqs  Miss     Reqs      Usage
------------------------- ------------ ------ ------- ----- -------- ----------
dc_awr_control                      67    0.0       0   N/A        2          1
dc_database_links                   72    0.0       0   N/A        0          1
dc_files                            70    0.0       0   N/A        0          7
dc_global_oids                   4,852    0.0       0   N/A        0         16
dc_histogram_data                3,190    0.9       0   N/A        0      1,064
dc_histogram_defs                6,187    0.7       0   N/A        0      1,592
dc_object_ids                    7,737    0.9       0   N/A        1        480
dc_objects                       1,345    1.9       0   N/A       56        437
dc_profiles                        163    0.0       0   N/A        0          2
dc_rollback_segments               677    0.0       0   N/A        0         22
dc_segments                      1,839    0.5       0   N/A      411        264
dc_sequences                        75    0.0       0   N/A       75          6
dc_tablespace_quotas               890    0.1       0   N/A        0          5
dc_tablespaces                  26,615    0.0       0   N/A        0          8
dc_usernames                       257    0.4       0   N/A        0          9
dc_users                        25,512    0.0       0   N/A        0         44
outstanding_alerts                 126    7.1       0   N/A       17         17
          -------------------------------------------------------------

Library Cache Activity                    DB/Inst: CDB10/cdb10  Snaps: 122-123
-> "Pct Misses"  should be very low

                         Get    Pct            Pin    Pct             Invali-
Namespace           Requests   Miss       Requests   Miss    Reloads  dations
--------------- ------------ ------ -------------- ------ ---------- --------
BODY                     550    0.0          6,440    0.0          0        0
CLUSTER                    1    0.0              4    0.0          0        0
INDEX                     41    0.0             86    0.0          0        0
SQL AREA                  64   71.9        548,251    0.1        194      177
TABLE/PROCEDURE          389    3.9         13,583    0.3         16        0
TRIGGER                   34   11.8            520    0.8          0        0
          -------------------------------------------------------------

Process Memory Summary                   DB/Inst: CDB10/cdb10  Snaps: 122-123
-> B: Begin snap   E: End snap
-> All rows below contain absolute values (i.e. not diffed over the interval)
-> Max Alloc is Maximum PGA Allocation size at snapshot time
-> Hist Max Alloc is the Historical Max Allocation for still-connected processes
-> ordered by Begin/End snapshot, Alloc (MB) desc

                                                            Hist
                                    Avg  Std Dev     Max     Max
               Alloc      Used    Alloc    Alloc   Alloc   Alloc    Num    Num
  Category      (MB)      (MB)     (MB)     (MB)    (MB)    (MB)   Proc  Alloc
- -------- --------- --------- -------- -------- ------- ------- ------ ------
B Other         71.7       N/A      1.9      3.6      22      22     38     38
  SQL           39.2      38.0      1.4      6.9      37      46     29     25
  Freeable      29.8        .0      1.1      1.5       9     N/A     26     26
  PL/SQL          .9        .5       .0       .0       0       0     36     36
E Other         74.2       N/A      1.9      3.6      22      22     39     39
  SQL           40.2      38.9      1.3      6.7      37      46     30     26
  Freeable      29.5        .0      1.1      1.5       9     N/A     26     26
  PL/SQL         1.0        .6       .0       .0       0       0     37     37
          -------------------------------------------------------------

SGA Memory Summary                        DB/Inst: CDB10/cdb10  Snaps: 122-123

                                                      End Size (Bytes)
SGA regions                     Begin Size (Bytes)      (if different)
------------------------------ ------------------- -------------------
Database Buffers                        29,360,128
Fixed Size                               1,979,488
Redo Buffers                             6,406,144
Variable Size                          423,627,680
                               -------------------
sum                                    461,373,440
          -------------------------------------------------------------

SGA breakdown difference                  DB/Inst: CDB10/cdb10  Snaps: 122-123
-> ordered by Pool, Name
-> N/A value for Begin MB or End MB indicates the size of that Pool/Name was
   insignificant, or zero in that snapshot

Pool   Name                                 Begin MB         End MB  % Diff
------ ------------------------------ -------------- -------------- -------
java   free memory                              24.0           24.0    0.00
shared ASH buffers                               4.0            4.0    0.00
shared CCursor                                   6.5            6.5   -0.11
shared FileOpenBlock                             1.4            1.4    0.00
shared Heap0: KGL                                3.8            3.7   -0.62
shared KCB Table Scan Buffer                     3.8            3.8    0.00
shared KGLS heap                                 1.6            1.5   -6.07
shared KQR M PO                                  1.5            1.3   -9.15
shared KSFD SGA I/O b                            3.8            3.8    0.00
shared PCursor                                   5.2            5.3    0.20
shared PL/SQL MPCODE                             3.4            3.4    0.00
shared event statistics per sess                 1.5            1.5    0.00
shared free memory                              10.4           10.4    0.39
shared kglsim hash table bkts                    4.0            4.0    0.00
shared kglsim heap                               1.3            1.4    1.72
shared kglsim object batch                       2.1            2.1    1.04
shared kks stbkt                                 1.5            1.5    0.00
shared library cache                             9.5            9.6    0.57
shared private strands                           2.3            2.3    0.00
shared row cache                                 7.1            7.1    0.00
shared sql area                                 27.2           27.4    0.89
       buffer_cache                             28.0           28.0    0.00
       fixed_sga                                 1.9            1.9    0.00
       log_buffer                                6.1            6.1    0.00
          -------------------------------------------------------------

Streams CPU/IO Usage                     DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Streams Capture                           DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Streams Apply                             DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Buffered Queues                           DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Buffered Subscribers                      DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Rule Set                                  DB/Inst: CDB10/cdb10  Snaps: 122-123

                  No data exists for this section of the report.
          -------------------------------------------------------------

Resource Limit Stats                          DB/Inst: CDB10/cdb10  Snap: 123

                  No data exists for this section of the report.
          -------------------------------------------------------------

init.ora Parameters                      DB/Inst: CDB10/cdb10  Snaps: 122-123

                                                                End value
Parameter Name                Begin value                       (if different)
----------------------------- --------------------------------- --------------
audit_file_dest               /export/home/oracle10/admin/cdb10
background_dump_dest          /export/home/oracle10/admin/cdb10
compatible                    10.2.0.1.0
control_files                 /export/home/oracle10/oradata/cdb
core_dump_dest                /export/home/oracle10/admin/cdb10
db_block_size                 8192
db_cache_size                 29360128
db_domain
db_file_multiblock_read_count 8
db_name                       cdb10
db_recovery_file_dest         /export/home/oracle10/flash_recov
db_recovery_file_dest_size    2147483648
dispatchers                   (PROTOCOL=TCP) (SERVICE=cdb10XDB)
job_queue_processes           10
open_cursors                  300
pga_aggregate_target          209715200
processes                     150
remote_login_passwordfile     EXCLUSIVE
sga_max_size                  461373440
sga_target                    0
shared_pool_size              134217728
undo_management               AUTO
undo_tablespace               UNDOTBS1
user_dump_dest                /export/home/oracle10/admin/cdb10
          -------------------------------------------------------------

End of Report
}}}
{{{

WORKLOAD REPOSITORY report for

DB Name         DB Id    Instance     Inst Num Release     RAC Host
------------ ----------- ------------ -------- ----------- --- ------------
IVRS          2607950532 ivrs                1 10.2.0.3.0  NO  dbrocaix01.b

              Snap Id      Snap Time      Sessions Curs/Sess
            --------- ------------------- -------- ---------
Begin Snap:       338 17-Jan-10 06:50:58        31       2.9
  End Snap:       339 17-Jan-10 07:01:01        30       2.2
   Elapsed:               10.05 (mins)
   DB Time:               22.08 (mins)

Cache Sizes
~~~~~~~~~~~                       Begin        End
                             ---------- ----------
               Buffer Cache:       200M       196M  Std Block Size:         8K
           Shared Pool Size:        92M        96M      Log Buffer:     2,860K

Load Profile
~~~~~~~~~~~~                            Per Second       Per Transaction
                                   ---------------       ---------------
                  Redo size:             25,946.47              6,162.81
              Logical reads:             10,033.03              2,383.05
              Block changes:                147.02                 34.92
             Physical reads:              9,390.59              2,230.46
            Physical writes:                 41.20                  9.79
                 User calls:                 19.14                  4.55
                     Parses:                  9.87                  2.34
                Hard parses:                  0.69                  0.16
                      Sorts:                  3.05                  0.72
                     Logons:                  0.52                  0.12
                   Executes:                 95.91                 22.78
               Transactions:                  4.21

  % Blocks changed per Read:    1.47    Recursive Call %:    90.93
 Rollback per transaction %:    0.51       Rows per Sort: ########

Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Buffer Nowait %:  100.00       Redo NoWait %:   99.99
            Buffer  Hit   %:  102.59    In-memory Sort %:  100.00
            Library Hit   %:   97.85        Soft Parse %:   93.01
         Execute to Parse %:   89.71         Latch Hit %:  100.00
Parse CPU to Parse Elapsd %:   19.56     % Non-Parse CPU:   98.43

 Shared Pool Statistics        Begin    End
                              ------  ------
             Memory Usage %:   75.99   78.27
    % SQL with executions>1:   68.86   64.10
  % Memory for SQL w/exec>1:   65.95   58.03

Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
CPU time                                            436          32.9
db file sequential read              18,506         279     15   21.1   User I/O
PX Deq Credit: send blkd             79,918         177      2   13.4      Other
direct path read                    374,300         149      0   11.2   User I/O
log file parallel write               2,299          83     36    6.2 System I/O
          -------------------------------------------------------------
Time Model Statistics                      DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total time in database user-calls (DB Time): 1324.6s
-> Statistics including the word "background" measure background process
   time, and so do not contribute to the DB time statistic
-> Ordered by % or DB time desc, Statistic name

Statistic Name                                       Time (s) % of DB Time
------------------------------------------ ------------------ ------------
sql execute elapsed time                              1,272.2         96.0
DB CPU                                                  435.7         32.9
parse time elapsed                                       52.3          3.9
hard parse elapsed time                                  42.5          3.2
Java execution elapsed time                               4.0           .3
PL/SQL execution elapsed time                             3.3           .2
PL/SQL compilation elapsed time                           0.3           .0
connection management call elapsed time                   0.1           .0
sequence load elapsed time                                0.1           .0
hard parse (sharing criteria) elapsed time                0.1           .0
repeated bind elapsed time                                0.1           .0
hard parse (bind mismatch) elapsed time                   0.0           .0
DB time                                               1,324.6          N/A
background elapsed time                                 314.3          N/A
background cpu time                                      11.6          N/A
          -------------------------------------------------------------

Wait Class                                  DB/Inst: IVRS/ivrs  Snaps: 338-339
-> s  - second
-> cs - centisecond -     100th of a second
-> ms - millisecond -    1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc

                                                                  Avg
                                       %Time       Total Wait    wait     Waits
Wait Class                      Waits  -outs         Time (s)    (ms)      /txn
-------------------- ---------------- ------ ---------------- ------- ---------
User I/O                      396,180     .0              488       1     156.0
Other                          88,652    5.2              259       3      34.9
System I/O                      4,903     .0              243      50       1.9
Commit                          1,418    1.3               67      48       0.6
Concurrency                        29   20.7                2      60       0.0
Configuration                       1     .0                0     247       0.0
Network                         8,410     .0                0       0       3.3
Application                        36     .0                0       0       0.0
          -------------------------------------------------------------

Wait Events                                DB/Inst: IVRS/ivrs  Snaps: 338-339
-> s  - second
-> cs - centisecond -     100th of a second
-> ms - millisecond -    1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc (idle events last)

                                                                   Avg
                                             %Time  Total Wait    wait     Waits
Event                                 Waits  -outs    Time (s)    (ms)      /txn
---------------------------- -------------- ------ ----------- ------- ---------
db file sequential read              18,506     .0         279      15       7.3
PX Deq Credit: send blkd             79,918     .0         177       2      31.5
direct path read                    374,300     .0         149       0     147.4
log file parallel write               2,299     .0          83      36       0.9
db file parallel write                  658     .0          79     120       0.3
PX qref latch                         6,958   64.7          79      11       2.7
log file sync                         1,418    1.3          67      48       0.6
buffer read retry                        54   81.5          43     797       0.0
control file parallel write             259     .0          42     163       0.1
log file sequential read                 54     .0          27     507       0.0
control file sequential read          1,577     .0          11       7       0.6
db file scattered read                  236     .0           9      36       0.1
direct path write temp                1,533     .0           7       4       0.6
direct path read temp                 1,533     .0           2       1       0.6
os thread startup                         5   20.0           2     321       0.0
PX Deq: Signal ACK                      182   26.4           1       8       0.1
change tracking file synchro             11     .0           1     105       0.0
Log archive I/O                          54     .0           1      17       0.0
log file switch completion                1     .0           0     247       0.0
PX Deq: Table Q qref                  1,422     .0           0       0       0.6
enq: PS - contention                     51     .0           0       3       0.0
SQL*Net more data from clien             12     .0           0      12       0.0
PX Deq: Table Q Get Keys                 40     .0           0       3       0.0
latch: library cache                      9     .0           0       9       0.0
SQL*Net message to client             8,291     .0           0       0       3.3
latch free                                7     .0           0       9       0.0
cursor: pin S wait on X                  10   50.0           0       5       0.0
latch: cache buffers lru cha             25     .0           0       2       0.0
latch: session allocation                 7     .0           0       5       0.0
log file single write                     2     .0           0       9       0.0
direct path write                        15     .0           0       1       0.0
latch: shared pool                        2     .0           0       6       0.0
latch: redo allocation                    1     .0           0      10       0.0
read by other session                     3     .0           0       3       0.0
SQL*Net break/reset to clien             36     .0           0       0       0.0
SQL*Net more data to client             107     .0           0       0       0.0
latch: object queue header o              3     .0           0       1       0.0
change tracking file synchro             12     .0           0       0       0.0
LGWR wait for redo copy                  14     .0           0       0       0.0
latch: cache buffers chains               3     .0           0       0       0.0
enq: BF - allocation content              1     .0           0       0       0.0
PX Idle Wait                          1,398   79.0       2,234    1598       0.6
class slave wait                         28   21.4       1,114   39769       0.0
PX Deq: Table Q Normal              348,049     .0         682       2     137.1
jobq slave wait                         232   94.8         670    2890       0.1
ASM background timer                    148     .0         583    3937       0.1
Streams AQ: qmn coordinator              43   51.2         577   13430       0.0
Streams AQ: qmn slave idle w             21     .0         577   27498       0.0
PX Deq: Execution Msg                 7,434    2.5         573      77       2.9
SQL*Net message from client           8,291     .0         568      68       3.3
virtual circuit status                   19  100.0         557   29296       0.0
PX Deq: Execute Reply                 5,871    1.1         508      86       2.3
PX Deq Credit: need buffer           62,922     .0          48       1      24.8
PX Deq: Table Q Sample                1,307     .0           5       4       0.5
KSV master wait                          22     .0           0      22       0.0
PX Deq: Parse Reply                     201     .0           0       1       0.1
PX Deq: Msg Fragment                    234     .0           0       1       0.1
PX Deq: Join ACK                        170     .0           0       1       0.1
SGA: MMAN sleep for componen             16   43.8           0      12       0.0
          -------------------------------------------------------------

Background Wait Events                     DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by wait time desc, waits desc (idle events last)

                                                                   Avg
                                             %Time  Total Wait    wait     Waits
Event                                 Waits  -outs    Time (s)    (ms)      /txn
---------------------------- -------------- ------ ----------- ------- ---------
log file parallel write               2,299     .0          82      36       0.9
db file parallel write                  654     .0          78     119       0.3
control file parallel write             259     .0          42     163       0.1
log file sequential read                 54     .0          27     507       0.0
control file sequential read            399     .0          11      26       0.2
os thread startup                         5   20.0           2     321       0.0
Log archive I/O                          54     .0           1      17       0.0
events in waitclass Other                38     .0           1      16       0.0
log file single write                     2     .0           0       9       0.0
direct path write                        13     .0           0       1       0.0
latch: shared pool                        1     .0           0      10       0.0
direct path read                         13     .0           0       0       0.0
db file sequential read                 543     .0          -1      -2       0.2
rdbms ipc message                     4,458   50.1       7,496    1681       1.8
smon timer                               39     .0         611   15662       0.0
ASM background timer                    148     .0         583    3937       0.1
pmon timer                              241  100.0         581    2412       0.1
Streams AQ: qmn coordinator              43   51.2         577   13430       0.0
Streams AQ: qmn slave idle w             21     .0         577   27498       0.0
KSV master wait                          22     .0           0      22       0.0
SGA: MMAN sleep for componen             16   43.8           0      12       0.0
          -------------------------------------------------------------

Operating System Statistics                 DB/Inst: IVRS/ivrs  Snaps: 338-339

Statistic                                       Total
-------------------------------- --------------------
BUSY_TIME                                      46,982
IDLE_TIME                                       9,587
IOWAIT_TIME                                     5,623
NICE_TIME                                         172
SYS_TIME                                       37,041
USER_TIME                                       9,589
LOAD                                                4
RSRC_MGR_CPU_WAIT_TIME                              0
PHYSICAL_MEMORY_BYTES                          50,048
NUM_CPUS                                            1
          -------------------------------------------------------------

Service Statistics                         DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by DB Time

                                                             Physical    Logical
Service Name                      DB Time (s)   DB CPU (s)      Reads      Reads
-------------------------------- ------------ ------------ ---------- ----------
ivrs.bayantel.com                     1,329.2        427.1  5,587,106  5,878,962
SYS$USERS                                91.6         13.5      1,357     94,224
SYS$BACKGROUND                            0.0          0.0      1,367     19,062
ivrsXDB                                   0.0          0.0          0          0
          -------------------------------------------------------------

Service Wait Class Stats                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Wait Class info for services in the Service Statistics section.
-> Total Waits and Time Waited displayed for the following wait
   classes:  User I/O, Concurrency, Administrative, Network
-> Time Waited (Wt Time) in centisecond (100th of a second)

Service Name
----------------------------------------------------------------
 User I/O  User I/O  Concurcy  Concurcy     Admin     Admin   Network   Network
Total Wts   Wt Time Total Wts   Wt Time Total Wts   Wt Time Total Wts   Wt Time
--------- --------- --------- --------- --------- --------- --------- ---------
ivrs.bayantel.com
   394179     34576        16         6         0         0      8358         6
SYS$USERS
     1120      3538         2         1         0         0        42        14
SYS$BACKGROUND
     1310     10821         6       162         0         0         0         0
          -------------------------------------------------------------

SQL ordered by Elapsed Time                DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------
        90         28            1       89.6     6.8 bsdgaykhvy4xr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

        89         28            2       44.5     6.7 bmfc2a2ym0kwr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

        59          6            1       58.5     4.4 081am6psuh26j
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_part
key = l_partkey and p_brand = 'Brand#35' and p_container = 'LG BOX' and l_quanti
ty < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey)

        57         22            1       56.9     4.3 6mrh6s1s5g851
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

        50          6            1       50.2     3.8 acgpfd4ysyfxb
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'puff%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem w
here l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '1

        49         21            1       49.2     3.7 2n4xg8c3dmd62
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

        46         15            1       45.7     3.4 29rqwcj4cs31u
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 313) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

        40          1            1       40.1     3.0 d92h3rjp0y217
begin prvt_hdm.auto_execute( :db_id, :inst_id, :end_snap ); end;

        34         14            1       34.1     2.6 cvhgz2zwbk4qf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        31         14            1       30.8     2.3 7409gxv4spfj2
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SQL ordered by Elapsed Time                DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        29         14            1       29.3     2.2 1f0r8shtps3bu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

        26         14            1       25.9     2.0 05jp96tzvutb6
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        26          8            1       25.5     1.9 6aqpwwba8xvuu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'GERMANY' then volume else 0 end) / sum(vo
lume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_ext
endedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier
, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_p

        24         11            1       23.7     1.8 8sfhj7ua3qfjf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 312) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

        23         11            2       11.6     1.8 814qvp0rkqug4
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 314) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

        23          7            1       23.2     1.8 94wqqbu0ajcvn
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'JAPAN' then volume else 0 end) / sum(volu
me) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_exten
dedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier,
lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_par

        23          7            1       23.2     1.8 5xd0ak4417rk0
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'MOZAMBIQUE' then volume else 0 end) / sum
(volume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_
extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, suppl
ier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey =

        22          2          539        0.0     1.7 aw9ttz9acxbc3
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN payment(:p_w_id,:p_d_id,:p_c_w_id,:p_c_d_id,:p_c_id,:byname,:p_h_amount,:p
_c_last,:p_w_street_1,:p_w_street_2,:p_w_city,:p_w_state,:p_w_zip,:p_d_street_1,
:p_d_street_2,:p_d_city,:p_d_state,:p_d_zip,:p_c_first,:p_c_middle,:p_c_street_1
,:p_c_street_2,:p_c_city,:p_c_state,:p_c_zip,:p_c_phone,:p_c_since,:p_c_credit,:
SQL ordered by Elapsed Time                DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------

        21          4            2       10.6     1.6 2x4gjqru5u1xx
Module: SQL*Plus
SELECT s0.snap_id id, -- TO_CHAR(s0.END_INTERVAL_TIME,'YY/MM/DD HH24:MI') tm,
 round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440
 + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END
_INTERVAL_TIME) * 60 + EXTRACT(MINUTE FROM s1.

        21          4          546        0.0     1.6 16dhat4ta7xs9
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
begin neword(:no_w_id,:no_max_w_id,:no_d_id,:no_c_id,:no_o_ol_cnt,:no_c_discount
,:no_c_last,:no_c_credit,:no_d_tax,:no_w_tax,:no_d_next_o_id,TO_DATE(:timestamp,
'YYYYMMDDHH24MISS')); END;

        21          0            1       20.9     1.6 14wnf35dahb7v
SELECT A.ID,A.TYPE FROM SYS.WRI$_ADV_DEFINITIONS A WHERE A.NAME = :B1

        17          0           42        0.4     1.3 d4ujh5yqt1fph
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN delivery(:d_w_id,:d_o_carrier_id,TO_DATE(:timestamp,'YYYYMMDDHH24MISS'));
END;

        16          2            1       16.5     1.2 1wzqub25cwnjm
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN wksys.wk_job.invoke(21,21); :mydate := next_date; IF broken THEN
:b := 1; ELSE :b := 0; END IF; END;

        16          0          420        0.0     1.2 5ps73nuy5f2vj
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
UPDATE ORDER_LINE SET OL_DELIVERY_D = :B4 WHERE OL_O_ID = :B3 AND OL_D_ID = :B2
AND OL_W_ID = :B1

        15          1          317        0.0     1.1 4wg725nwpxb1z
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SELECT C_FIRST, C_MIDDLE, C_ID, C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP,
C_PHONE, C_CREDIT, C_CREDIT_LIM, C_DISCOUNT, C_BALANCE, C_SINCE FROM CUSTOMER WH
ERE C_W_ID = :B3 AND C_D_ID = :B2 AND C_LAST = :B1 ORDER BY C_FIRST

        15          6            1       14.5     1.1 fcfjqugcc1zy0
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_count, count(*) as custdist from ( select c_custkey, count(o_orderkey)
as c_count from customer left outer join orders on c_custkey = o_custkey and o_c
omment not like '%express%requests%' group by c_custkey) c_orders group by c_cou
nt order by custdist desc, c_count desc

        14          2            9        1.6     1.1 6gvch1xu9ca3g
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); :mydate := next_date
; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;

        14          7            1       13.9     1.0 15dxu5nmuj14a
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1994-08-01' and o_orderdate < date '1994-08-01' + interval '3' month and
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

        14          2        5,442        0.0     1.0 8yvup05pk06ca
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SELECT S_QUANTITY, S_DATA, S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05
SQL ordered by Elapsed Time                DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

  Elapsed      CPU                  Elap per  % Total
  Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
---------- ---------- ------------ ---------- ------- -------------
, S_DIST_06, S_DIST_07, S_DIST_08, S_DIST_09, S_DIST_10 FROM STOCK WHERE S_I_ID
= :B2 AND S_W_ID = :B1

          -------------------------------------------------------------

SQL ordered by CPU Time                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
        28         89            2       14.17     6.7 bmfc2a2ym0kwr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

        28         90            1       28.03     6.8 bsdgaykhvy4xr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

        22         57            1       21.81     4.3 6mrh6s1s5g851
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

        21         49            1       20.85     3.7 2n4xg8c3dmd62
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

        15         46            1       14.85     3.4 29rqwcj4cs31u
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 313) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

        14         34            1       14.34     2.6 cvhgz2zwbk4qf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        14         31            1       14.08     2.3 7409gxv4spfj2
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        14         26            1       13.69     2.0 05jp96tzvutb6
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        14         29            1       13.58     2.2 1f0r8shtps3bu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
SQL ordered by CPU Time                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

        11         24            1       11.47     1.8 8sfhj7ua3qfjf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 312) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

        11         23            2        5.66     1.8 814qvp0rkqug4
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 314) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

         8         26            1        8.14     1.9 6aqpwwba8xvuu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'GERMANY' then volume else 0 end) / sum(vo
lume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_ext
endedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier
, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_p

         7         23            1        6.89     1.8 5xd0ak4417rk0
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'MOZAMBIQUE' then volume else 0 end) / sum
(volume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_
extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, suppl
ier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey =

         7         23            1        6.76     1.8 94wqqbu0ajcvn
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'JAPAN' then volume else 0 end) / sum(volu
me) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_exten
dedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier,
lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_par

         7         14            1        6.63     1.0 15dxu5nmuj14a
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1994-08-01' and o_orderdate < date '1994-08-01' + interval '3' month and
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

         6         15            1        6.36     1.1 fcfjqugcc1zy0
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_count, count(*) as custdist from ( select c_custkey, count(o_orderkey)
as c_count from customer left outer join orders on c_custkey = o_custkey and o_c
omment not like '%express%requests%' group by c_custkey) c_orders group by c_cou
nt order by custdist desc, c_count desc

         6         50            1        6.02     3.8 acgpfd4ysyfxb
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'puff%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem w
here l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '1

         6         59            1        5.87     4.4 081am6psuh26j
SQL ordered by CPU Time                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_part
key = l_partkey and p_brand = 'Brand#35' and p_container = 'LG BOX' and l_quanti
ty < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey)

         4         21            2        2.15     1.6 2x4gjqru5u1xx
Module: SQL*Plus
SELECT s0.snap_id id, -- TO_CHAR(s0.END_INTERVAL_TIME,'YY/MM/DD HH24:MI') tm,
 round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440
 + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END
_INTERVAL_TIME) * 60 + EXTRACT(MINUTE FROM s1.

         4         21          546        0.01     1.6 16dhat4ta7xs9
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
begin neword(:no_w_id,:no_max_w_id,:no_d_id,:no_c_id,:no_o_ol_cnt,:no_c_discount
,:no_c_last,:no_c_credit,:no_d_tax,:no_w_tax,:no_d_next_o_id,TO_DATE(:timestamp,
'YYYYMMDDHH24MISS')); END;

         2         14            9        0.27     1.1 6gvch1xu9ca3g
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); :mydate := next_date
; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;

         2         16            1        2.12     1.2 1wzqub25cwnjm
DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN :
= FALSE; BEGIN wksys.wk_job.invoke(21,21); :mydate := next_date; IF broken THEN
:b := 1; ELSE :b := 0; END IF; END;

         2         14        5,442        0.00     1.0 8yvup05pk06ca
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SELECT S_QUANTITY, S_DATA, S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05
, S_DIST_06, S_DIST_07, S_DIST_08, S_DIST_09, S_DIST_10 FROM STOCK WHERE S_I_ID
= :B2 AND S_W_ID = :B1

         2         22          539        0.00     1.7 aw9ttz9acxbc3
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN payment(:p_w_id,:p_d_id,:p_c_w_id,:p_c_d_id,:p_c_id,:byname,:p_h_amount,:p
_c_last,:p_w_street_1,:p_w_street_2,:p_w_city,:p_w_state,:p_w_zip,:p_d_street_1,
:p_d_street_2,:p_d_city,:p_d_state,:p_d_zip,:p_c_first,:p_c_middle,:p_c_street_1
,:p_c_street_2,:p_c_city,:p_c_state,:p_c_zip,:p_c_phone,:p_c_since,:p_c_credit,:

         1         40            1        1.18     3.0 d92h3rjp0y217
begin prvt_hdm.auto_execute( :db_id, :inst_id, :end_snap ); end;

         1         15          317        0.00     1.1 4wg725nwpxb1z
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SELECT C_FIRST, C_MIDDLE, C_ID, C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP,
C_PHONE, C_CREDIT, C_CREDIT_LIM, C_DISCOUNT, C_BALANCE, C_SINCE FROM CUSTOMER WH
ERE C_W_ID = :B3 AND C_D_ID = :B2 AND C_LAST = :B1 ORDER BY C_FIRST

         0         17           42        0.01     1.3 d4ujh5yqt1fph
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN delivery(:d_w_id,:d_o_carrier_id,TO_DATE(:timestamp,'YYYYMMDDHH24MISS'));
END;

         0         16          420        0.00     1.2 5ps73nuy5f2vj
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
UPDATE ORDER_LINE SET OL_DELIVERY_D = :B4 WHERE OL_O_ID = :B3 AND OL_D_ID = :B2
AND OL_W_ID = :B1

SQL ordered by CPU Time                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

    CPU      Elapsed                  CPU per  % Total
  Time (s)   Time (s)  Executions     Exec (s) DB Time    SQL Id
---------- ---------- ------------ ----------- ------- -------------
         0         21            1        0.12     1.6 14wnf35dahb7v
SELECT A.ID,A.TYPE FROM SYS.WRI$_ADV_DEFINITIONS A WHERE A.NAME = :B1

          -------------------------------------------------------------

SQL ordered by Gets                        DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> Total Buffer Gets:       6,050,561
-> Captured SQL account for      72.1% of Total

                                Gets              CPU     Elapsed
  Buffer Gets   Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ------------ ------------ ------ -------- --------- -------------
       331,630            1    331,630.0    5.5    21.81     56.88 6mrh6s1s5g851
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

       331,630            1    331,630.0    5.5    28.03     89.61 bsdgaykhvy4xr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

       331,626            1    331,626.0    5.5    20.85     49.20 2n4xg8c3dmd62
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

       294,409            2    147,204.5    4.9    28.34     89.09 bmfc2a2ym0kwr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

       147,206            1    147,206.0    2.4    13.58     29.35 1f0r8shtps3bu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

       132,996            1    132,996.0    2.2     6.89     23.19 5xd0ak4417rk0
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'MOZAMBIQUE' then volume else 0 end) / sum
(volume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_
extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, suppl
ier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey =

       132,996            1    132,996.0    2.2     8.14     25.54 6aqpwwba8xvuu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'GERMANY' then volume else 0 end) / sum(vo
lume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_ext
endedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier
, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_p

       132,996            1    132,996.0    2.2     6.76     23.21 94wqqbu0ajcvn
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'JAPAN' then volume else 0 end) / sum(volu
me) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_exten
dedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier,
lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_par

       125,774            1    125,774.0    2.1     6.39     12.83 05burzzbuh660
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1993-05-01' and o_orderdate < date '1993-05-01' + interval '3' month and
SQL ordered by Gets                        DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> Total Buffer Gets:       6,050,561
-> Captured SQL account for      72.1% of Total

                                Gets              CPU     Elapsed
  Buffer Gets   Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ------------ ------------ ------ -------- --------- -------------
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

       125,774            1    125,774.0    2.1     6.12     12.15 05pqvq1019n1t
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1996-05-01' and o_orderdate < date '1996-05-01' + interval '3' month and
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

       125,774            1    125,774.0    2.1     6.63     13.86 15dxu5nmuj14a
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1994-08-01' and o_orderdate < date '1994-08-01' + interval '3' month and
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

       125,774            1    125,774.0    2.1     5.85     11.77 2xf48ymvbjhxv
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority
 = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority
 <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_co
unt from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('MAIL

       125,774            1    125,774.0    2.1     5.78     11.67 3yj8qcg6sf32h
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority
 = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority
 <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_co
unt from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('AIR'

       125,774            1    125,774.0    2.1     6.01     12.20 c5dr0bxu3s966
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority
 = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority
 <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_co
unt from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('TRUC

       114,091            1    114,091.0    1.9     6.32     12.80 bdaz68nhm6jm4
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'linen%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem
where l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '

       113,956            1    113,956.0    1.9     6.02     50.23 acgpfd4ysyfxb
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'puff%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem w
here l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '1

       113,849            1    113,849.0    1.9     5.46     10.68 cx10bjzjkg410
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'moccasin%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineit
em where l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= dat

       106,702            1    106,702.0    1.8     5.18      9.82 3v74jf7w31h8v
SQL ordered by Gets                        DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> Total Buffer Gets:       6,050,561
-> Captured SQL account for      72.1% of Total

                                Gets              CPU     Elapsed
  Buffer Gets   Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ------------ ------------ ------ -------- --------- -------------
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_part
key = l_partkey and p_brand = 'Brand#21' and p_container = 'LG DRUM' and l_quant
ity < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey)

       106,702            1    106,702.0    1.8     5.52     10.44 5u88ac3spdu0n
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part whe
re ( p_partkey = l_partkey and p_brand = 'Brand#45' and p_container in ('SM CASE
', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 1 and l_quantity <= 1 + 10 a
nd p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruc

       106,702            1    106,702.0    1.8     5.42     12.66 75d32g70ru6f2
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part whe
re ( p_partkey = l_partkey and p_brand = 'Brand#34' and p_container in ('SM CASE
', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 3 and l_quantity <= 3 + 10 a
nd p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruc

       106,702            1    106,702.0    1.8     5.36     10.16 by11nan0n3nbb
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part whe
re ( p_partkey = l_partkey and p_brand = 'Brand#23' and p_container in ('SM CASE
', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 1 and l_quantity <= 1 + 10 a
nd p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruc

       106,698            1    106,698.0    1.8     5.87     58.52 081am6psuh26j
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_part
key = l_partkey and p_brand = 'Brand#35' and p_container = 'LG BOX' and l_quanti
ty < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey)

       102,798            1    102,798.0    1.7    11.47     23.72 8sfhj7ua3qfjf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 312) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

       102,774            1    102,774.0    1.7    14.85     45.70 29rqwcj4cs31u
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 313) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

       102,763            2     51,381.5    1.7    11.32     23.29 814qvp0rkqug4
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 314) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

       102,697            1    102,697.0    1.7    13.69     25.90 05jp96tzvutb6
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

SQL ordered by Gets                        DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Resources reported for PL/SQL code includes the resources used by all SQL
   statements called by the code.
-> Total Buffer Gets:       6,050,561
-> Captured SQL account for      72.1% of Total

                                Gets              CPU     Elapsed
  Buffer Gets   Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ------------ ------------ ------ -------- --------- -------------
       102,697            1    102,697.0    1.7    14.08     30.77 7409gxv4spfj2
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

       102,697            1    102,697.0    1.7    14.34     34.07 cvhgz2zwbk4qf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        88,530          546        162.1    1.5     4.02     20.99 16dhat4ta7xs9
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
begin neword(:no_w_id,:no_max_w_id,:no_d_id,:no_c_id,:no_o_ol_cnt,:no_c_discount
,:no_c_last,:no_c_credit,:no_d_tax,:no_w_tax,:no_d_next_o_id,TO_DATE(:timestamp,
'YYYYMMDDHH24MISS')); END;

        80,163            2     40,081.5    1.3     4.30     21.15 2x4gjqru5u1xx
Module: SQL*Plus
SELECT s0.snap_id id, -- TO_CHAR(s0.END_INTERVAL_TIME,'YY/MM/DD HH24:MI') tm,
 round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440
 + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END
_INTERVAL_TIME) * 60 + EXTRACT(MINUTE FROM s1.

        69,716            2     34,858.0    1.2     4.26      8.54 ag9jkv5xuz0dz
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select ps_partkey, sum(ps_supplycost * ps_availqty) as value from partsupp, supp
lier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_na
me = 'EGYPT' group by ps_partkey having sum(ps_supplycost * ps_availqty) > ( sel
ect sum(ps_supplycost * ps_availqty) * 0.0001000000 from partsupp, supplier, nat

          -------------------------------------------------------------

SQL ordered by Reads                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Disk Reads:       5,663,126
-> Captured SQL account for     74.4% of Total

                               Reads              CPU     Elapsed
Physical Reads  Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ----------- ------------- ------ -------- --------- -------------
       330,210           1     330,210.0    5.8    20.85     49.20 2n4xg8c3dmd62
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

       330,210           1     330,210.0    5.8    21.81     56.88 6mrh6s1s5g851
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

       330,210           1     330,210.0    5.8    28.03     89.61 bsdgaykhvy4xr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation wh
ere s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus =
'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l
2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey) and not

       301,265           2     150,632.5    5.3    28.34     89.09 bmfc2a2ym0kwr
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

       151,726           1     151,726.0    2.7    13.58     29.35 1f0r8shtps3bu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select nation, o_year, sum(amount) as sum_profit from ( select n_name as nation,
 extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) -
ps_supplycost * l_quantity as amount from part, supplier, lineitem, partsupp, or
ders, nation where s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partk

       132,179           1     132,179.0    2.3     6.89     23.19 5xd0ak4417rk0
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'MOZAMBIQUE' then volume else 0 end) / sum
(volume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_
extendedprice * (1 - l_discount) as volume, n2.n_name as nation from part, suppl
ier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey =

       132,179           1     132,179.0    2.3     8.14     25.54 6aqpwwba8xvuu
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'GERMANY' then volume else 0 end) / sum(vo
lume) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_ext
endedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier
, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_p

       132,179           1     132,179.0    2.3     6.76     23.21 94wqqbu0ajcvn
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_year, sum(case when nation = 'JAPAN' then volume else 0 end) / sum(volu
me) as mkt_share from ( select extract(year from o_orderdate) as o_year, l_exten
dedprice * (1 - l_discount) as volume, n2.n_name as nation from part, supplier,
lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_par

       125,250           1     125,250.0    2.2     6.39     12.83 05burzzbuh660
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1993-05-01' and o_orderdate < date '1993-05-01' + interval '3' month and
SQL ordered by Reads                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Disk Reads:       5,663,126
-> Captured SQL account for     74.4% of Total

                               Reads              CPU     Elapsed
Physical Reads  Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ----------- ------------- ------ -------- --------- -------------
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

       125,250           1     125,250.0    2.2     6.12     12.15 05pqvq1019n1t
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1996-05-01' and o_orderdate < date '1996-05-01' + interval '3' month and
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

       125,250           1     125,250.0    2.2     6.63     13.86 15dxu5nmuj14a
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select o_orderpriority, count(*) as order_count from orders where o_orderdate >=
 date '1994-08-01' and o_orderdate < date '1994-08-01' + interval '3' month and
exists ( select * from lineitem where l_orderkey = o_orderkey and l_commitdate <
 l_receiptdate) group by o_orderpriority order by o_orderpriority

       125,250           1     125,250.0    2.2     5.85     11.77 2xf48ymvbjhxv
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority
 = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority
 <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_co
unt from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('MAIL

       125,250           1     125,250.0    2.2     5.78     11.67 3yj8qcg6sf32h
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority
 = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority
 <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_co
unt from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('AIR'

       125,250           1     125,250.0    2.2     6.01     12.20 c5dr0bxu3s966
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority
 = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority
 <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_co
unt from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('TRUC

       109,730           1     109,730.0    1.9     6.02     50.23 acgpfd4ysyfxb
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'puff%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem w
here l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '1

       108,262           1     108,262.0    1.9     5.46     10.68 cx10bjzjkg410
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'moccasin%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineit
em where l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= dat

       107,978           1     107,978.0    1.9     6.32     12.80 bdaz68nhm6jm4
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select s_name, s_address from supplier, nation where s_suppkey in ( select ps_su
ppkey from partsupp where ps_partkey in ( select p_partkey from part where p_nam
e like 'linen%') and ps_availqty > ( select 0.5 * sum(l_quantity) from lineitem
where l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '

       106,241           1     106,241.0    1.9     5.87     58.52 081am6psuh26j
SQL ordered by Reads                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Disk Reads:       5,663,126
-> Captured SQL account for     74.4% of Total

                               Reads              CPU     Elapsed
Physical Reads  Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ----------- ------------- ------ -------- --------- -------------
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_part
key = l_partkey and p_brand = 'Brand#35' and p_container = 'LG BOX' and l_quanti
ty < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey)

       106,241           1     106,241.0    1.9     5.18      9.82 3v74jf7w31h8v
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice) / 7.0 as avg_yearly from lineitem, part where p_part
key = l_partkey and p_brand = 'Brand#21' and p_container = 'LG DRUM' and l_quant
ity < ( select 0.2 * avg(l_quantity) from lineitem where l_partkey = p_partkey)

       106,241           1     106,241.0    1.9     5.52     10.44 5u88ac3spdu0n
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part whe
re ( p_partkey = l_partkey and p_brand = 'Brand#45' and p_container in ('SM CASE
', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 1 and l_quantity <= 1 + 10 a
nd p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruc

       106,241           1     106,241.0    1.9     5.42     12.66 75d32g70ru6f2
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part whe
re ( p_partkey = l_partkey and p_brand = 'Brand#34' and p_container in ('SM CASE
', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 3 and l_quantity <= 3 + 10 a
nd p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruc

       106,241           1     106,241.0    1.9     5.36     10.16 by11nan0n3nbb
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part whe
re ( p_partkey = l_partkey and p_brand = 'Brand#23' and p_container in ('SM CASE
', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 1 and l_quantity <= 1 + 10 a
nd p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruc

       103,748           1     103,748.0    1.8    14.85     45.70 29rqwcj4cs31u
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 313) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

       102,436           2      51,218.0    1.8    11.32     23.29 814qvp0rkqug4
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 314) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

       102,430           1     102,430.0    1.8    11.47     23.72 8sfhj7ua3qfjf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
 from customer, orders, lineitem where o_orderkey in ( select l_orderkey from li
neitem group by l_orderkey having sum(l_quantity) > 312) and c_custkey = o_custk
ey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderda

       102,405           1     102,405.0    1.8    13.69     25.90 05jp96tzvutb6
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

SQL ordered by Reads                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Disk Reads:       5,663,126
-> Captured SQL account for     74.4% of Total

                               Reads              CPU     Elapsed
Physical Reads  Executions    per Exec   %Total Time (s)  Time (s)    SQL Id
-------------- ----------- ------------- ------ -------- --------- -------------
       102,405           1     102,405.0    1.8    14.08     30.77 7409gxv4spfj2
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

       102,405           1     102,405.0    1.8    14.34     34.07 cvhgz2zwbk4qf
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select l_returnflag, l_linestatus, sum(l_quantity) as sum_qty, sum(l_extendedpri
ce) as sum_base_price, sum(l_extendedprice * (1 - l_discount)) as sum_disc_price
, sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, avg(l_qua
ntity) as avg_qty, avg(l_extendedprice) as avg_price, avg(l_discount) as avg_dis

        66,900           2      33,450.0    1.2     4.26      8.54 ag9jkv5xuz0dz
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
select ps_partkey, sum(ps_supplycost * ps_availqty) as value from partsupp, supp
lier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_na
me = 'EGYPT' group by ps_partkey having sum(ps_supplycost * ps_availqty) > ( sel
ect sum(ps_supplycost * ps_availqty) * 0.0001000000 from partsupp, supplier, nat

          -------------------------------------------------------------

SQL ordered by Executions                  DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Executions:          57,841
-> Captured SQL account for     18.5% of Total

                                              CPU per    Elap per
 Executions   Rows Processed  Rows per Exec   Exec (s)   Exec (s)     SQL Id
------------ --------------- -------------- ---------- ----------- -------------
       5,442           5,442            1.0       0.00        0.00 8yvup05pk06ca
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SELECT S_QUANTITY, S_DATA, S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05
, S_DIST_06, S_DIST_07, S_DIST_08, S_DIST_09, S_DIST_10 FROM STOCK WHERE S_I_ID
= :B2 AND S_W_ID = :B1

         563             563            1.0       0.00        0.00 3c1kubcdjnppq
update sys.col_usage$ set equality_preds = equality_preds + decode(bitan
d(:flag,1),0,0,1), equijoin_preds = equijoin_preds + decode(bitand(:flag
,2),0,0,1), nonequijoin_preds = nonequijoin_preds + decode(bitand(:flag,4),0,0
,1), range_preds = range_preds + decode(bitand(:flag,8),0,0,1),

         546             546            1.0       0.01        0.04 16dhat4ta7xs9
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
begin neword(:no_w_id,:no_max_w_id,:no_d_id,:no_c_id,:no_o_ol_cnt,:no_c_discount
,:no_c_last,:no_c_credit,:no_d_tax,:no_w_tax,:no_d_next_o_id,TO_DATE(:timestamp,
'YYYYMMDDHH24MISS')); END;

         539             539            1.0       0.00        0.04 aw9ttz9acxbc3
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN payment(:p_w_id,:p_d_id,:p_c_w_id,:p_c_d_id,:p_c_id,:byname,:p_h_amount,:p
_c_last,:p_w_street_1,:p_w_street_2,:p_w_city,:p_w_state,:p_w_zip,:p_d_street_1,
:p_d_street_2,:p_d_city,:p_d_state,:p_d_zip,:p_c_first,:p_c_middle,:p_c_street_1
,:p_c_street_2,:p_c_city,:p_c_state,:p_c_zip,:p_c_phone,:p_c_since,:p_c_credit,:

         420           4,284           10.2       0.00        0.04 5ps73nuy5f2vj
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
UPDATE ORDER_LINE SET OL_DELIVERY_D = :B4 WHERE OL_O_ID = :B3 AND OL_D_ID = :B2
AND OL_W_ID = :B1

         317           2,534            8.0       0.00        0.05 4wg725nwpxb1z
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
SELECT C_FIRST, C_MIDDLE, C_ID, C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP,
C_PHONE, C_CREDIT, C_CREDIT_LIM, C_DISCOUNT, C_BALANCE, C_SINCE FROM CUSTOMER WH
ERE C_W_ID = :B3 AND C_D_ID = :B2 AND C_LAST = :B1 ORDER BY C_FIRST

         268             268            1.0       0.00        0.00 2ym6hhaq30r73
select type#,blocks,extents,minexts,maxexts,extsize,extpct,user#,iniexts,NVL(lis
ts,65535),NVL(groups,65535),cachehint,hwmincr, NVL(spare1,0),NVL(scanhint,0) fro
m seg$ where ts#=:1 and file#=:2 and block#=:3

         224             203            0.9       0.00        0.02 96g93hntrzjtr
select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_
size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, a
vgcln from hist_head$ where obj#=:1 and intcol#=:2

         203               0            0.0       0.00        0.00 b2gnxm5z6r51n
lock table sys.col_usage$ in exclusive mode nowait

         135             135            1.0       0.00        0.00 3m8smr0v7v1m6
INSERT INTO sys.wri$_adv_message_groups (task_id,id,seq,message#,fac,hdr,lm,nl,p
1,p2,p3,p4,p5) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)

          -------------------------------------------------------------

SQL ordered by Parse Calls                 DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Parse Calls:           5,952
-> Captured SQL account for      61.4% of Total

                            % Total
 Parse Calls  Executions     Parses    SQL Id
------------ ------------ --------- -------------
         546          546      9.17 16dhat4ta7xs9
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
begin neword(:no_w_id,:no_max_w_id,:no_d_id,:no_c_id,:no_o_ol_cnt,:no_c_discount
,:no_c_last,:no_c_credit,:no_d_tax,:no_w_tax,:no_d_next_o_id,TO_DATE(:timestamp,
'YYYYMMDDHH24MISS')); END;

         539          539      9.06 aw9ttz9acxbc3
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN payment(:p_w_id,:p_d_id,:p_c_w_id,:p_c_d_id,:p_c_id,:byname,:p_h_amount,:p
_c_last,:p_w_street_1,:p_w_street_2,:p_w_city,:p_w_state,:p_w_zip,:p_d_street_1,
:p_d_street_2,:p_d_city,:p_d_state,:p_d_zip,:p_c_first,:p_c_middle,:p_c_street_1
,:p_c_street_2,:p_c_city,:p_c_state,:p_c_zip,:p_c_phone,:p_c_since,:p_c_credit,:

         268          268      4.50 2ym6hhaq30r73
select type#,blocks,extents,minexts,maxexts,extsize,extpct,user#,iniexts,NVL(lis
ts,65535),NVL(groups,65535),cachehint,hwmincr, NVL(spare1,0),NVL(scanhint,0) fro
m seg$ where ts#=:1 and file#=:2 and block#=:3

         203          563      3.41 3c1kubcdjnppq
update sys.col_usage$ set equality_preds = equality_preds + decode(bitan
d(:flag,1),0,0,1), equijoin_preds = equijoin_preds + decode(bitand(:flag
,2),0,0,1), nonequijoin_preds = nonequijoin_preds + decode(bitand(:flag,4),0,0
,1), range_preds = range_preds + decode(bitand(:flag,8),0,0,1),

         203            0      3.41 53btfq0dt9bs9
insert into sys.col_usage$ values ( :objn, :coln, decode(bitand(:flag,1),0,0
,1), decode(bitand(:flag,2),0,0,1), decode(bitand(:flag,4),0,0,1), decode(
bitand(:flag,8),0,0,1), decode(bitand(:flag,16),0,0,1), decode(bitand(:flag,
32),0,0,1), :time)

         203          203      3.41 b2gnxm5z6r51n
lock table sys.col_usage$ in exclusive mode nowait

         135          135      2.27 3m8smr0v7v1m6
INSERT INTO sys.wri$_adv_message_groups (task_id,id,seq,message#,fac,hdr,lm,nl,p
1,p2,p3,p4,p5) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)

         132          132      2.22 grwydz59pu6mc
select text from view$ where rowid=:1

         130          130      2.18 f80h0xb1qvbsk
SELECT sys.wri$_adv_seq_msggroup.nextval FROM dual

         125          125      2.10 350f5yrnnmshs
lock table sys.mon_mods$ in exclusive mode nowait

         125          125      2.10 g00cj285jmgsw
update sys.mon_mods$ set inserts = inserts + :ins, updates = updates + :upd, del
etes = deletes + :del, flags = (decode(bitand(flags, :flag), :flag, flags, flags
 + :flag)), drop_segments = drop_segments + :dropseg, timestamp = :time where ob
j# = :objn

          83           83      1.39 4m7m0t6fjcs5x
update seq$ set increment$=:2,minvalue=:3,maxvalue=:4,cycle#=:5,order$=:6,cache=
:7,highwater=:8,audit$=:9,flags=:10 where obj#=:1

          82           82      1.38 0h6b2sajwb74n
select privilege#,level from sysauth$ connect by grantee#=prior privilege# and p
rivilege#>0 start with grantee#=:1 and privilege#>0

SQL ordered by Parse Calls                 DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Parse Calls:           5,952
-> Captured SQL account for      61.4% of Total

                            % Total
 Parse Calls  Executions     Parses    SQL Id
------------ ------------ --------- -------------
          70           70      1.18 1dubbbfqnqvh9
SELECT ORA_TQ_BASE$.NEXTVAL FROM DUAL

          63           63      1.06 39m4sx9k63ba2
select /*+ index(idl_ub2$ i_idl_ub21) +*/ piece#,length,piece from idl_ub2$ wher
e obj#=:1 and part=:2 and version=:3 order by piece#

          63           63      1.06 c6awqs517jpj0
select /*+ index(idl_char$ i_idl_char1) +*/ piece#,length,piece from idl_char$ w
here obj#=:1 and part=:2 and version=:3 order by piece#

          63           63      1.06 cvn54b7yz0s8u
select /*+ index(idl_ub1$ i_idl_ub11) +*/ piece#,length,piece from idl_ub1$ wher
e obj#=:1 and part=:2 and version=:3 order by piece#

          63           63      1.06 ga9j9xk5cy9s0
select /*+ index(idl_sb4$ i_idl_sb41) +*/ piece#,length,piece from idl_sb4$ wher
e obj#=:1 and part=:2 and version=:3 order by piece#

          62           62      1.04 5hyh0360hgx2u
Module: wish8.5@dbrocaix01.bayantel.com (TNS V1-V3)
BEGIN slev(:st_w_id,:st_d_id,:threshold); END;

          -------------------------------------------------------------

SQL ordered by Sharable Memory             DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

SQL ordered by Version Count               DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Instance Activity Stats                    DB/Inst: IVRS/ivrs  Snaps: 338-339

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
CPU used by this session                     43,952           72.9          17.3
CPU used when call started                   80,217          133.0          31.6
CR blocks created                                 6            0.0           0.0
Cached Commit SCN referenced                    432            0.7           0.2
Commit SCN cached                                 1            0.0           0.0
DB time                                     374,210          620.5         147.4
DBWR checkpoint buffers written               3,433            5.7           1.4
DBWR checkpoints                                  1            0.0           0.0
DBWR transaction table writes                    20            0.0           0.0
DBWR undo block writes                          917            1.5           0.4
DFO trees parallelized                           76            0.1           0.0
IMU CR rollbacks                                  0            0.0           0.0
IMU Flushes                                     159            0.3           0.1
IMU Redo allocation size                    896,956        1,487.3         353.3
IMU commits                                   1,881            3.1           0.7
IMU contention                                    5            0.0           0.0
IMU pool not allocated                          488            0.8           0.2
IMU recursive-transaction flush                  47            0.1           0.0
IMU undo allocation size                 14,837,636       24,603.8       5,843.9
IMU- failed to get a private str                488            0.8           0.2
PX local messages recv'd                    427,618          709.1         168.4
PX local messages sent                      427,626          709.1         168.4
Parallel operations not downgrad                 76            0.1           0.0
SMON posted for undo segment shr                  0            0.0           0.0
SQL*Net roundtrips to/from clien              8,221           13.6           3.2
active txn count during cleanout                220            0.4           0.1
application wait time                             0            0.0           0.0
background checkpoints completed                  1            0.0           0.0
background checkpoints started                    1            0.0           0.0
background timeouts                           2,201            3.7           0.9
branch node splits                                0            0.0           0.0
buffer is not pinned count                  185,040          306.8          72.9
buffer is pinned count                      153,771          255.0          60.6
bytes received via SQL*Net from           2,339,345        3,879.1         921.4
bytes sent via SQL*Net to client          3,067,072        5,085.8       1,208.0
calls to get snapshot scn: kcmgs             93,092          154.4          36.7
calls to kcmgas                               4,066            6.7           1.6
calls to kcmgcs                                 276            0.5           0.1
change write time                               204            0.3           0.1
cleanout - number of ktugct call                278            0.5           0.1
cleanouts and rollbacks - consis                  0            0.0           0.0
cleanouts only - consistent read                 65            0.1           0.0
cluster key scan block gets                   1,999            3.3           0.8
cluster key scans                               991            1.6           0.4
commit batch/immediate performed                  5            0.0           0.0
commit batch/immediate requested                  5            0.0           0.0
commit cleanout failures: block                   0            0.0           0.0
commit cleanout failures: buffer                  0            0.0           0.0
commit cleanout failures: callba                 13            0.0           0.0
commit cleanout failures: cannot                  0            0.0           0.0
commit cleanouts                             21,493           35.6           8.5
commit cleanouts successfully co             21,480           35.6           8.5
commit immediate performed                        5            0.0           0.0
commit immediate requested                        5            0.0           0.0
commit txn count during cleanout                254            0.4           0.1
concurrency wait time                           168            0.3           0.1
consistent changes                               87            0.1           0.0
consistent gets                           5,981,829        9,919.1       2,356.0
consistent gets - examination               217,091          360.0          85.5
consistent gets direct                    5,802,782        9,622.2       2,285.5
Instance Activity Stats                    DB/Inst: IVRS/ivrs  Snaps: 338-339

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
consistent gets from cache                  354,637          588.1         139.7
cursor authentications                          208            0.3           0.1
data blocks consistent reads - u                  4            0.0           0.0
db block changes                             88,663          147.0          34.9
db block gets                                68,732          114.0          27.1
db block gets direct                              6            0.0           0.0
db block gets from cache                     68,726          114.0          27.1
deferred (CURRENT) block cleanou              9,569           15.9           3.8
dirty buffers inspected                       2,347            3.9           0.9
enqueue conversions                             806            1.3           0.3
enqueue releases                             21,768           36.1           8.6
enqueue requests                             21,963           36.4           8.7
enqueue timeouts                                201            0.3           0.1
enqueue waits                                    51            0.1           0.0
execute count                                57,841           95.9          22.8
free buffer inspected                        20,379           33.8           8.0
free buffer requested                        19,793           32.8           7.8
heap block compress                             144            0.2           0.1
hot buffers moved to head of LRU              7,705           12.8           3.0
immediate (CR) block cleanout ap                 65            0.1           0.0
immediate (CURRENT) block cleano              2,074            3.4           0.8
index crx upgrade (positioned)                  498            0.8           0.2
index fast full scans (direct re                 78            0.1           0.0
index fast full scans (full)                     15            0.0           0.0
index fast full scans (rowid ran                156            0.3           0.1
index fetch by key                           82,020          136.0          32.3
index scans kdiixs1                          16,708           27.7           6.6
leaf node 90-10 splits                           10            0.0           0.0
leaf node splits                                172            0.3           0.1
lob reads                                        42            0.1           0.0
lob writes                                      178            0.3           0.1
lob writes unaligned                            178            0.3           0.1
logons cumulative                               312            0.5           0.1
messages received                             2,837            4.7           1.1
messages sent                                 2,837            4.7           1.1
no buffer to keep pinned count                    0            0.0           0.0
no work - consistent read gets            5,895,112        9,775.3       2,321.8
opened cursors cumulative                     6,773           11.2           2.7
parse count (failures)                            0            0.0           0.0
parse count (hard)                              416            0.7           0.2
parse count (total)                           5,952            9.9           2.3
parse time cpu                                  684            1.1           0.3
parse time elapsed                            3,497            5.8           1.4
physical read IO requests                   397,584          659.3         156.6
physical read bytes                  47,825,584,128   79,304,326.1  18,836,386.0
physical read total IO requests             387,784          643.0         152.7
physical read total bytes            47,903,270,912   79,433,146.3  18,866,983.4
physical read total multi block             380,329          630.7         149.8
physical reads                            5,663,126        9,390.6       2,230.5
physical reads cache                         17,948           29.8           7.1
physical reads cache prefetch                   943            1.6           0.4
physical reads direct                     5,820,136        9,650.9       2,292.3
physical reads direct (lob)                       0            0.0           0.0
physical reads direct temporary              17,299           28.7           6.8
physical reads prefetch warmup                    0            0.0           0.0
physical reads retry corrupt                     54            0.1           0.0
physical write IO requests                    5,731            9.5           2.3
physical write bytes                    203,554,816      337,534.4      80,171.3
physical write total IO requests              8,484           14.1           3.3
physical write total bytes              283,976,192      470,889.0     111,845.7
Instance Activity Stats                    DB/Inst: IVRS/ivrs  Snaps: 338-339

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
physical write total multi block              5,019            8.3           2.0
physical writes                              24,848           41.2           9.8
physical writes direct                       17,318           28.7           6.8
physical writes direct (lob)                      0            0.0           0.0
physical writes direct temporary             17,299           28.7           6.8
physical writes from cache                    7,530           12.5           3.0
physical writes non checkpoint               23,712           39.3           9.3
pinned buffers inspected                          6            0.0           0.0
prefetch warmup blocks aged out                   0            0.0           0.0
prefetched blocks aged out befor                  2            0.0           0.0
process last non-idle time                      579            1.0           0.2
queries parallelized                             67            0.1           0.0
recursive calls                             115,742          191.9          45.6
recursive cpu usage                          43,163           71.6          17.0
redo blocks written                          32,504           53.9          12.8
redo buffer allocation retries                    1            0.0           0.0
redo entries                                 19,373           32.1           7.6
redo log space requests                           1            0.0           0.0
redo log space wait time                         25            0.0           0.0
redo size                                15,647,384       25,946.5       6,162.8
redo synch time                               5,470            9.1           2.2
redo synch writes                             2,102            3.5           0.8
redo wastage                                473,620          785.4         186.5
redo write time                               7,062           11.7           2.8
redo writer latching time                         1            0.0           0.0
redo writes                                   2,253            3.7           0.9
rollback changes - undo records                 109            0.2           0.0
rollbacks only - consistent read                  4            0.0           0.0
rows fetched via callback                    65,515          108.6          25.8
session connect time                              0            0.0           0.0
session cursor cache hits                     5,056            8.4           2.0
session logical reads                     6,050,561       10,033.0       2,383.1
session pga memory                      411,760,136      682,780.2     162,174.1
session pga memory max                5,395,314,184    8,946,503.5   2,124,976.1
session uga memory                   51,546,743,504   85,474,748.1  20,301,986.4
session uga memory max                1,043,985,628    1,731,135.7     411,179.9
shared hash latch upgrades - no               4,344            7.2           1.7
sorts (disk)                                      0            0.0           0.0
sorts (memory)                                1,839            3.1           0.7
sorts (rows)                             25,796,856       42,776.3      10,160.2
sql area evicted                                 85            0.1           0.0
sql area purged                                   0            0.0           0.0
summed dirty queue length                    13,205           21.9           5.2
switch current to new buffer                    858            1.4           0.3
table fetch by rowid                        127,462          211.4          50.2
table fetch continued row                       199            0.3           0.1
table scan blocks gotten                  5,826,518        9,661.5       2,294.8
table scan rows gotten                  342,238,570      567,499.6     134,792.7
table scans (direct read)                     3,353            5.6           1.3
table scans (long tables)                     4,229            7.0           1.7
table scans (rowid ranges)                    4,229            7.0           1.7
table scans (short tables)                    4,797            8.0           1.9
total number of times SMON poste                 39            0.1           0.0
transaction rollbacks                             5            0.0           0.0
transaction tables consistent re                  2            0.0           0.0
transaction tables consistent re                 28            0.1           0.0
undo change vector size                   5,810,908        9,635.6       2,288.7
user I/O wait time                           42,789           71.0          16.9
user calls                                   11,544           19.1           4.6
user commits                                  2,526            4.2           1.0
Instance Activity Stats                    DB/Inst: IVRS/ivrs  Snaps: 338-339

Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
user rollbacks                                   13            0.0           0.0
workarea executions - onepass                    10            0.0           0.0
workarea executions - optimal                 1,805            3.0           0.7
write clones created in foregrou                  7            0.0           0.0
          -------------------------------------------------------------

Instance Activity Stats - Absolute Values  DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Statistics with absolute values (should not be diffed)

Statistic                            Begin Value       End Value
-------------------------------- --------------- ---------------
session cursor cache count                10,364          10,760
opened cursors current                        91              67
workarea memory allocated                  2,258           2,368
logons current                                31              30
          -------------------------------------------------------------

Instance Activity Stats - Thread Activity   DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Statistics identified by '(derived)' come from sources other than SYSSTAT

Statistic                                     Total  per Hour
-------------------------------- ------------------ ---------
log switches (derived)                            1      5.97
          -------------------------------------------------------------

Tablespace IO Stats                        DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by IOs (Reads + Writes) desc

Tablespace
------------------------------
                 Av      Av     Av                       Av     Buffer Av Buf
         Reads Reads/s Rd(ms) Blks/Rd       Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
TPCHTAB
       387,123     642    0.2    14.8            2        0          3    0.0
USERS
         5,988      10   14.6     1.0        3,649        6          0    0.0
TEMP
         1,534       3    0.0    11.3        1,533        3          0    0.0
SYSTEM
         1,211       2   47.0     1.1           41        0          0    0.0
SYSAUX
           726       1  100.0     1.3          254        0          0    0.0
UNDOTBS1
             9       0    4.4     1.0          354        1          0    0.0
CCDATA
             1       0    0.0     1.0            1        0          0    0.0
CCINDEX
             1       0    0.0     1.0            1        0          0    0.0
PSE
             1       0    0.0     1.0            1        0          0    0.0
SOE
             1       0    0.0     1.0            1        0          0    0.0
SOEINDEX
             1       0    0.0     1.0            1        0          0    0.0
TPCCTAB
             1       0    0.0     1.0            1        0          0    0.0
          -------------------------------------------------------------

File IO Stats                              DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by Tablespace, File

Tablespace               Filename
------------------------ ----------------------------------------------------
                 Av      Av     Av                       Av     Buffer Av Buf
         Reads Reads/s Rd(ms) Blks/Rd       Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
CCDATA                   +DATA_1/ivrs/datafile/ccdata.dbf
             1       0    0.0     1.0            1        0          0    0.0
CCINDEX                  +DATA_1/ivrs/datafile/ccindex.dbf
             1       0    0.0     1.0            1        0          0    0.0
PSE                      +DATA_1/ivrs/pse.dbf
             1       0    0.0     1.0            1        0          0    0.0
SOE                      +DATA_1/ivrs/datafile/soe.dbf
             1       0    0.0     1.0            1        0          0    0.0
SOEINDEX                 +DATA_1/ivrs/datafile/soeindex.dbf
             1       0    0.0     1.0            1        0          0    0.0
SYSAUX                   +DATA_1/ivrs/datafile/sysaux.258.652821943
           726       1  100.0     1.3          254        0          0    0.0
SYSTEM                   +DATA_1/ivrs/datafile/system.267.652821909
         1,176       2   48.3     1.1           40        0          0    0.0
SYSTEM                   +DATA_1/ivrs/datafile/system_02.dbf
            35       0    4.6     1.0            1        0          0    0.0
TEMP                     +DATA_1/ivrs/tempfile/temp.256.652821953
         1,534       3    0.0    11.3        1,533        3          0    N/A
TPCCTAB                  +DATA_1/ivrs/tpcctab01.dbf
             1       0    0.0     1.0            1        0          0    0.0
TPCHTAB                  +DATA_1/ivrs/datafile/tpch_01.dbf
       387,123     642    0.2    14.8            2        0          3    0.0
UNDOTBS1                 +DATA_1/ivrs/datafile/undotbs1.257.652821933
             9       0    4.4     1.0          354        1          0    0.0
USERS                    +DATA_1/ivrs/datafile/users.263.652821963
         5,739      10   13.0     1.0        3,515        6          0    0.0
USERS                    +DATA_1/ivrs/datafile/users02.dbf
           249       0   50.3     1.0          134        0          0    0.0
          -------------------------------------------------------------

Buffer Pool Statistics                     DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Standard block size Pools  D: default,  K: keep,  R: recycle
-> Default Pools for other block sizes: 2k, 4k, 8k, 16k, 32k

                                                            Free Writ     Buffer
     Number of Pool         Buffer     Physical    Physical Buff Comp       Busy
P      Buffers Hit%           Gets        Reads      Writes Wait Wait      Waits
--- ---------- ---- -------------- ------------ ----------- ---- ---- ----------
D       24,184   96        428,087       18,328       7,579    0    0          3
          -------------------------------------------------------------

Instance Recovery Stats                     DB/Inst: IVRS/ivrs  Snaps: 338-339
-> B: Begin snapshot,  E: End snapshot

  Targt  Estd                                  Log File Log Ckpt     Log Ckpt
  MTTR   MTTR   Recovery  Actual    Target       Size    Timeout     Interval
   (s)    (s)   Estd IOs Redo Blks Redo Blks  Redo Blks Redo Blks   Redo Blks
- ----- ----- ---------- --------- --------- ---------- --------- ------------
B     0    50       1945     28667    184320     184320    219902          N/A
E     0    45        490      3284    119243     184320    119243          N/A
          -------------------------------------------------------------

Buffer Pool Advisory                             DB/Inst: IVRS/ivrs  Snap: 339
-> Only rows with estimated physical reads >0 are displayed
-> ordered by Block Size, Buffers For Estimate

                                        Est
                                       Phys
    Size for   Size      Buffers for   Read          Estimated
P    Est (M) Factor         Estimate Factor     Physical Reads
--- -------- ------ ---------------- ------ ------------------
D         16     .1            1,996    3.5            550,709
D         32     .2            3,992    2.5            392,558
D         48     .2            5,988    1.8            285,114
D         64     .3            7,984    1.5            235,318
D         80     .4            9,980    1.3            209,129
D         96     .5           11,976    1.2            196,161
D        112     .6           13,972    1.2            185,692
D        128     .7           15,968    1.1            178,684
D        144     .7           17,964    1.1            172,352
D        160     .8           19,960    1.1            166,932
D        176     .9           21,956    1.0            162,491
D        192    1.0           23,952    1.0            159,080
D        196    1.0           24,451    1.0            158,303
D        208    1.1           25,948    1.0            156,344
D        224    1.1           27,944    1.0            153,879
D        240    1.2           29,940    1.0            150,890
D        256    1.3           31,936    0.9            141,958
D        272    1.4           33,932    0.9            138,023
D        288    1.5           35,928    0.9            135,507
D        304    1.6           37,924    0.8            133,447
D        320    1.6           39,920    0.8            131,793
          -------------------------------------------------------------

PGA Aggr Summary                           DB/Inst: IVRS/ivrs  Snaps: 338-339
-> PGA cache hit % - percentage of W/A (WorkArea) data processed only in-memory

PGA Cache Hit %   W/A MB Processed  Extra W/A MB Read/Written
--------------- ------------------ --------------------------
           88.6              1,083                        139
          -------------------------------------------------------------

PGA Aggr Target Stats                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> B: Begin snap   E: End snap (rows dentified with B or E contain data
   which is absolute i.e. not diffed over the interval)
-> Auto PGA Target - actual workarea memory target
-> W/A PGA Used    - amount of memory used for all Workareas (manual + auto)
-> %PGA W/A Mem    - percentage of PGA memory allocated to workareas
-> %Auto W/A Mem   - percentage of workarea memory controlled by Auto Mem Mgmt
-> %Man W/A Mem    - percentage of workarea memory under manual control

                                                %PGA  %Auto   %Man
    PGA Aggr   Auto PGA   PGA Mem    W/A PGA     W/A    W/A    W/A Global Mem
   Target(M)  Target(M)  Alloc(M)    Used(M)     Mem    Mem    Mem   Bound(K)
- ---------- ---------- ---------- ---------- ------ ------ ------ ----------
B        103         39      148.9        7.7    5.2  100.0     .0     21,094
E        103         39      154.8        7.2    4.7  100.0     .0     21,094
          -------------------------------------------------------------

PGA Aggr Target Histogram                   DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Optimal Executions are purely in-memory operations

  Low     High
Optimal Optimal    Total Execs  Optimal Execs 1-Pass Execs M-Pass Execs
------- ------- -------------- -------------- ------------ ------------
     2K      4K          1,418          1,418            0            0
    64K    128K             14             14            0            0
   128K    256K             30             30            0            0
   256K    512K             12             12            0            0
   512K   1024K            140            140            0            0
     1M      2M             98             98            0            0
     2M      4M             70             70            0            0
     4M      8M             18             18            0            0
     8M     16M             12              6            6            0
    16M     32M             24             20            4            0
          -------------------------------------------------------------

PGA Memory Advisory                              DB/Inst: IVRS/ivrs  Snap: 339
-> When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value
   where Estd PGA Overalloc Count is 0

                                       Estd Extra    Estd PGA   Estd PGA
PGA Target    Size           W/A MB   W/A MB Read/      Cache  Overalloc
  Est (MB)   Factr        Processed Written to Disk     Hit %      Count
---------- ------- ---------------- ---------------- -------- ----------
        13     0.1          2,834.0          3,667.8     44.0        146
        26     0.3          2,834.0          3,667.8     44.0        146
        52     0.5          2,834.0          3,664.7     44.0        145
        77     0.8          2,834.0            756.1     79.0          7
       103     1.0          2,834.0            194.9     94.0          1
       124     1.2          2,834.0             41.8     99.0          0
       144     1.4          2,834.0             41.8     99.0          0
       165     1.6          2,834.0              0.0    100.0          0
       185     1.8          2,834.0              0.0    100.0          0
       206     2.0          2,834.0              0.0    100.0          0
       309     3.0          2,834.0              0.0    100.0          0
       412     4.0          2,834.0              0.0    100.0          0
       618     6.0          2,834.0              0.0    100.0          0
       824     8.0          2,834.0              0.0    100.0          0
          -------------------------------------------------------------

Shared Pool Advisory                            DB/Inst: IVRS/ivrs  Snap: 339
-> SP: Shared Pool     Est LC: Estimated Library Cache   Factr: Factor
-> Note there is often a 1:Many correlation between a single logical object
   in the Library Cache, and the physical number of memory objects associated
   with it.  Therefore comparing the number of Lib Cache objects (e.g. in
   v$librarycache), with the number of Lib Cache Memory Objects is invalid.

                                        Est LC Est LC  Est LC Est LC
    Shared    SP   Est LC                 Time   Time    Load   Load      Est LC
      Pool  Size     Size       Est LC   Saved  Saved    Time   Time         Mem
   Size(M) Factr      (M)      Mem Obj     (s)  Factr     (s)  Factr    Obj Hits
---------- ----- -------- ------------ ------- ------ ------- ------ -----------
        60    .6       14        1,547  44,365     .8  12,137   28.4     331,775
        72    .8       24        2,600  50,039     .9   6,463   15.1     333,416
        84    .9       35        3,092  54,519    1.0   1,983    4.6     334,661
        96   1.0       45        3,178  56,075    1.0     427    1.0     335,447
       108   1.1       56        3,304  56,282    1.0     220     .5     335,896
       120   1.3       66        3,529  56,304    1.0     198     .5     336,179
       132   1.4       77        3,956  56,314    1.0     188     .4     336,411
       144   1.5       88        4,522  56,317    1.0     185     .4     336,631
       156   1.6      100        6,389  56,319    1.0     183     .4     336,791
       168   1.8      100        6,389  56,319    1.0     183     .4     336,855
       180   1.9      100        6,389  56,319    1.0     183     .4     336,865
       192   2.0      100        6,389  56,319    1.0     183     .4     336,867
          -------------------------------------------------------------

SGA Target Advisory                              DB/Inst: IVRS/ivrs  Snap: 339

SGA Target   SGA Size       Est DB     Est Physical
  Size (M)     Factor     Time (s)            Reads
---------- ---------- ------------ ----------------
       156        0.5       11,816          283,577
       234        0.8        8,316          195,068
       312        1.0        7,642          158,193
       390        1.3        7,248          137,264
       468        1.5        7,098          131,063
       546        1.8        7,093          131,063
       624        2.0        7,093          131,063
          -------------------------------------------------------------

Streams Pool Advisory                            DB/Inst: IVRS/ivrs  Snap: 339

  Size for      Size   Est Spill   Est Spill Est Unspill Est Unspill
  Est (MB)    Factor       Count    Time (s)       Count    Time (s)
---------- --------- ----------- ----------- ----------- -----------
         4       1.0           0           0           0           0
         8       2.0           0           0           0           0
        12       3.0           0           0           0           0
        16       4.0           0           0           0           0
        20       5.0           0           0           0           0
        24       6.0           0           0           0           0
        28       7.0           0           0           0           0
        32       8.0           0           0           0           0
        36       9.0           0           0           0           0
        40      10.0           0           0           0           0
        44      11.0           0           0           0           0
        48      12.0           0           0           0           0
        52      13.0           0           0           0           0
        56      14.0           0           0           0           0
        60      15.0           0           0           0           0
        64      16.0           0           0           0           0
        68      17.0           0           0           0           0
        72      18.0           0           0           0           0
        76      19.0           0           0           0           0
        80      20.0           0           0           0           0
          -------------------------------------------------------------

Java Pool Advisory                               DB/Inst: IVRS/ivrs  Snap: 339

                                        Est LC Est LC  Est LC Est LC
      Java    JP   Est LC                 Time   Time    Load   Load      Est LC
      Pool  Size     Size       Est LC   Saved  Saved    Time   Time         Mem
   Size(M) Factr      (M)      Mem Obj     (s)  Factr     (s)  Factr    Obj Hits
---------- ----- -------- ------------ ------- ------ ------- ------ -----------
         8   1.0        4          148      78    1.0     427    1.0         163
        12   1.5        4          148      78    1.0     427    1.0         163
        16   2.0        4          148      78    1.0     427    1.0         163
          -------------------------------------------------------------

Buffer Wait Statistics                      DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by wait time desc, waits desc

Class                    Waits Total Wait Time (s)  Avg Time (ms)
------------------ ----------- ------------------- --------------
data block                   3                   0              0
          -------------------------------------------------------------

Enqueue Activity                           DB/Inst: IVRS/ivrs  Snaps: 338-339
-> only enqueues with waits are shown
-> Enqueue stats gathered prior to 10g should not be compared with 10g data
-> ordered by Wait Time desc, Waits desc

Enqueue Type (Request Reason)
------------------------------------------------------------------------------
    Requests    Succ Gets Failed Gets       Waits  Wt Time (s) Av Wt Time(ms)
------------ ------------ ----------- ----------- ------------ --------------
PS-PX Process Reservation
       1,368        1,168         200          50            0           3.80
BF-BLOOM FILTER (allocation contention)
          78           78           0           1            0            .00
          -------------------------------------------------------------

Undo Segment Summary                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Min/Max TR (mins) - Min and Max Tuned Retention (minutes)
-> STO - Snapshot Too Old count,  OOS - Out of Space count
-> Undo segment block stats:
-> uS - unexpired Stolen,   uR - unexpired Released,   uU - unexpired reUsed
-> eS - expired   Stolen,   eR - expired   Released,   eU - expired   reUsed

Undo   Num Undo       Number of  Max Qry   Max Tx Min/Max   STO/     uS/uR/uU/
 TS# Blocks (K)    Transactions  Len (s) Concurcy TR (mins) OOS      eS/eR/eU
---- ---------- --------------- -------- -------- --------- ----- --------------
   1        1.4           4,612       49        4 15/15     0/0   0/0/0/0/0/0
          -------------------------------------------------------------

Undo Segment Stats                          DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Most recent 35 Undostat rows, ordered by Time desc

                Num Undo    Number of Max Qry  Max Tx Tun Ret STO/    uS/uR/uU/
End Time          Blocks Transactions Len (s)   Concy  (mins) OOS     eS/eR/eU
------------ ----------- ------------ ------- ------- ------- ----- ------------
17-Jan 07:07         170          198       0       3      15 0/0   0/0/0/0/0/0
17-Jan 06:57       1,200        4,414      49       4      15 0/0   0/0/0/0/0/0
          -------------------------------------------------------------

Latch Activity                             DB/Inst: IVRS/ivrs  Snaps: 338-339
-> "Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
   willing-to-wait latch get requests
-> "NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
-> "Pct Misses" for both should be very close to 0.0

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
ASM allocation                      154    0.0    N/A      0            0    N/A
ASM db client latch                 358    0.0    N/A      0            0    N/A
ASM map headers                      66    0.0    N/A      0            0    N/A
ASM map load waiting lis             11    0.0    N/A      0            0    N/A
ASM map operation freeli             35    0.0    N/A      0            0    N/A
ASM map operation hash t        836,612    0.0    N/A      0            0    N/A
ASM network background l            302    0.0    N/A      0            0    N/A
AWR Alerted Metric Eleme          2,246    0.0    N/A      0            0    N/A
Bloom filter list latch              27    0.0    N/A      0            0    N/A
Consistent RBA                    2,298    0.0    N/A      0            0    N/A
FAL request queue                    14    0.0    N/A      0            0    N/A
FAL subheap alocation                14    0.0    N/A      0            0    N/A
FIB s.o chain latch                  26    0.0    N/A      0            0    N/A
FOB s.o list latch                  131    0.0    N/A      0            0    N/A
In memory undo latch             35,563    0.0    N/A      0        2,736    0.0
JOX SGA heap latch                  887    0.0    N/A      0            0    N/A
JS queue state obj latch          4,248    0.0    N/A      0            0    N/A
JS slv state obj latch                4    0.0    N/A      0            0    N/A
KFK SGA context latch               301    0.0    N/A      0            0    N/A
KFMD SGA                             33    0.0    N/A      0            0    N/A
KMG MMAN ready and start            213    0.0    N/A      0            0    N/A
KMG resize request state              9    0.0    N/A      0            0    N/A
KTF sga latch                         2    0.0    N/A      0          157    0.0
KWQP Prop Status                      3    0.0    N/A      0            0    N/A
MQL Tracking Latch                    0    N/A    N/A      0           11    0.0
Memory Management Latch              96    0.0    N/A      0          213    0.0
OS process                           51    0.0    N/A      0            0    N/A
OS process allocation               230    0.0    N/A      0            0    N/A
OS process: request allo             17    0.0    N/A      0            0    N/A
PL/SQL warning settings           2,329    0.0    N/A      0            0    N/A
Reserved Space Latch                  3    0.0    N/A      0            0    N/A
SGA IO buffer pool latch            128    0.0    N/A      0          164    0.0
SQL memory manager latch             48    0.0    N/A      0          179    0.0
SQL memory manager worka         16,771    0.0    1.0      0            0    N/A
Shared B-Tree                        28    0.0    N/A      0            0    N/A
active checkpoint queue             829    0.0    N/A      0            0    N/A
active service list               3,643    0.0    N/A      0          240    0.0
archive control                      16    0.0    N/A      0            0    N/A
archive process latch               193    0.0    N/A      0            0    N/A
begin backup scn array                2    0.0    N/A      0            0    N/A
buffer pool                           8    0.0    N/A      0            0    N/A
cache buffer handles             34,516    0.0    N/A      0            0    N/A
cache buffers chains            952,571    0.0    1.0      0       26,780    0.0
cache buffers lru chain          39,708    0.1    1.0      0        8,252    0.0
cache table scan latch                0    N/A    N/A      0          236    0.0
channel handle pool latc             95    0.0    N/A      0            0    N/A
channel operations paren          2,989    0.0    N/A      0            0    N/A
checkpoint queue latch           16,493    0.0    N/A      0        4,965    0.0
client/application info           1,815    0.0    N/A      0            0    N/A
compile environment latc          4,979    0.0    N/A      0            0    N/A
dml lock allocation              23,341    0.0    1.0      0            0    N/A
dummy allocation                    633    0.0    N/A      0            0    N/A
enqueue hash chains              45,427    0.0    N/A      0           30    0.0
enqueues                         19,373    0.0    N/A      0            0    N/A
error message lists                 540    0.0    N/A      0            0    N/A
event group latch                     8    0.0    N/A      0            0    N/A
file cache latch                     36    0.0    N/A      0            0    N/A
global KZLD latch for me              4    0.0    N/A      0            0    N/A
hash table column usage             222    0.0    N/A      0       48,959    0.0
hash table modification               6    0.0    N/A      0            0    N/A
Latch Activity                             DB/Inst: IVRS/ivrs  Snaps: 338-339
-> "Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
   willing-to-wait latch get requests
-> "NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
-> "Pct Misses" for both should be very close to 0.0

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
job workq parent latch                0    N/A    N/A      0           24    0.0
job_queue_processes para             21    0.0    N/A      0            0    N/A
kks stats                         1,012    0.0    N/A      0            0    N/A
ksuosstats global area               44    0.0    N/A      0            0    N/A
ktm global data                      39    0.0    N/A      0            0    N/A
kwqbsn:qsga                          27    0.0    N/A      0            0    N/A
lgwr LWN SCN                      2,325    0.0    N/A      0            0    N/A
library cache                    50,273    0.0    1.1      0          141    0.7
library cache load lock             800    0.0    N/A      0            0    N/A
library cache lock               20,079    0.0    N/A      0            0    N/A
library cache lock alloc            590    0.0    N/A      0            0    N/A
library cache pin                17,505    0.0    N/A      0            0    N/A
library cache pin alloca            188    0.0    N/A      0            0    N/A
list of block allocation             74    0.0    N/A      0            0    N/A
loader state object free          6,844    0.0    N/A      0            0    N/A
logminer context allocat              1    0.0    N/A      0            0    N/A
longop free list parent               2    0.0    N/A      0            2    0.0
message pool operations              78    0.0    N/A      0            0    N/A
messages                         12,610    0.0    N/A      0            0    N/A
mostly latch-free SCN             2,325    0.0    N/A      0            0    N/A
msg queue                            22    0.0    N/A      0           22    0.0
multiblock read objects             840    0.0    N/A      0            0    N/A
ncodef allocation latch              11    0.0    N/A      0            0    N/A
object queue header heap          1,079    0.0    N/A      0           92    0.0
object queue header oper         65,592    0.0    1.0      0        1,285    0.0
object stats modificatio              2    0.0    N/A      0            0    N/A
parallel query alloc buf          4,364    0.0    N/A      0            0    N/A
parallel query stats                491    0.0    N/A      0            0    N/A
parameter list                      107    0.0    N/A      0            0    N/A
parameter table allocati            624    0.0    N/A      0            0    N/A
post/wait queue                   3,549    0.0    N/A      0        1,440    0.0
process allocation                   85    0.0    N/A      0            8    0.0
process group creation               17    0.0    N/A      0            0    N/A
process queue                     2,870    0.0    N/A      0            0    N/A
process queue reference       7,204,772    0.0    1.0      0      585,085    1.2
qmn task queue latch                 88    0.0    N/A      0            0    N/A
query server freelists            2,507    0.0    N/A      0            0    N/A
redo allocation                   9,876    0.0    1.0      0       19,450    0.0
redo copy                             1    0.0    N/A      0       19,449    0.1
redo writing                      8,100    0.0    N/A      0            0    N/A
reservation so alloc lat              2    0.0    N/A      0            0    N/A
resmgr group change latc            366    0.0    N/A      0            0    N/A
resmgr:actses active lis            630    0.0    N/A      0            0    N/A
resmgr:actses change gro            312    0.0    N/A      0            0    N/A
resmgr:free threads list            628    0.0    N/A      0            0    N/A
resmgr:schema config                  2    0.0    N/A      0            0    N/A
row cache objects               157,344    0.0    N/A      0          425    0.0
rules engine rule set st            200    0.0    N/A      0            0    N/A
segmented array pool                 22    0.0    N/A      0            0    N/A
sequence cache                      590    0.0    N/A      0            0    N/A
session allocation               78,343    0.0    1.2      0            0    N/A
session idle bit                 28,022    0.0    N/A      0            0    N/A
session state list latch            644    0.0    N/A      0            0    N/A
session switching                    11    0.0    N/A      0            0    N/A
session timer                       240    0.0    N/A      0            0    N/A
shared pool                      33,242    0.0    1.0      0            0    N/A
shared pool sim alloc                10    0.0    N/A      0            0    N/A
shared pool simulator            10,083    0.0    N/A      0            0    N/A
simulator hash latch             47,721    0.0    N/A      0            0    N/A
simulator lru latch              26,263    0.0    1.0      0       18,583    0.0
Latch Activity                             DB/Inst: IVRS/ivrs  Snaps: 338-339
-> "Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
   willing-to-wait latch get requests
-> "NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
-> "Pct Misses" for both should be very close to 0.0

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
slave class                          69    0.0    N/A      0            0    N/A
slave class create                   55    1.8    1.0      0            0    N/A
sort extent pool                    321    0.0    N/A      0            0    N/A
state object free list                2    0.0    N/A      0            0    N/A
statistics aggregation              140    0.0    N/A      0            0    N/A
temp lob duration state               2    0.0    N/A      0            0    N/A
threshold alerts latch               64    0.0    N/A      0            0    N/A
transaction allocation               50    0.0    N/A      0            0    N/A
transaction branch alloc             11    0.0    N/A      0            0    N/A
undo global data                 14,398    0.0    N/A      0            0    N/A
user lock                            42    0.0    N/A      0            0    N/A
          -------------------------------------------------------------

Latch Sleep Breakdown                      DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by misses desc

Latch Name
----------------------------------------
  Get Requests      Misses      Sleeps  Spin Gets   Sleep1   Sleep2   Sleep3
-------------- ----------- ----------- ---------- -------- -------- --------
cache buffers lru chain
        39,708          22          23          0        0        0        0
library cache
        50,273           8           9          0        0        0        0
session allocation
        78,343           6           7          0        0        0        0
cache buffers chains
       952,571           3           3          0        0        0        0
object queue header operation
        65,592           2           2          0        0        0        0
process queue reference
     7,204,772           2           2          0        0        0        0
shared pool
        33,242           2           2          0        0        0        0
simulator lru latch
        26,263           2           2          0        0        0        0
SQL memory manager workarea list latch
        16,771           1           1          0        0        0        0
dml lock allocation
        23,341           1           1          0        0        0        0
redo allocation
         9,876           1           1          0        0        0        0
slave class create
            55           1           1          0        0        0        0
          -------------------------------------------------------------

Latch Miss Sources                         DB/Inst: IVRS/ivrs  Snaps: 338-339
-> only latches with sleeps are shown
-> ordered by name, sleeps desc

                                                     NoWait              Waiter
Latch Name               Where                       Misses     Sleeps   Sleeps
------------------------ -------------------------- ------- ---------- --------
SQL memory manager worka qesmmIRegisterWorkArea           0          1        1
cache buffers chains     kcbgtcr: kslbegin excl           0          2        3
cache buffers chains     kcbgtcr: fast path               0          1        0
cache buffers lru chain  kcbzgws_1                        0         19       20
cache buffers lru chain  kcbw_activate_granule            0          1        0
dml lock allocation      ktaiam                           0          1        0
library cache            kglScanDependency                0          3        0
library cache            kgldte: child 0                  0          3        6
library cache            kgldti: 2child                   0          1        0
library cache            kglobpn: child:                  0          1        1
object queue header oper kcbw_link_q                      0          1        0
object queue header oper kcbw_unlink_q                    0          1        1
process queue reference  kxfpqrsnd                        0          2        0
redo allocation          kcrfw_redo_gen: redo alloc       0          1        0
session allocation       ksuxds: KSUSFCLC not set         0          3        1
session allocation       ksursi                           0          2        2
session allocation       ksucri                           0          1        1
session allocation       ksuxds: KSUSFCLC set             0          1        0
shared pool              kghalo                           0          2        0
shared pool              kghfrunp: clatch: nowait         0          1        0
simulator lru latch      kcbs_simulate: simulate se       0          2        2
slave class create       ksvcreate                        0          1        0
          -------------------------------------------------------------

Parent Latch Statistics                    DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Child Latch Statistics                      DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Segments by Logical Reads                  DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Logical Reads:       6,050,561
-> Captured Segments account for  101.7% of Total

           Tablespace                      Subobject  Obj.       Logical
Owner         Name    Object Name            Name     Type         Reads  %Total
---------- ---------- -------------------- ---------- ----- ------------ -------
TPCH       TPCHTAB    LINEITEM                        TABLE    4,960,400   81.98
TPCH       TPCHTAB    ORDERS                          TABLE      502,768    8.31
TPCH       TPCHTAB    PARTSUPP                        TABLE      161,968    2.68
TPCH       TPCHTAB    PART                            TABLE       95,984    1.59
TPCC       USERS      STOCK_I1                        INDEX       91,984    1.52
          -------------------------------------------------------------

Segments by Physical Reads                  DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Total Physical Reads:       5,663,126
-> Captured Segments account for   101.7% of Total

           Tablespace                      Subobject  Obj.      Physical
Owner         Name    Object Name            Name     Type         Reads  %Total
---------- ---------- -------------------- ---------- ----- ------------ -------
TPCH       TPCHTAB    LINEITEM                        TABLE    4,947,520   87.36
TPCH       TPCHTAB    ORDERS                          TABLE      492,387    8.69
TPCH       TPCHTAB    PARTSUPP                        TABLE      158,037    2.79
TPCH       TPCHTAB    PART                            TABLE       92,064    1.63
TPCH       TPCHTAB    CUSTOMER                        TABLE       55,709     .98
          -------------------------------------------------------------

Segments by Row Lock Waits                 DB/Inst: IVRS/ivrs  Snaps: 338-339
-> % of Capture shows % of row lock waits for each top segment compared
-> with total row lock waits for all segments captured by the Snapshot

                                                                     Row
           Tablespace                      Subobject  Obj.          Lock    % of
Owner         Name    Object Name            Name     Type         Waits Capture
---------- ---------- -------------------- ---------- ----- ------------ -------
TPCC       USERS      IORDL                           INDEX           24   75.00
PERFSTAT   USERS      STATS$EVENT_HISTOGRA            INDEX            4   12.50
PERFSTAT   USERS      STATS$LATCH_PK                  INDEX            4   12.50
          -------------------------------------------------------------

Segments by ITL Waits                       DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Segments by Buffer Busy Waits               DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Dictionary Cache Stats                     DB/Inst: IVRS/ivrs  Snaps: 338-339
-> "Pct Misses"  should be very low (< 2% in most cases)
-> "Final Usage" is the number of cache entries being used

                                   Get    Pct    Scan   Pct      Mod      Final
Cache                         Requests   Miss    Reqs  Miss     Reqs      Usage
------------------------- ------------ ------ ------- ----- -------- ----------
dc_awr_control                      14    0.0       0   N/A        2          1
dc_global_oids                      91    4.4       0   N/A        0         29
dc_histogram_data                4,249    2.0       0   N/A        0      1,281
dc_histogram_defs                9,313    2.4       0   N/A        0      2,713
dc_object_grants                    26    7.7       0   N/A        0         45
dc_object_ids                    4,946    1.0       0   N/A        0        663
dc_objects                       1,968    4.0       0   N/A        3        794
dc_profiles                         16    0.0       0   N/A        0          1
dc_rollback_segments               136    0.0       0   N/A        0         16
dc_segments                      1,989    2.6       0   N/A        4        479
dc_sequences                        84    0.0       0   N/A       84          7
dc_tablespaces                  16,511    0.0       0   N/A        0         12
dc_usernames                       260    0.0       0   N/A        0         12
dc_users                        15,529    0.0       0   N/A        0         57
outstanding_alerts                  27    0.0       0   N/A        0         24
          -------------------------------------------------------------

Library Cache Activity                      DB/Inst: IVRS/ivrs  Snaps: 338-339
-> "Pct Misses"  should be very low

                         Get    Pct            Pin    Pct             Invali-
Namespace           Requests   Miss       Requests   Miss    Reloads  dations
--------------- ------------ ------ -------------- ------ ---------- --------
SQL AREA               1,117    6.1         64,285    1.8        294      154
TABLE/PROCEDURE          449    0.4          7,900    4.6        261        0
BODY                     148    0.0          1,278    1.7         22        0
TRIGGER                   42    0.0             80   13.8         11        0
INDEX                     24    0.0             80    6.3          5        0
CLUSTER                   18    0.0             59    0.0          0        0
JAVA DATA                  1    0.0              0    N/A          0        0
          -------------------------------------------------------------

Process Memory Summary                     DB/Inst: IVRS/ivrs  Snaps: 338-339
-> B: Begin snap   E: End snap
-> All rows below contain absolute values (i.e. not diffed over the interval)
-> Max Alloc is Maximum PGA Allocation size at snapshot time
-> Hist Max Alloc is the Historical Max Allocation for still-connected processes
-> ordered by Begin/End snapshot, Alloc (MB) desc

                                                            Hist
                                    Avg  Std Dev     Max     Max
               Alloc      Used    Alloc    Alloc   Alloc   Alloc    Num    Num
  Category      (MB)      (MB)     (MB)     (MB)    (MB)    (MB)   Proc  Alloc
- -------- --------- --------- -------- -------- ------- ------- ------ ------
B Other        128.6       N/A      3.5      6.1      24      25     37     37
  Freeable       9.7        .0       .6       .6       2     N/A     16     16
  SQL            3.6       2.9       .2       .3       1      25     22     15
  PL/SQL          .4        .1       .0       .0       0       0     35     33
E Other        133.6       N/A      3.7      6.1      24      24     36     36
  Freeable      12.1        .0       .7       .4       2     N/A     18     18
  SQL            2.9       2.6       .1       .3       1      26     22     14
  PL/SQL          .5        .1       .0       .0       0       0     34     32
  JAVA            .0        .0       .0       .0       0       2      1      1
          -------------------------------------------------------------

SGA Memory Summary                          DB/Inst: IVRS/ivrs  Snaps: 338-339

                                                      End Size (Bytes)
SGA regions                     Begin Size (Bytes)      (if different)
------------------------------ ------------------- -------------------
Database Buffers                       213,909,504         205,520,896
Fixed Size                               1,261,612
Redo Buffers                             2,928,640
Variable Size                          109,055,956         117,444,564
                               -------------------
sum                                    327,155,712
          -------------------------------------------------------------

SGA breakdown difference                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> ordered by Pool, Name
-> N/A value for Begin MB or End MB indicates the size of that Pool/Name was
   insignificant, or zero in that snapshot

Pool   Name                                 Begin MB         End MB  % Diff
------ ------------------------------ -------------- -------------- -------
java   free memory                               2.8            2.7   -3.98
java   joxlod exec hp                            5.0            5.1    2.23
java   joxs heap                                  .2             .2    0.00
large  ASM map operations hashta                  .2             .2    0.00
large  CTWR dba buffer                            .4             .4    0.00
large  PX msg pool                                .2             .2   20.83
large  free memory                               1.2            1.2   -3.32
large  krcc extent chunk                         2.0            2.0    0.00
shared ASH buffers                               2.0            2.0    0.00
shared CCursor                                   3.0            3.3   11.37
shared Heap0: KGL                                1.7            1.7    2.13
shared KCB Table Scan Buffer                     3.8            3.8    0.00
shared KGH: NO ACCESS                           12.0           13.9   16.25
shared KGLS heap                                 2.6            3.4   31.25
shared KQR M PO                                  2.2            2.1   -3.77
shared KSFD SGA I/O b                            3.8            3.8    0.00
shared KTI-UNDO                                  1.2            1.2    0.00
shared PCursor                                   2.0            2.0    1.70
shared PL/SQL DIANA                              N/A            1.1     N/A
shared PL/SQL MPCODE                             2.3            2.3    1.07
shared event statistics per sess                 1.3            1.3    0.00
shared free memory                              22.1           20.9   -5.56
shared kglsim hash table bkts                    2.0            2.0    0.00
shared library cache                             5.7            5.7   -0.52
shared private strands                           1.1            1.1    0.00
shared row cache                                 3.6            3.6    0.00
shared sql area                                  9.7           15.0   54.05
stream free memory                               4.0            4.0    0.00
       buffer_cache                            204.0          196.0   -3.92
       fixed_sga                                 1.2            1.2    0.00
       log_buffer                                2.8            2.8    0.00
          -------------------------------------------------------------

Streams CPU/IO Usage                       DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Streams processes ordered by CPU usage
-> CPU and I/O Time in micro seconds

Session Type                    CPU Time  User I/O Time   Sys I/O Time
------------------------- -------------- -------------- --------------
QMON Coordinator                  31,890              0              0
QMON Slaves                       24,062              0              0
          -------------------------------------------------------------

Streams Capture                             DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Streams Apply                               DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Buffered Queues                             DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Buffered Subscribers                        DB/Inst: IVRS/ivrs  Snaps: 338-339

                  No data exists for this section of the report.
          -------------------------------------------------------------

Rule Set                                    DB/Inst: IVRS/ivrs  Snaps: 338-339
-> Rule Sets ordered by Evaluations

                                       Fast      SQL      CPU  Elapsed
Ruleset Name                 Evals    Evals    Execs     Time     Time
------------------------- -------- -------- -------- -------- --------
SYS.ALERT_QUE_R                  0        0        0        0        0
          -------------------------------------------------------------

Resource Limit Stats                            DB/Inst: IVRS/ivrs  Snap: 339

                  No data exists for this section of the report.
          -------------------------------------------------------------

init.ora Parameters                        DB/Inst: IVRS/ivrs  Snaps: 338-339

                                                                End value
Parameter Name                Begin value                       (if different)
----------------------------- --------------------------------- --------------
audit_file_dest               /oracle/app/oracle/admin/ivrs/adu
audit_sys_operations          TRUE
background_dump_dest          /oracle/app/oracle/admin/ivrs/bdu
compatible                    10.2.0.3.0
control_files                 +DATA_1/ivrs/control01.ctl, +DATA
core_dump_dest                /oracle/app/oracle/admin/ivrs/cdu
db_block_size                 8192
db_domain                     bayantel.com
db_file_multiblock_read_count 16
db_name                       ivrs
db_recovery_file_dest         /flash_reco/flash_recovery_area
db_recovery_file_dest_size    161061273600
dispatchers                   (PROTOCOL=TCP) (SERVICE=ivrsXDB)
job_queue_processes           10
log_archive_dest_1            LOCATION=USE_DB_RECOVERY_FILE_DES
log_archive_format            ivrs_%t_%s_%r.arc
open_cursors                  300
os_authent_prefix
os_roles                      FALSE
pga_aggregate_target          108003328
processes                     150
recyclebin                    OFF
remote_login_passwordfile     EXCLUSIVE
remote_os_authent             FALSE
remote_os_roles               FALSE
sga_target                    327155712
spfile                        +DATA_1/ivrs/spfileivrs.ora
sql92_security                TRUE
statistics_level              TYPICAL
undo_management               AUTO
undo_tablespace               UNDOTBS1
user_dump_dest                /oracle/app/oracle/admin/ivrs/udu
          -------------------------------------------------------------

End of Report
}}}
http://karlarao.wordpress.com/scripts-resources/
<<<
AWR Tableau Toolkit – create your own performance data warehouse and easily characterize the workload, CPU, IO of the entire cluster (30 instances) with months of perf data in less than 1 hour updated 20120912
I no longer update this toolkit. This served as a version 1 of a more comprehensive tool called eAdam which I started with Carlos Sierra (the main developer), Frits Hoogland, and Randy Johnson at Enkitec.
<<<
see [[eAdam]]
''AWR tableau and R toolkit - blueprint'' http://www.evernote.com/shard/s48/sh/e20c905c-694e-4950-8d57-e890a208c76b/189e50f39a739500e6b98b4511751cea

''Workload visualization notes:'' http://www.evernote.com/shard/s48/sh/0918cd46-2cec-494e-9932-eb725712bb68/9d211e0a7876d7dc41c98c0416675965

''check this out for the mind map version'' https://sites.google.com/site/karlarao/home/mindmap/awr-tableau-and-r-toolkit-visualization-examples

''the viz on the tiddlers are coming from the following data sets:''
<<<
{{{
topevents
sysstat
io workload
cpu workload
services
topsql

General Workload 
	wait class, wait events, executes/sec
CPU 
	AAS CPU, load average, NUM_CPUs
IO
	latency, IOPS breakdown, MB/s
Memory
	SGA , max PGA usage, physical memory
Storage 
	total storage size, reco size 
Services
	distribution of workload/modules
Top SQL 
	modules, SQL type, SQL_ID PIOs/LIOs , PX usage
}}}
<<<
with these data points I can easily characterize the overall behavior of the cluster 


''check this out for the mind map version'' https://sites.google.com/site/karlarao/home/mindmap/awr-tableau-and-r-toolkit-visualization-examples


{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR CPU and IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              heading instname        -- instname
col hostname    format a30              heading hostname        -- hostname
col tm          format a17              heading tm              -- "tm"
col id          format 99999            heading id              -- "snapid"
col inst        format 90               heading inst            -- "inst"
col dur         format 999990.00        heading dur             -- "dur"
col cpu         format 90               heading cpu             -- "cpu"
col cap         format 9999990.00       heading cap             -- "capacity"
col dbt         format 999990.00        heading dbt             -- "DBTime"
col dbc         format 99990.00         heading dbc             -- "DBcpu"
col bgc         format 99990.00         heading bgc             -- "BGcpu"
col rman        format 9990.00          heading rman            -- "RMANcpu"
col aas         format 990.0            heading aas             -- "AAS"
col totora      format 9999990.00       heading totora          -- "TotalOracleCPU"
col busy        format 9999990.00       heading busy            -- "BusyTime"
col load        format 990.00           heading load            -- "OSLoad"
col totos       format 9999990.00       heading totos           -- "TotalOSCPU"
col mem         format 999990.00        heading mem             -- "PhysicalMemorymb"
col IORs        format 9990.000         heading IORs            -- "IOPsr"
col IOWs        format 9990.000         heading IOWs            -- "IOPsw"
col IORedo      format 9990.000         heading IORedo          -- "IOPsredo"
col IORmbs      format 9990.000         heading IORmbs          -- "IOrmbs"
col IOWmbs      format 9990.000         heading IOWmbs          -- "IOwmbs"
col redosizesec format 9990.000         heading redosizesec     -- "Redombs"
col logons      format 990              heading logons          -- "Sess"
col logone      format 990              heading logone          -- "SessEnd"
col exsraw      format 99990.000        heading exsraw          -- "Execrawdelta"
col exs         format 9990.000         heading exs             -- "Execs"
col ucs         format 9990.000         heading ucs             -- "UserCalls"
col ucoms       format 9990.000         heading ucoms           -- "Commit"
col urs         format 9990.000         heading urs             -- "Rollback"
col oracpupct   format 990              heading oracpupct       -- "OracleCPUPct"
col rmancpupct  format 990              heading rmancpupct      -- "RMANCPUPct"
col oscpupct    format 990              heading oscpupct        -- "OSCPUPct"
col oscpuusr    format 990              heading oscpuusr        -- "USRPct"
col oscpusys    format 990              heading oscpusys        -- "SYSPct"
col oscpuio     format 990              heading oscpuio         -- "IOPct"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
          s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
  s3t1.value AS cpu,
  (round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value cap,
  (s5t1.value - s5t0.value) / 1000000 as dbt,
  (s6t1.value - s6t0.value) / 1000000 as dbc,
  (s7t1.value - s7t0.value) / 1000000 as bgc,
  round(DECODE(s8t1.value,null,'null',(s8t1.value - s8t0.value) / 1000000),2) as rman,
  ((s5t1.value - s5t0.value) / 1000000)/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,
  round(((s6t1.value - s6t0.value) / 1000000) + ((s7t1.value - s7t0.value) / 1000000),2) totora,
  -- s1t1.value - s1t0.value AS busy,  -- this is osstat BUSY_TIME
  round(s2t1.value,2) AS load,
  (s1t1.value - s1t0.value)/100 AS totos,
  ((round(((s6t1.value - s6t0.value) / 1000000) + ((s7t1.value - s7t0.value) / 1000000),2)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oracpupct,
  ((round(DECODE(s8t1.value,null,'null',(s8t1.value - s8t0.value) / 1000000),2)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as rmancpupct,
  (((s1t1.value - s1t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpupct,
  (((s17t1.value - s17t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpuusr,
  (((s18t1.value - s18t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpusys,
  (((s19t1.value - s19t0.value)/100) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2)*60)*s3t1.value))*100 as oscpuio
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_osstat s1t0,         -- BUSY_TIME
  dba_hist_osstat s1t1,
  dba_hist_osstat s17t0,        -- USER_TIME
  dba_hist_osstat s17t1,
  dba_hist_osstat s18t0,        -- SYS_TIME
  dba_hist_osstat s18t1,
  dba_hist_osstat s19t0,        -- IOWAIT_TIME
  dba_hist_osstat s19t1,
  dba_hist_osstat s2t1,         -- osstat just get the end value
  dba_hist_osstat s3t1,         -- osstat just get the end value
  dba_hist_sys_time_model s5t0,
  dba_hist_sys_time_model s5t1,
  dba_hist_sys_time_model s6t0,
  dba_hist_sys_time_model s6t1,
  dba_hist_sys_time_model s7t0,
  dba_hist_sys_time_model s7t1,
  dba_hist_sys_time_model s8t0,
  dba_hist_sys_time_model s8t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s1t0.dbid            = s0.dbid
AND s1t1.dbid            = s0.dbid
AND s2t1.dbid            = s0.dbid
AND s3t1.dbid            = s0.dbid
AND s5t0.dbid            = s0.dbid
AND s5t1.dbid            = s0.dbid
AND s6t0.dbid            = s0.dbid
AND s6t1.dbid            = s0.dbid
AND s7t0.dbid            = s0.dbid
AND s7t1.dbid            = s0.dbid
AND s8t0.dbid            = s0.dbid
AND s8t1.dbid            = s0.dbid
AND s17t0.dbid            = s0.dbid
AND s17t1.dbid            = s0.dbid
AND s18t0.dbid            = s0.dbid
AND s18t1.dbid            = s0.dbid
AND s19t0.dbid            = s0.dbid
AND s19t1.dbid            = s0.dbid
--AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s1t0.instance_number = s0.instance_number
AND s1t1.instance_number = s0.instance_number
AND s2t1.instance_number = s0.instance_number
AND s3t1.instance_number = s0.instance_number
AND s5t0.instance_number = s0.instance_number
AND s5t1.instance_number = s0.instance_number
AND s6t0.instance_number = s0.instance_number
AND s6t1.instance_number = s0.instance_number
AND s7t0.instance_number = s0.instance_number
AND s7t1.instance_number = s0.instance_number
AND s8t0.instance_number = s0.instance_number
AND s8t1.instance_number = s0.instance_number
AND s17t0.instance_number = s0.instance_number
AND s17t1.instance_number = s0.instance_number
AND s18t0.instance_number = s0.instance_number
AND s18t1.instance_number = s0.instance_number
AND s19t0.instance_number = s0.instance_number
AND s19t1.instance_number = s0.instance_number
AND s1.snap_id           = s0.snap_id + 1
AND s1t0.snap_id         = s0.snap_id
AND s1t1.snap_id         = s0.snap_id + 1
AND s2t1.snap_id         = s0.snap_id + 1
AND s3t1.snap_id         = s0.snap_id + 1
AND s5t0.snap_id         = s0.snap_id
AND s5t1.snap_id         = s0.snap_id + 1
AND s6t0.snap_id         = s0.snap_id
AND s6t1.snap_id         = s0.snap_id + 1
AND s7t0.snap_id         = s0.snap_id
AND s7t1.snap_id         = s0.snap_id + 1
AND s8t0.snap_id         = s0.snap_id
AND s8t1.snap_id         = s0.snap_id + 1
AND s17t0.snap_id         = s0.snap_id
AND s17t1.snap_id         = s0.snap_id + 1
AND s18t0.snap_id         = s0.snap_id
AND s18t1.snap_id         = s0.snap_id + 1
AND s19t0.snap_id         = s0.snap_id
AND s19t1.snap_id         = s0.snap_id + 1
AND s1t0.stat_name       = 'BUSY_TIME'
AND s1t1.stat_name       = s1t0.stat_name
AND s17t0.stat_name       = 'USER_TIME'
AND s17t1.stat_name       = s17t0.stat_name
AND s18t0.stat_name       = 'SYS_TIME'
AND s18t1.stat_name       = s18t0.stat_name
AND s19t0.stat_name       = 'IOWAIT_TIME'
AND s19t1.stat_name       = s19t0.stat_name
AND s2t1.stat_name       = 'LOAD'
AND s3t1.stat_name       = 'NUM_CPUS'
AND s5t0.stat_name       = 'DB time'
AND s5t1.stat_name       = s5t0.stat_name
AND s6t0.stat_name       = 'DB CPU'
AND s6t1.stat_name       = s6t0.stat_name
AND s7t0.stat_name       = 'background cpu time'
AND s7t1.stat_name       = s7t0.stat_name
AND s8t0.stat_name       = 'RMAN cpu time (backup/restore)'
AND s8t1.stat_name       = s8t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (336)
-- aas > 1
-- oracpupct > 50
-- oscpupct > 50
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
''For Exadata, make use of the following formulas to create Calculated Fields in Tableau, this already accounts for "ASM Normal redundancy" (see * 2), change it to * 3 for High redundancy'' also check this blog post for more on ASM redundancy effect on performance http://karlarao.wordpress.com/2012/06/29/the-effect-of-asm-redundancyparity-on-readwrite-iops-slob-test-case-for-exadata-and-non-exa-environments/
{{{
Flash IOPS       ((SIORS+MIORS) + ((SIOWS+MIOWS+IOREDO) * 2)) * ([FLASHCACHE] * .01)
Flash RIOPS      (SIORS+MIORS) * ([FLASHCACHE] *.01)
Flash WIOPS      ((SIOWS+MIOWS+IOREDO) * 2) * ([FLASHCACHE] * .01)
HD IOPS          ((SIORS+MIORS) + ((SIOWS+MIOWS+IOREDO) * 2)) * ((100 - [FLASHCACHE]) * .01)
HD RIOPS         (SIORS+MIORS) * ((100 - [FLASHCACHE]) * .01)
HD WIOPS         (((SIOWS+MIOWS+IOREDO) * 2)) * ((100 - [FLASHCACHE]) * .01)
}}}
* note, if you see way more cell flash cache read hits than physical read total IO requests then it's accumulating both the reads & writes in the same metric, the effect of this is the above formula will have negative values on the HD IOPS, to fix this create a calculated field on the FLASHCACHE measure, read more about this behavior here http://blog.tanelpoder.com/2013/12/04/cell-flash-cache-read-hits-vs-cell-writes-to-flash-cache-statistics-on-exadata/
{{{
name the calculated field as FLASHCACHE2 then just do a find/replace on the formula above
IF [FLASHCACHE] > 100 THEN 100 ELSE [FLASHCACHE] END
}}}

''Then generate the following graphs''
1) Flash vs HD IOPS
2) Flash vs HD IOPS with read/write breakdown
3) IO throughput read/write MB/s
4) Polynomial Regression (Degree 4)

''For non-Exadata just use the following formula to get the total IOPS, name the Calculated Filed as ALL_IOPS''
{{{
(SIORS+MIORS) + (SIOWS+MIOWS+IOREDO)
}}}

Here are some more examples on ''Different views of IO performance with AWR data'' check the full details on this link http://goo.gl/i660CZ 
I also mentioned about this tiddler last OakTable World 2013 http://www.slideshare.net/karlarao/o-2013-ultimate-exadata-io-monitoring-flash-harddisk-write-back-cache-overhead

SECTION 1: USER IO wait class and cell single block reads latency with curve fitting
SECTION 2: Small IOPS vs Large IOPS
SECTION 3: Flash vs HD IOPS
SECTION 4: Flash vs HD IOPS with read/write breakdown
SECTION 5: IO throughput read/write MB/s
SECTION 6: Drill down on smart scans affecting cell single block latency on 24hour period 


{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname       format a15              heading instname            -- instname
col hostname       format a30              heading hostname            -- hostname
col tm             format a17              heading tm                  -- "tm"
col id             format 99999            heading id                  -- "snapid"
col inst           format 90               heading inst                -- "inst"
col dur            format 999990.00        heading dur                 -- "dur"
col cpu            format 90               heading cpu                 -- "cpu"
col cap            format 9999990.00       heading cap                 -- "capacity"
col dbt            format 999990.00        heading dbt                 -- "DBTime"
col dbc            format 99990.00         heading dbc                 -- "DBcpu"
col bgc            format 99990.00         heading bgc                 -- "BGcpu"
col rman           format 9990.00          heading rman                -- "RMANcpu"
col aas            format 990.0            heading aas                 -- "AAS"
col totora         format 9999990.00       heading totora              -- "TotalOracleCPU"
col busy           format 9999990.00       heading busy                -- "BusyTime"
col load           format 990.00           heading load                -- "OSLoad"
col totos          format 9999990.00       heading totos               -- "TotalOSCPU"
col mem            format 999990.00        heading mem                 -- "PhysicalMemorymb"
col IORs           format 99990.000        heading IORs                -- "IOPsr"
col IOWs           format 99990.000        heading IOWs                -- "IOPsw"
col IORedo         format 99990.000        heading IORedo              -- "IOPsredo"
col IORmbs         format 99990.000        heading IORmbs              -- "IOrmbs"
col IOWmbs         format 99990.000        heading IOWmbs              -- "IOwmbs"
col redosizesec    format 99990.000        heading redosizesec         -- "Redombs"
col logons         format 990              heading logons              -- "Sess"
col logone         format 990              heading logone              -- "SessEnd"
col exsraw         format 99990.000        heading exsraw              -- "Execrawdelta"
col exs            format 9990.000         heading exs                 -- "Execs"
col oracpupct      format 990              heading oracpupct           -- "OracleCPUPct"
col rmancpupct     format 990              heading rmancpupct          -- "RMANCPUPct"
col oscpupct       format 990              heading oscpupct            -- "OSCPUPct"
col oscpuusr       format 990              heading oscpuusr            -- "USRPct"
col oscpusys       format 990              heading oscpusys            -- "SYSPct"
col oscpuio        format 990              heading oscpuio             -- "IOPct"
col SIORs          format 99990.000        heading SIORs               -- "IOPsSingleBlockr"
col MIORs          format 99990.000        heading MIORs               -- "IOPsMultiBlockr"
col TIORmbs        format 99990.000        heading TIORmbs             -- "Readmbs"
col SIOWs          format 99990.000        heading SIOWs               -- "IOPsSingleBlockw"
col MIOWs          format 99990.000        heading MIOWs               -- "IOPsMultiBlockw"
col TIOWmbs        format 99990.000        heading TIOWmbs             -- "Writembs"
col TIOR           format 99990.000        heading TIOR                -- "TotalIOPsr"
col TIOW           format 99990.000        heading TIOW                -- "TotalIOPsw"
col TIOALL         format 99990.000        heading TIOALL              -- "TotalIOPsALL"
col ALLRmbs        format 99990.000        heading ALLRmbs             -- "TotalReadmbs"
col ALLWmbs        format 99990.000        heading ALLWmbs             -- "TotalWritembs"
col GRANDmbs       format 99990.000        heading GRANDmbs            -- "TotalmbsALL"
col readratio      format 990              heading readratio           -- "ReadRatio"
col writeratio     format 990              heading writeratio          -- "WriteRatio"
col diskiops       format 99990.000        heading diskiops            -- "HWDiskIOPs"
col numdisks       format 99990.000        heading numdisks            -- "HWNumofDisks"
col flashcache     format 990              heading flashcache          -- "FlashCacheHitsPct"
col cellpiob       format 99990.000        heading cellpiob            -- "CellPIOICmbs"
col cellpiobss     format 99990.000        heading cellpiobss          -- "CellPIOICSmartScanmbs"
col cellpiobpreoff format 99990.000        heading cellpiobpreoff      -- "CellPIOpredoffloadmbs"
col cellpiobsi     format 99990.000        heading cellpiobsi          -- "CellPIOstorageindexmbs"
col celliouncomb   format 99990.000        heading celliouncomb        -- "CellIOuncompmbs"
col cellpiobs      format 99990.000        heading cellpiobs           -- "CellPIOsavedfilecreationmbs"
col cellpiobsrman  format 99990.000        heading cellpiobsrman       -- "CellPIOsavedRMANfilerestorembs"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
         s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
   (((s20t1.value - s20t0.value) - (s21t1.value - s21t0.value)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as SIORs,
   ((s21t1.value - s21t0.value) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as MIORs,
   (((s22t1.value - s22t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as TIORmbs,
   (((s23t1.value - s23t0.value) - (s24t1.value - s24t0.value)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as SIOWs,
   ((s24t1.value - s24t0.value) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as MIOWs,
   (((s25t1.value - s25t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as TIOWmbs,
   ((s13t1.value - s13t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as IORedo, 
   (((s14t1.value - s14t0.value)/1024/1024)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as redosizesec,
    ((s33t1.value - s33t0.value) / (s20t1.value - s20t0.value))*100 as flashcache,
   (((s26t1.value - s26t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiob,
   (((s31t1.value - s31t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobss,
   (((s29t1.value - s29t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobpreoff,
   (((s30t1.value - s30t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobsi,
   (((s32t1.value - s32t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as celliouncomb,
   (((s27t1.value - s27t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobs,
   (((s28t1.value - s28t0.value)/1024/1024) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as cellpiobsrman
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_sysstat s13t0,       -- redo writes, diffed
  dba_hist_sysstat s13t1,
  dba_hist_sysstat s14t0,       -- redo size, diffed
  dba_hist_sysstat s14t1,
  dba_hist_sysstat s20t0,       -- physical read total IO requests, diffed
  dba_hist_sysstat s20t1,
  dba_hist_sysstat s21t0,       -- physical read total multi block requests, diffed
  dba_hist_sysstat s21t1,  
  dba_hist_sysstat s22t0,       -- physical read total bytes, diffed
  dba_hist_sysstat s22t1,  
  dba_hist_sysstat s23t0,       -- physical write total IO requests, diffed
  dba_hist_sysstat s23t1,
  dba_hist_sysstat s24t0,       -- physical write total multi block requests, diffed
  dba_hist_sysstat s24t1,
  dba_hist_sysstat s25t0,       -- physical write total bytes, diffed
  dba_hist_sysstat s25t1,
  dba_hist_sysstat s26t0,       -- cell physical IO interconnect bytes, diffed, cellpiob
  dba_hist_sysstat s26t1,
  dba_hist_sysstat s27t0,       -- cell physical IO bytes saved during optimized file creation, diffed, cellpiobs
  dba_hist_sysstat s27t1,
  dba_hist_sysstat s28t0,       -- cell physical IO bytes saved during optimized RMAN file restore, diffed, cellpiobsrman
  dba_hist_sysstat s28t1,
  dba_hist_sysstat s29t0,       -- cell physical IO bytes eligible for predicate offload, diffed, cellpiobpreoff
  dba_hist_sysstat s29t1,
  dba_hist_sysstat s30t0,       -- cell physical IO bytes saved by storage index, diffed, cellpiobsi
  dba_hist_sysstat s30t1,
  dba_hist_sysstat s31t0,       -- cell physical IO interconnect bytes returned by smart scan, diffed, cellpiobss
  dba_hist_sysstat s31t1,
  dba_hist_sysstat s32t0,       -- cell IO uncompressed bytes, diffed, celliouncomb
  dba_hist_sysstat s32t1,
  dba_hist_sysstat s33t0,       -- cell flash cache read hits
  dba_hist_sysstat s33t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s13t0.dbid            = s0.dbid
AND s13t1.dbid            = s0.dbid
AND s14t0.dbid            = s0.dbid
AND s14t1.dbid            = s0.dbid
AND s20t0.dbid            = s0.dbid
AND s20t1.dbid            = s0.dbid
AND s21t0.dbid            = s0.dbid
AND s21t1.dbid            = s0.dbid
AND s22t0.dbid            = s0.dbid
AND s22t1.dbid            = s0.dbid
AND s23t0.dbid            = s0.dbid
AND s23t1.dbid            = s0.dbid
AND s24t0.dbid            = s0.dbid
AND s24t1.dbid            = s0.dbid
AND s25t0.dbid            = s0.dbid
AND s25t1.dbid            = s0.dbid
AND s26t0.dbid            = s0.dbid
AND s26t1.dbid            = s0.dbid
AND s27t0.dbid            = s0.dbid
AND s27t1.dbid            = s0.dbid
AND s28t0.dbid            = s0.dbid
AND s28t1.dbid            = s0.dbid
AND s29t0.dbid            = s0.dbid
AND s29t1.dbid            = s0.dbid
AND s30t0.dbid            = s0.dbid
AND s30t1.dbid            = s0.dbid
AND s31t0.dbid            = s0.dbid
AND s31t1.dbid            = s0.dbid
AND s32t0.dbid            = s0.dbid
AND s32t1.dbid            = s0.dbid
AND s33t0.dbid            = s0.dbid
AND s33t1.dbid            = s0.dbid
--AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s13t0.instance_number = s0.instance_number
AND s13t1.instance_number = s0.instance_number
AND s14t0.instance_number = s0.instance_number
AND s14t1.instance_number = s0.instance_number
AND s20t0.instance_number = s0.instance_number
AND s20t1.instance_number = s0.instance_number
AND s21t0.instance_number = s0.instance_number
AND s21t1.instance_number = s0.instance_number
AND s22t0.instance_number = s0.instance_number
AND s22t1.instance_number = s0.instance_number
AND s23t0.instance_number = s0.instance_number
AND s23t1.instance_number = s0.instance_number
AND s24t0.instance_number = s0.instance_number
AND s24t1.instance_number = s0.instance_number
AND s25t0.instance_number = s0.instance_number
AND s25t1.instance_number = s0.instance_number
AND s26t0.instance_number = s0.instance_number
AND s26t1.instance_number = s0.instance_number
AND s27t0.instance_number = s0.instance_number
AND s27t1.instance_number = s0.instance_number
AND s28t0.instance_number = s0.instance_number
AND s28t1.instance_number = s0.instance_number
AND s29t0.instance_number = s0.instance_number
AND s29t1.instance_number = s0.instance_number
AND s30t0.instance_number = s0.instance_number
AND s30t1.instance_number = s0.instance_number
AND s31t0.instance_number = s0.instance_number
AND s31t1.instance_number = s0.instance_number
AND s32t0.instance_number = s0.instance_number
AND s32t1.instance_number = s0.instance_number
AND s33t0.instance_number = s0.instance_number
AND s33t1.instance_number = s0.instance_number
AND s1.snap_id            = s0.snap_id + 1
AND s13t0.snap_id         = s0.snap_id
AND s13t1.snap_id         = s0.snap_id + 1
AND s14t0.snap_id         = s0.snap_id
AND s14t1.snap_id         = s0.snap_id + 1
AND s20t0.snap_id         = s0.snap_id
AND s20t1.snap_id         = s0.snap_id + 1
AND s21t0.snap_id         = s0.snap_id
AND s21t1.snap_id         = s0.snap_id + 1
AND s22t0.snap_id         = s0.snap_id
AND s22t1.snap_id         = s0.snap_id + 1
AND s23t0.snap_id         = s0.snap_id
AND s23t1.snap_id         = s0.snap_id + 1
AND s24t0.snap_id         = s0.snap_id
AND s24t1.snap_id         = s0.snap_id + 1
AND s25t0.snap_id         = s0.snap_id
AND s25t1.snap_id         = s0.snap_id + 1
AND s26t0.snap_id         = s0.snap_id
AND s26t1.snap_id         = s0.snap_id + 1
AND s27t0.snap_id         = s0.snap_id
AND s27t1.snap_id         = s0.snap_id + 1
AND s28t0.snap_id         = s0.snap_id
AND s28t1.snap_id         = s0.snap_id + 1
AND s29t0.snap_id         = s0.snap_id
AND s29t1.snap_id         = s0.snap_id + 1
AND s30t0.snap_id         = s0.snap_id
AND s30t1.snap_id         = s0.snap_id + 1
AND s31t0.snap_id         = s0.snap_id
AND s31t1.snap_id         = s0.snap_id + 1
AND s32t0.snap_id         = s0.snap_id
AND s32t1.snap_id         = s0.snap_id + 1
AND s33t0.snap_id         = s0.snap_id
AND s33t1.snap_id         = s0.snap_id + 1
AND s13t0.stat_name       = 'redo writes'
AND s13t1.stat_name       = s13t0.stat_name
AND s14t0.stat_name       = 'redo size'
AND s14t1.stat_name       = s14t0.stat_name
AND s20t0.stat_name       = 'physical read total IO requests'
AND s20t1.stat_name       = s20t0.stat_name
AND s21t0.stat_name       = 'physical read total multi block requests'
AND s21t1.stat_name       = s21t0.stat_name
AND s22t0.stat_name       = 'physical read total bytes'
AND s22t1.stat_name       = s22t0.stat_name
AND s23t0.stat_name       = 'physical write total IO requests'
AND s23t1.stat_name       = s23t0.stat_name
AND s24t0.stat_name       = 'physical write total multi block requests'
AND s24t1.stat_name       = s24t0.stat_name
AND s25t0.stat_name       = 'physical write total bytes'
AND s25t1.stat_name       = s25t0.stat_name
AND s26t0.stat_name       = 'cell physical IO interconnect bytes'
AND s26t1.stat_name       = s26t0.stat_name
AND s27t0.stat_name       = 'cell physical IO bytes saved during optimized file creation'
AND s27t1.stat_name       = s27t0.stat_name
AND s28t0.stat_name       = 'cell physical IO bytes saved during optimized RMAN file restore'
AND s28t1.stat_name       = s28t0.stat_name
AND s29t0.stat_name       = 'cell physical IO bytes eligible for predicate offload'
AND s29t1.stat_name       = s29t0.stat_name
AND s30t0.stat_name       = 'cell physical IO bytes saved by storage index'
AND s30t1.stat_name       = s30t0.stat_name
AND s31t0.stat_name       = 'cell physical IO interconnect bytes returned by smart scan'
AND s31t1.stat_name       = s31t0.stat_name
AND s32t0.stat_name       = 'cell IO uncompressed bytes'
AND s32t1.stat_name       = s32t0.stat_name
AND s33t0.stat_name       = 'cell flash cache read hits'
AND s33t1.stat_name       = s33t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (338)
-- aas > 1
-- oscpuio > 50
-- rmancpupct > 0
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
this SQL only pulls the following info for non-Exadata environments
-- redo writes
-- redo size
-- physical read total IO requests
-- physical read total multi block requests
-- physical write total IO requests
-- physical write total multi block requests

{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname       format a15              heading instname            -- instname
col hostname       format a30              heading hostname            -- hostname
col tm             format a17              heading tm                  -- "tm"
col id             format 99999            heading id                  -- "snapid"
col inst           format 90               heading inst                -- "inst"
col dur            format 999990.00        heading dur                 -- "dur"
col cpu            format 90               heading cpu                 -- "cpu"
col cap            format 9999990.00       heading cap                 -- "capacity"
col dbt            format 999990.00        heading dbt                 -- "DBTime"
col dbc            format 99990.00         heading dbc                 -- "DBcpu"
col bgc            format 99990.00         heading bgc                 -- "BGcpu"
col rman           format 9990.00          heading rman                -- "RMANcpu"
col aas            format 990.0            heading aas                 -- "AAS"
col totora         format 9999990.00       heading totora              -- "TotalOracleCPU"
col busy           format 9999990.00       heading busy                -- "BusyTime"
col load           format 990.00           heading load                -- "OSLoad"
col totos          format 9999990.00       heading totos               -- "TotalOSCPU"
col mem            format 999990.00        heading mem                 -- "PhysicalMemorymb"
col IORs           format 99990.000        heading IORs                -- "IOPsr"
col IOWs           format 99990.000        heading IOWs                -- "IOPsw"
col IORedo         format 99990.000        heading IORedo              -- "IOPsredo"
col IORmbs         format 99990.000        heading IORmbs              -- "IOrmbs"
col IOWmbs         format 99990.000        heading IOWmbs              -- "IOwmbs"
col redosizesec    format 99990.000        heading redosizesec         -- "Redombs"
col logons         format 990              heading logons              -- "Sess"
col logone         format 990              heading logone              -- "SessEnd"
col exsraw         format 99990.000        heading exsraw              -- "Execrawdelta"
col exs            format 9990.000         heading exs                 -- "Execs"
col oracpupct      format 990              heading oracpupct           -- "OracleCPUPct"
col rmancpupct     format 990              heading rmancpupct          -- "RMANCPUPct"
col oscpupct       format 990              heading oscpupct            -- "OSCPUPct"
col oscpuusr       format 990              heading oscpuusr            -- "USRPct"
col oscpusys       format 990              heading oscpusys            -- "SYSPct"
col oscpuio        format 990              heading oscpuio             -- "IOPct"
col SIORs          format 99990.000        heading SIORs               -- "IOPsSingleBlockr"
col MIORs          format 99990.000        heading MIORs               -- "IOPsMultiBlockr"
col TIORmbs        format 99990.000        heading TIORmbs             -- "Readmbs"
col SIOWs          format 99990.000        heading SIOWs               -- "IOPsSingleBlockw"
col MIOWs          format 99990.000        heading MIOWs               -- "IOPsMultiBlockw"
col TIOWmbs        format 99990.000        heading TIOWmbs             -- "Writembs"
col TIOR           format 99990.000        heading TIOR                -- "TotalIOPsr"
col TIOW           format 99990.000        heading TIOW                -- "TotalIOPsw"
col TIOALL         format 99990.000        heading TIOALL              -- "TotalIOPsALL"
col ALLRmbs        format 99990.000        heading ALLRmbs             -- "TotalReadmbs"
col ALLWmbs        format 99990.000        heading ALLWmbs             -- "TotalWritembs"
col GRANDmbs       format 99990.000        heading GRANDmbs            -- "TotalmbsALL"
col readratio      format 990              heading readratio           -- "ReadRatio"
col writeratio     format 990              heading writeratio          -- "WriteRatio"
col diskiops       format 99990.000        heading diskiops            -- "HWDiskIOPs"
col numdisks       format 99990.000        heading numdisks            -- "HWNumofDisks"
col flashcache     format 990              heading flashcache          -- "FlashCacheHitsPct"
col cellpiob       format 99990.000        heading cellpiob            -- "CellPIOICmbs"
col cellpiobss     format 99990.000        heading cellpiobss          -- "CellPIOICSmartScanmbs"
col cellpiobpreoff format 99990.000        heading cellpiobpreoff      -- "CellPIOpredoffloadmbs"
col cellpiobsi     format 99990.000        heading cellpiobsi          -- "CellPIOstorageindexmbs"
col celliouncomb   format 99990.000        heading celliouncomb        -- "CellIOuncompmbs"
col cellpiobs      format 99990.000        heading cellpiobs           -- "CellPIOsavedfilecreationmbs"
col cellpiobsrman  format 99990.000        heading cellpiobsrman       -- "CellPIOsavedRMANfilerestorembs"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
         s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
   (((s20t1.value - s20t0.value) - (s21t1.value - s21t0.value)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as SIORs,
   ((s21t1.value - s21t0.value) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as MIORs,
   (((s23t1.value - s23t0.value) - (s24t1.value - s24t0.value)) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as SIOWs,
   ((s24t1.value - s24t0.value) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as MIOWs,
   ((s13t1.value - s13t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as IORedo, 
   (((s14t1.value - s14t0.value)/1024/1024)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as redosizesec
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_sysstat s13t0,       -- redo writes, diffed
  dba_hist_sysstat s13t1,
  dba_hist_sysstat s14t0,       -- redo size, diffed
  dba_hist_sysstat s14t1,
  dba_hist_sysstat s20t0,       -- physical read total IO requests, diffed
  dba_hist_sysstat s20t1,
  dba_hist_sysstat s21t0,       -- physical read total multi block requests, diffed
  dba_hist_sysstat s21t1,  
  dba_hist_sysstat s23t0,       -- physical write total IO requests, diffed
  dba_hist_sysstat s23t1,
  dba_hist_sysstat s24t0,       -- physical write total multi block requests, diffed
  dba_hist_sysstat s24t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s13t0.dbid            = s0.dbid
AND s13t1.dbid            = s0.dbid
AND s14t0.dbid            = s0.dbid
AND s14t1.dbid            = s0.dbid
AND s20t0.dbid            = s0.dbid
AND s20t1.dbid            = s0.dbid
AND s21t0.dbid            = s0.dbid
AND s21t1.dbid            = s0.dbid
AND s23t0.dbid            = s0.dbid
AND s23t1.dbid            = s0.dbid
AND s24t0.dbid            = s0.dbid
AND s24t1.dbid            = s0.dbid
--AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s13t0.instance_number = s0.instance_number
AND s13t1.instance_number = s0.instance_number
AND s14t0.instance_number = s0.instance_number
AND s14t1.instance_number = s0.instance_number
AND s20t0.instance_number = s0.instance_number
AND s20t1.instance_number = s0.instance_number
AND s21t0.instance_number = s0.instance_number
AND s21t1.instance_number = s0.instance_number
AND s23t0.instance_number = s0.instance_number
AND s23t1.instance_number = s0.instance_number
AND s24t0.instance_number = s0.instance_number
AND s24t1.instance_number = s0.instance_number
AND s1.snap_id            = s0.snap_id + 1
AND s13t0.snap_id         = s0.snap_id
AND s13t1.snap_id         = s0.snap_id + 1
AND s14t0.snap_id         = s0.snap_id
AND s14t1.snap_id         = s0.snap_id + 1
AND s20t0.snap_id         = s0.snap_id
AND s20t1.snap_id         = s0.snap_id + 1
AND s21t0.snap_id         = s0.snap_id
AND s21t1.snap_id         = s0.snap_id + 1
AND s23t0.snap_id         = s0.snap_id
AND s23t1.snap_id         = s0.snap_id + 1
AND s24t0.snap_id         = s0.snap_id
AND s24t1.snap_id         = s0.snap_id + 1
AND s13t0.stat_name       = 'redo writes'
AND s13t1.stat_name       = s13t0.stat_name
AND s14t0.stat_name       = 'redo size'
AND s14t1.stat_name       = s14t0.stat_name
AND s20t0.stat_name       = 'physical read total IO requests'
AND s20t1.stat_name       = s20t0.stat_name
AND s21t0.stat_name       = 'physical read total multi block requests'
AND s21t1.stat_name       = s21t0.stat_name
AND s23t0.stat_name       = 'physical write total IO requests'
AND s23t1.stat_name       = s23t0.stat_name
AND s24t0.stat_name       = 'physical write total multi block requests'
AND s24t1.stat_name       = s24t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (338)
-- aas > 1
-- oscpuio > 50
-- rmancpupct > 0
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
{{{
set arraysize 5000

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Services Statistics Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15
col hostname    format a30
col tm          format a15              heading tm           --"Snap|Start|Time"
col id          format 99999            heading id           --"Snap|ID"
col inst        format 90               heading inst         --"i|n|s|t|#"
col dur         format 999990.00        heading dur          --"Snap|Dur|(m)"
col cpu         format 90               heading cpu          --"C|P|U"
col cap         format 9999990.00       heading cap          --"***|Total|CPU|Time|(s)"
col dbt         format 999990.00        heading dbt          --"DB|Time"
col dbc         format 99990.00         heading dbc          --"DB|CPU"
col bgc         format 99990.00         heading bgc          --"Bg|CPU"
col rman        format 9990.00          heading rman         --"RMAN|CPU"
col aas         format 990.0            heading aas          --"A|A|S"
col totora      format 9999990.00       heading totora       --"***|Total|Oracle|CPU|(s)"
col busy        format 9999990.00       heading busy         --"Busy|Time"
col load        format 990.00           heading load         --"OS|Load"
col totos       format 9999990.00       heading totos        --"***|Total|OS|CPU|(s)"
col mem         format 999990.00        heading mem          --"Physical|Memory|(mb)"
col IORs        format 9990.000         heading IORs         --"IOPs|r"
col IOWs        format 9990.000         heading IOWs         --"IOPs|w"
col IORedo      format 9990.000         heading IORedo       --"IOPs|redo"
col IORmbs      format 9990.000         heading IORmbs       --"IO r|(mb)/s"
col IOWmbs      format 9990.000         heading IOWmbs       --"IO w|(mb)/s"
col redosizesec format 9990.000         heading redosizesec  --"Redo|(mb)/s"
col logons      format 990              heading logons       --"Sess"
col logone      format 990              heading logone       --"Sess|End"
col exsraw      format 99990.000        heading exsraw       --"Exec|raw|delta"
col exs         format 9990.000         heading exs          --"Exec|/s"
col oracpupct   format 990              heading oracpupct    --"Oracle|CPU|%"
col rmancpupct  format 990              heading rmancpupct   --"RMAN|CPU|%"
col oscpupct    format 990              heading oscpupct     --"OS|CPU|%"
col oscpuusr    format 990              heading oscpuusr     --"U|S|R|%"
col oscpusys    format 990              heading oscpusys     --"S|Y|S|%"
col oscpuio     format 990              heading oscpuio      --"I|O|%"
col phy_reads   format 99999990.00      heading phy_reads    --"physical|reads"
col log_reads   format 99999990.00      heading log_reads    --"logical|reads"

select  trim('&_instname') instname, trim('&_dbid') db_id, trim('&_hostname') hostname, snap_id,
        TO_CHAR(tm,'MM/DD/YY HH24:MI:SS') tm, 
        inst,
        dur,
        service_name, 
        round(db_time / 1000000, 1) as dbt, 
        round(db_cpu  / 1000000, 1) as dbc,
        phy_reads, 
        log_reads,
        aas
 from (select 
          s1.snap_id,
          s1.tm,
          s1.inst,
          s1.dur,
          s1.service_name, 
          sum(decode(s1.stat_name, 'DB time', s1.diff, 0)) db_time,
          sum(decode(s1.stat_name, 'DB CPU',  s1.diff, 0)) db_cpu,
          sum(decode(s1.stat_name, 'physical reads', s1.diff, 0)) phy_reads,
          sum(decode(s1.stat_name, 'session logical reads', s1.diff, 0)) log_reads,
          round(sum(decode(s1.stat_name, 'DB time', s1.diff, 0))/1000000,1)/60 / s1.dur as aas
   from
     (select s0.snap_id snap_id,
             s0.END_INTERVAL_TIME tm,
             s0.instance_number inst,
            round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
             e.service_name     service_name, 
             e.stat_name        stat_name, 
             e.value - b.value  diff
       from dba_hist_snapshot s0,
            dba_hist_snapshot s1,
            dba_hist_service_stat b,
            dba_hist_service_stat e
       where 
         s0.dbid                  = &_dbid            -- CHANGE THE DBID HERE!
         and s1.dbid              = s0.dbid
         and b.dbid               = s0.dbid
         and e.dbid               = s0.dbid
         --and s0.instance_number   = &_instancenumber  -- CHANGE THE INSTANCE_NUMBER HERE!
         and s1.instance_number   = s0.instance_number
         and b.instance_number    = s0.instance_number
         and e.instance_number    = s0.instance_number
         and s1.snap_id           = s0.snap_id + 1
         and b.snap_id            = s0.snap_id
         and e.snap_id            = s0.snap_id + 1
         and b.stat_id            = e.stat_id
         and b.service_name_hash  = e.service_name_hash) s1
   group by 
     s1.snap_id, s1.tm, s1.inst, s1.dur, s1.service_name
   order by 
     snap_id asc, aas desc, service_name)
-- where 
-- AND TO_CHAR(tm,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- snap_id = 338
-- and snap_id >= 335 and snap_id <= 339
-- aas > .5
;
}}}
to derive the transactions/seconds put this as a calculated field in Tableau
{{{
TRX = (UCOMS + URS) / DUR 
}}}

{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR CPU and IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              heading instname        -- instname
col hostname    format a30              heading hostname        -- hostname
col tm          format a17              heading tm              -- "tm"
col id          format 99999            heading id              -- "snapid"
col inst        format 90               heading inst            -- "inst"
col dur         format 999990.00        heading dur             -- "dur"
col cpu         format 90               heading cpu             -- "cpu"
col cap         format 9999990.00       heading cap             -- "capacity"
col dbt         format 999990.00        heading dbt             -- "DBTime"
col dbc         format 99990.00         heading dbc             -- "DBcpu"
col bgc         format 99990.00         heading bgc             -- "BGcpu"
col rman        format 9990.00          heading rman            -- "RMANcpu"
col aas         format 990.0            heading aas             -- "AAS"
col totora      format 9999990.00       heading totora          -- "TotalOracleCPU"
col busy        format 9999990.00       heading busy            -- "BusyTime"
col load        format 990.00           heading load            -- "OSLoad"
col totos       format 9999990.00       heading totos           -- "TotalOSCPU"
col mem         format 999990.00        heading mem             -- "PhysicalMemorymb"
col IORs        format 9990.000         heading IORs            -- "IOPsr"
col IOWs        format 9990.000         heading IOWs            -- "IOPsw"
col IORedo      format 9990.000         heading IORedo          -- "IOPsredo"
col IORmbs      format 9990.000         heading IORmbs          -- "IOrmbs"
col IOWmbs      format 9990.000         heading IOWmbs          -- "IOwmbs"
col redosizesec format 9990.000         heading redosizesec     -- "Redombs"
col logons      format 990              heading logons          -- "Sess"
col logone      format 990              heading logone          -- "SessEnd"
col exsraw      format 99990.000        heading exsraw          -- "Execrawdelta"
col exs         format 9990.000         heading exs             -- "Execs"
col ucs         format 9990.000         heading ucs             -- "UserCalls"
col ucoms       format 9990.000         heading ucoms           -- "Commit"
col urs         format 9990.000         heading urs             -- "Rollback"
col lios        format 9999990.00       heading lios            -- "LIOs"
col oracpupct   format 990              heading oracpupct       -- "OracleCPUPct"
col rmancpupct  format 990              heading rmancpupct      -- "RMANCPUPct"
col oscpupct    format 990              heading oscpupct        -- "OSCPUPct"
col oscpuusr    format 990              heading oscpuusr        -- "USRPct"
col oscpusys    format 990              heading oscpusys        -- "SYSPct"
col oscpuio     format 990              heading oscpuio         -- "IOPct"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
          s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
  round(s4t1.value/1024/1024/1024,2) AS memgb,
  round(s37t1.value/1024/1024/1024,2) AS sgagb,
  round(s36t1.value/1024/1024/1024,2) AS pgagb,
     s9t0.value logons, 
   ((s10t1.value - s10t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as exs, 
   ((s40t1.value - s40t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as ucs, 
   ((s38t1.value - s38t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as ucoms, 
   ((s39t1.value - s39t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as urs,
   ((s41t1.value - s41t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as lios
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_osstat s4t1,         -- osstat just get the end value 
  (select snap_id, dbid, instance_number, sum(value) value from dba_hist_sga group by snap_id, dbid, instance_number) s37t1, -- total SGA allocated, just get the end value
  dba_hist_pgastat s36t1,		-- total PGA allocated, just get the end value 
  dba_hist_sysstat s9t0,        -- logons current, sysstat absolute value should not be diffed
  dba_hist_sysstat s10t0,       -- execute count, diffed
  dba_hist_sysstat s10t1,
  dba_hist_sysstat s38t0,       -- user commits, diffed
  dba_hist_sysstat s38t1,
  dba_hist_sysstat s39t0,       -- user rollbacks, diffed
  dba_hist_sysstat s39t1,
  dba_hist_sysstat s40t0,       -- user calls, diffed
  dba_hist_sysstat s40t1,
  dba_hist_sysstat s41t0,       -- session logical reads, diffed
  dba_hist_sysstat s41t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s4t1.dbid            = s0.dbid
AND s9t0.dbid            = s0.dbid
AND s10t0.dbid            = s0.dbid
AND s10t1.dbid            = s0.dbid
AND s36t1.dbid            = s0.dbid
AND s37t1.dbid            = s0.dbid
AND s38t0.dbid            = s0.dbid
AND s38t1.dbid            = s0.dbid
AND s39t0.dbid            = s0.dbid
AND s39t1.dbid            = s0.dbid
AND s40t0.dbid            = s0.dbid
AND s40t1.dbid            = s0.dbid
AND s41t0.dbid            = s0.dbid
AND s41t1.dbid            = s0.dbid
--AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s4t1.instance_number = s0.instance_number
AND s9t0.instance_number = s0.instance_number
AND s10t0.instance_number = s0.instance_number
AND s10t1.instance_number = s0.instance_number
AND s36t1.instance_number = s0.instance_number
AND s37t1.instance_number = s0.instance_number
AND s38t0.instance_number = s0.instance_number
AND s38t1.instance_number = s0.instance_number
AND s39t0.instance_number = s0.instance_number
AND s39t1.instance_number = s0.instance_number
AND s40t0.instance_number = s0.instance_number
AND s40t1.instance_number = s0.instance_number
AND s41t0.instance_number = s0.instance_number
AND s41t1.instance_number = s0.instance_number
AND s1.snap_id           = s0.snap_id + 1
AND s4t1.snap_id         = s0.snap_id + 1
AND s36t1.snap_id        = s0.snap_id + 1
AND s37t1.snap_id        = s0.snap_id + 1
AND s9t0.snap_id         = s0.snap_id
AND s10t0.snap_id         = s0.snap_id
AND s10t1.snap_id         = s0.snap_id + 1
AND s38t0.snap_id         = s0.snap_id
AND s38t1.snap_id         = s0.snap_id + 1
AND s39t0.snap_id         = s0.snap_id
AND s39t1.snap_id         = s0.snap_id + 1
AND s40t0.snap_id         = s0.snap_id
AND s40t1.snap_id         = s0.snap_id + 1
AND s41t0.snap_id         = s0.snap_id
AND s41t1.snap_id         = s0.snap_id + 1
AND s4t1.stat_name       = 'PHYSICAL_MEMORY_BYTES'
AND s36t1.name           = 'total PGA allocated'
AND s9t0.stat_name       = 'logons current'
AND s10t0.stat_name       = 'execute count'
AND s10t1.stat_name       = s10t0.stat_name
AND s38t0.stat_name       = 'user commits'
AND s38t1.stat_name       = s38t0.stat_name
AND s39t0.stat_name       = 'user rollbacks'
AND s39t1.stat_name       = s39t0.stat_name
AND s40t0.stat_name       = 'user calls'
AND s40t1.stat_name       = s40t0.stat_name
AND s41t0.stat_name       = 'session logical reads'
AND s41t1.stat_name       = s41t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (336)
-- aas > 1
-- oracpupct > 50
-- oscpupct > 50
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
only shows the following 
- 'PHYSICAL_MEMORY_BYTES'
- 'total PGA allocated'
- 'logons current'
- 'execute count'

which is all the data needed to characterize the SGA,PGA requirements of the databases
and characterize the load activity by the metric "execute count" which pretty much drives the trx/s metric
the range of 25K ex/s is a high load OLTP environment 

{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR CPU and IO Workload Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              heading instname        -- instname
col hostname    format a30              heading hostname        -- hostname
col tm          format a17              heading tm              -- "tm"
col id          format 99999            heading id              -- "snapid"
col inst        format 90               heading inst            -- "inst"
col dur         format 999990.00        heading dur             -- "dur"
col cpu         format 90               heading cpu             -- "cpu"
col cap         format 9999990.00       heading cap             -- "capacity"
col dbt         format 999990.00        heading dbt             -- "DBTime"
col dbc         format 99990.00         heading dbc             -- "DBcpu"
col bgc         format 99990.00         heading bgc             -- "BGcpu"
col rman        format 9990.00          heading rman            -- "RMANcpu"
col aas         format 990.0            heading aas             -- "AAS"
col totora      format 9999990.00       heading totora          -- "TotalOracleCPU"
col busy        format 9999990.00       heading busy            -- "BusyTime"
col load        format 990.00           heading load            -- "OSLoad"
col totos       format 9999990.00       heading totos           -- "TotalOSCPU"
col mem         format 999990.00        heading mem             -- "PhysicalMemorymb"
col IORs        format 9990.000         heading IORs            -- "IOPsr"
col IOWs        format 9990.000         heading IOWs            -- "IOPsw"
col IORedo      format 9990.000         heading IORedo          -- "IOPsredo"
col IORmbs      format 9990.000         heading IORmbs          -- "IOrmbs"
col IOWmbs      format 9990.000         heading IOWmbs          -- "IOwmbs"
col redosizesec format 9990.000         heading redosizesec     -- "Redombs"
col logons      format 990              heading logons          -- "Sess"
col logone      format 990              heading logone          -- "SessEnd"
col exsraw      format 99990.000        heading exsraw          -- "Execrawdelta"
col exs         format 9990.000         heading exs             -- "Execs"
col ucs         format 9990.000         heading ucs             -- "UserCalls"
col ucoms       format 9990.000         heading ucoms           -- "Commit"
col urs         format 9990.000         heading urs             -- "Rollback"
col lios        format 9999990.00       heading lios            -- "LIOs"
col oracpupct   format 990              heading oracpupct       -- "OracleCPUPct"
col rmancpupct  format 990              heading rmancpupct      -- "RMANCPUPct"
col oscpupct    format 990              heading oscpupct        -- "OSCPUPct"
col oscpuusr    format 990              heading oscpuusr        -- "USRPct"
col oscpusys    format 990              heading oscpusys        -- "SYSPct"
col oscpuio     format 990              heading oscpuio         -- "IOPct"

SELECT * FROM
( 
  SELECT trim('&_instname') instname, 
         trim('&_dbid') db_id, 
         trim('&_hostname') hostname, 
          s0.snap_id id,
         TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
         s0.instance_number inst,
  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
  round(s4t1.value/1024/1024/1024,2) AS memgb,
  round(s37t1.value/1024/1024/1024,2) AS sgagb,
  round(s36t1.value/1024/1024/1024,2) AS pgagb,
     s9t0.value logons, 
   ((s10t1.value - s10t0.value)  / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                  + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                  + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                  + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60)
    ) as exs
FROM dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  dba_hist_osstat s4t1,         -- osstat just get the end value 
  (select snap_id, dbid, instance_number, sum(value) value from dba_hist_sga group by snap_id, dbid, instance_number) s37t1, -- total SGA allocated, just get the end value
  dba_hist_pgastat s36t1,		-- total PGA allocated, just get the end value 
  dba_hist_sysstat s9t0,        -- logons current, sysstat absolute value should not be diffed
  dba_hist_sysstat s10t0,       -- execute count, diffed
  dba_hist_sysstat s10t1
WHERE s0.dbid            = &_dbid    -- CHANGE THE DBID HERE!
AND s1.dbid              = s0.dbid
AND s4t1.dbid            = s0.dbid
AND s9t0.dbid            = s0.dbid
AND s10t0.dbid            = s0.dbid
AND s10t1.dbid            = s0.dbid
AND s36t1.dbid            = s0.dbid
AND s37t1.dbid            = s0.dbid
--AND s0.instance_number   = &_instancenumber   -- CHANGE THE INSTANCE_NUMBER HERE!
AND s1.instance_number   = s0.instance_number
AND s4t1.instance_number = s0.instance_number
AND s9t0.instance_number = s0.instance_number
AND s10t0.instance_number = s0.instance_number
AND s10t1.instance_number = s0.instance_number
AND s36t1.instance_number = s0.instance_number
AND s37t1.instance_number = s0.instance_number
AND s1.snap_id           = s0.snap_id + 1
AND s4t1.snap_id         = s0.snap_id + 1
AND s36t1.snap_id        = s0.snap_id + 1
AND s37t1.snap_id        = s0.snap_id + 1
AND s9t0.snap_id         = s0.snap_id
AND s10t0.snap_id         = s0.snap_id
AND s10t1.snap_id         = s0.snap_id + 1
AND s4t1.stat_name       = 'PHYSICAL_MEMORY_BYTES'
AND s36t1.name           = 'total PGA allocated'
AND s9t0.stat_name       = 'logons current'
AND s10t0.stat_name       = 'execute count'
AND s10t1.stat_name       = s10t0.stat_name
)
-- WHERE 
-- tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- id  in (select snap_id from (select * from r2toolkit.r2_regression_data union all select * from r2toolkit.r2_outlier_data))
-- id in (336)
-- aas > 1
-- oracpupct > 50
-- oscpupct > 50
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800
-- AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
ORDER BY id ASC;
}}}
{{{
set arraysize 5000

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Top Events Report' skip 2
set pagesize 50000
set linesize 550

col instname    format a15              
col hostname    format a30              
col snap_id     format 99999            heading snap_id       -- "snapid"   
col tm          format a17              heading tm            -- "tm"       
col inst        format 90               heading inst          -- "inst"     
col dur         format 999990.00        heading dur           -- "dur"      
col event       format a55              heading event         -- "Event"    
col event_rank  format 90               heading event_rank    -- "EventRank"
col waits       format 9999999990.00    heading waits         -- "Waits"    
col time        format 9999999990.00    heading time          -- "Timesec"  
col avgwt       format 99990.00         heading avgwt         -- "Avgwtms"  
col pctdbt      format 9990.0           heading pctdbt        -- "DBTimepct"
col aas         format 990.0            heading aas           -- "Aas"      
col wait_class  format a15              heading wait_class    -- "WaitClass"

spool awr_topevents-tableau-&_instname-&_hostname..csv
select trim('&_instname') instname, trim('&_dbid') db_id, trim('&_hostname') hostname, snap_id, tm, inst, dur, event, event_rank, waits, time, avgwt, pctdbt, aas, wait_class
from 
      (select snap_id, TO_CHAR(tm,'MM/DD/YY HH24:MI:SS') tm, inst, dur, event, waits, time, avgwt, pctdbt, aas, wait_class, 
            DENSE_RANK() OVER (
          PARTITION BY snap_id ORDER BY time DESC) event_rank
      from 
              (
              select * from 
                    (select * from 
                          (select 
                            s0.snap_id snap_id,
                            s0.END_INTERVAL_TIME tm,
                            s0.instance_number inst,
                            round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                            e.event_name event,
                            e.total_waits - nvl(b.total_waits,0)       waits,
                            round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)  time,     -- THIS IS EVENT (sec)
                            round (decode ((e.total_waits - nvl(b.total_waits, 0)), 0, to_number(NULL), ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000) / (e.total_waits - nvl(b.total_waits,0))), 2) avgwt,
                            ((round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS EVENT (sec) / DB TIME (sec)
                            (round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,     -- THIS IS EVENT (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                            e.wait_class wait_class
                            from 
                                 dba_hist_snapshot s0,
                                 dba_hist_snapshot s1,
                                 dba_hist_system_event b,
                                 dba_hist_system_event e,
                                 dba_hist_sys_time_model s5t0,
                                 dba_hist_sys_time_model s5t1
                            where 
                              s0.dbid                   = &_dbid            -- CHANGE THE DBID HERE!
                              AND s1.dbid               = s0.dbid
                              and b.dbid(+)             = s0.dbid
                              and e.dbid                = s0.dbid
                              AND s5t0.dbid             = s0.dbid
                              AND s5t1.dbid             = s0.dbid
                              --AND s0.instance_number    = &_instancenumber  -- CHANGE THE INSTANCE_NUMBER HERE!
                              AND s1.instance_number    = s0.instance_number
                              and b.instance_number(+)  = s0.instance_number
                              and e.instance_number     = s0.instance_number
                              AND s5t0.instance_number = s0.instance_number
                              AND s5t1.instance_number = s0.instance_number
                              AND s1.snap_id            = s0.snap_id + 1
                              AND b.snap_id(+)          = s0.snap_id
                              and e.snap_id             = s0.snap_id + 1
                              AND s5t0.snap_id         = s0.snap_id
                              AND s5t1.snap_id         = s0.snap_id + 1
                              AND s5t0.stat_name       = 'DB time'
                              AND s5t1.stat_name       = s5t0.stat_name
                                    and b.event_id            = e.event_id
                                    and e.wait_class          != 'Idle'
                                    and e.total_waits         > nvl(b.total_waits,0)
                                    and e.event_name not in ('smon timer', 
                                                             'pmon timer', 
                                                             'dispatcher timer',
                                                             'dispatcher listen timer',
                                                             'rdbms ipc message')
                                  order by snap_id, time desc, waits desc, event)
                    union all
                              select 
                                       s0.snap_id snap_id,
                                       s0.END_INTERVAL_TIME tm,
                                       s0.instance_number inst,
                                       round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                        'CPU time',
                                        0,
                                        round ((s6t1.value - s6t0.value) / 1000000, 2) as time,     -- THIS IS DB CPU (sec)
                                        0,
                                        ((round ((s6t1.value - s6t0.value) / 1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS DB CPU (sec) / DB TIME (sec)..TO GET % OF DB CPU ON DB TIME FOR TOP 5 TIMED EVENTS SECTION
                                        (round ((s6t1.value - s6t0.value) / 1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,  -- THIS IS DB CPU (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                                        'CPU'
                                      from 
                                        dba_hist_snapshot s0,
                                        dba_hist_snapshot s1,
                                        dba_hist_sys_time_model s6t0,
                                        dba_hist_sys_time_model s6t1,
                                        dba_hist_sys_time_model s5t0,
                                        dba_hist_sys_time_model s5t1
                                      WHERE 
                                      s0.dbid                   = &_dbid              -- CHANGE THE DBID HERE!
                                      AND s1.dbid               = s0.dbid
                                      AND s6t0.dbid            = s0.dbid
                                      AND s6t1.dbid            = s0.dbid
                                      AND s5t0.dbid            = s0.dbid
                                      AND s5t1.dbid            = s0.dbid
                                      --AND s0.instance_number    = &_instancenumber    -- CHANGE THE INSTANCE_NUMBER HERE!
                                      AND s1.instance_number    = s0.instance_number
                                      AND s6t0.instance_number = s0.instance_number
                                      AND s6t1.instance_number = s0.instance_number
                                      AND s5t0.instance_number = s0.instance_number
                                      AND s5t1.instance_number = s0.instance_number
                                      AND s1.snap_id            = s0.snap_id + 1
                                      AND s6t0.snap_id         = s0.snap_id
                                      AND s6t1.snap_id         = s0.snap_id + 1
                                      AND s5t0.snap_id         = s0.snap_id
                                      AND s5t1.snap_id         = s0.snap_id + 1
                                      AND s6t0.stat_name       = 'DB CPU'
                                      AND s6t1.stat_name       = s6t0.stat_name
                                      AND s5t0.stat_name       = 'DB time'
                                      AND s5t1.stat_name       = s5t0.stat_name
                    union all
                                      (select 
                                               dbtime.snap_id,
                                               dbtime.tm,
                                               dbtime.inst,
                                               dbtime.dur,
                                               'CPU wait',
                                                0,
                                                round(dbtime.time - accounted_dbtime.time, 2) time,     -- THIS IS UNACCOUNTED FOR DB TIME (sec)
                                                0,
                                                ((dbtime.aas - accounted_dbtime.aas)/ NULLIF(nvl(dbtime.aas,0),0))*100 as pctdbt,     -- THIS IS UNACCOUNTED FOR DB TIME (sec) / DB TIME (sec)
                                                round(dbtime.aas - accounted_dbtime.aas, 2) aas,     -- AAS OF UNACCOUNTED FOR DB TIME
                                                'CPU wait'
                                      from
                                                  (select  
                                                     s0.snap_id, 
                                                     s0.END_INTERVAL_TIME tm,
                                                     s0.instance_number inst,
                                                    round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                    'DB time',
                                                    0,
                                                    round ((s5t1.value - s5t0.value) / 1000000, 2) as time,     -- THIS IS DB time (sec)
                                                    0,
                                                    0,
                                                     (round ((s5t1.value - s5t0.value) / 1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                    + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                    + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                    + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,
                                                    'DB time'
                                                  from 
                                                                    dba_hist_snapshot s0,
                                                                    dba_hist_snapshot s1,
                                                                    dba_hist_sys_time_model s5t0,
                                                                    dba_hist_sys_time_model s5t1
                                                                  WHERE 
                                                                  s0.dbid                   = &_dbid              -- CHANGE THE DBID HERE!
                                                                  AND s1.dbid               = s0.dbid
                                                                  AND s5t0.dbid            = s0.dbid
                                                                  AND s5t1.dbid            = s0.dbid
                                                                  --AND s0.instance_number    = &_instancenumber    -- CHANGE THE INSTANCE_NUMBER HERE!
                                                                  AND s1.instance_number    = s0.instance_number
                                                                  AND s5t0.instance_number = s0.instance_number
                                                                  AND s5t1.instance_number = s0.instance_number
                                                                  AND s1.snap_id            = s0.snap_id + 1
                                                                  AND s5t0.snap_id         = s0.snap_id
                                                                  AND s5t1.snap_id         = s0.snap_id + 1
                                                                  AND s5t0.stat_name       = 'DB time'
                                                                  AND s5t1.stat_name       = s5t0.stat_name) dbtime, 
                                                  (select snap_id, inst, sum(time) time, sum(AAS) aas from 
                                                          (select * from (select 
                                                                s0.snap_id snap_id,
                                                                s0.END_INTERVAL_TIME tm,
                                                                s0.instance_number inst,
                                                                round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                        + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                        + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                        + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                                e.event_name event,
                                                                e.total_waits - nvl(b.total_waits,0)       waits,
                                                                round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)  time,     -- THIS IS EVENT (sec)
                                                                round (decode ((e.total_waits - nvl(b.total_waits, 0)), 0, to_number(NULL), ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000) / (e.total_waits - nvl(b.total_waits,0))), 2) avgwt,
                                                                ((round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS EVENT (sec) / DB TIME (sec)
                                                                (round ((e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                                + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                                + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                                + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,     -- THIS IS EVENT (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                                                                e.wait_class wait_class
                                                          from 
                                                               dba_hist_snapshot s0,
                                                               dba_hist_snapshot s1,
                                                               dba_hist_system_event b,
                                                               dba_hist_system_event e,
                                                               dba_hist_sys_time_model s5t0,
                                                               dba_hist_sys_time_model s5t1
                                                          where 
                                                            s0.dbid                   = &_dbid            -- CHANGE THE DBID HERE!
                                                            AND s1.dbid               = s0.dbid
                                                            and b.dbid(+)             = s0.dbid
                                                            and e.dbid                = s0.dbid
                                                            AND s5t0.dbid             = s0.dbid
                                                            AND s5t1.dbid             = s0.dbid
                                                            --AND s0.instance_number    = &_instancenumber  -- CHANGE THE INSTANCE_NUMBER HERE!
                                                            AND s1.instance_number    = s0.instance_number
                                                            and b.instance_number(+)  = s0.instance_number
                                                            and e.instance_number     = s0.instance_number
                                                            AND s5t0.instance_number = s0.instance_number
                                                            AND s5t1.instance_number = s0.instance_number
                                                            AND s1.snap_id            = s0.snap_id + 1
                                                            AND b.snap_id(+)          = s0.snap_id
                                                            and e.snap_id             = s0.snap_id + 1
                                                            AND s5t0.snap_id         = s0.snap_id
                                                            AND s5t1.snap_id         = s0.snap_id + 1
                                                      AND s5t0.stat_name       = 'DB time'
                                                      AND s5t1.stat_name       = s5t0.stat_name
                                                            and b.event_id            = e.event_id
                                                            and e.wait_class          != 'Idle'
                                                            and e.total_waits         > nvl(b.total_waits,0)
                                                            and e.event_name not in ('smon timer', 
                                                                                     'pmon timer', 
                                                                                     'dispatcher timer',
                                                                                     'dispatcher listen timer',
                                                                                     'rdbms ipc message')
                                                          order by snap_id, time desc, waits desc, event)
                                                    union all
                                                          select 
                                                                   s0.snap_id snap_id,
                                                                   s0.END_INTERVAL_TIME tm,
                                                                   s0.instance_number inst,
                                                                   round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                        + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                        + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                        + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                                    'CPU time',
                                                                    0,
                                                                    round ((s6t1.value - s6t0.value) / 1000000, 2) as time,     -- THIS IS DB CPU (sec)
                                                                    0,
                                                                    ((round ((s6t1.value - s6t0.value) / 1000000, 2)) / NULLIF(((s5t1.value - nvl(s5t0.value,0)) / 1000000),0))*100 as pctdbt,     -- THIS IS DB CPU (sec) / DB TIME (sec)..TO GET % OF DB CPU ON DB TIME FOR TOP 5 TIMED EVENTS SECTION
                                                                    (round ((s6t1.value - s6t0.value) / 1000000, 2))/60 /  round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                                + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                                + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                                + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) aas,  -- THIS IS DB CPU (min) / SnapDur (min) TO GET THE % DB CPU ON AAS
                                                                    'CPU'
                                                                  from 
                                                                    dba_hist_snapshot s0,
                                                                    dba_hist_snapshot s1,
                                                                    dba_hist_sys_time_model s6t0,
                                                                    dba_hist_sys_time_model s6t1,
                                                                    dba_hist_sys_time_model s5t0,
                                                                    dba_hist_sys_time_model s5t1
                                                                  WHERE 
                                                                  s0.dbid                   = &_dbid              -- CHANGE THE DBID HERE!
                                                                  AND s1.dbid               = s0.dbid
                                                                  AND s6t0.dbid            = s0.dbid
                                                                  AND s6t1.dbid            = s0.dbid
                                                                  AND s5t0.dbid            = s0.dbid
                                                                  AND s5t1.dbid            = s0.dbid
                                                                  --AND s0.instance_number    = &_instancenumber    -- CHANGE THE INSTANCE_NUMBER HERE!
                                                                  AND s1.instance_number    = s0.instance_number
                                                                  AND s6t0.instance_number = s0.instance_number
                                                                  AND s6t1.instance_number = s0.instance_number
                                                                  AND s5t0.instance_number = s0.instance_number
                                                                  AND s5t1.instance_number = s0.instance_number
                                                                  AND s1.snap_id            = s0.snap_id + 1
                                                                  AND s6t0.snap_id         = s0.snap_id
                                                                  AND s6t1.snap_id         = s0.snap_id + 1
                                                                  AND s5t0.snap_id         = s0.snap_id
                                                                  AND s5t1.snap_id         = s0.snap_id + 1
                                                                  AND s6t0.stat_name       = 'DB CPU'
                                                                  AND s6t1.stat_name       = s6t0.stat_name
                                                                  AND s5t0.stat_name       = 'DB time'
                                                                  AND s5t1.stat_name       = s5t0.stat_name
                                                          ) group by snap_id, inst) accounted_dbtime
                                                            where dbtime.snap_id = accounted_dbtime.snap_id 
                                                            and dbtime.inst = accounted_dbtime.inst 
                                        )
                    )
              )
      )
WHERE event_rank <= 5
-- AND tm > to_char(sysdate - 30, 'MM/DD/YY HH24:MI')
-- AND TO_CHAR(tm,'D') >= 1     -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900     -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- and snap_id = 495
-- and snap_id >= 495 and snap_id <= 496
-- and event = 'db file sequential read'
-- and event like 'CPU%'
-- and avgwt > 5
-- and aas > .5
-- and wait_class = 'CPU'
-- and wait_class like '%I/O%'
-- and event_rank in (1,2,3)
ORDER BY snap_id;
}}}
{{{

set arraysize 5000

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Top Segments' skip 2
set pagesize 50000
set linesize 550


SELECT  
  trim('&_instname') instname, 
  trim('&_dbid') db_id, 
  trim('&_hostname') hostname, 
  snap_id, tm, inst, 
  owner, 
  tablespace_name, 
  dataobj#, 
  object_name, 
  subobject_name, 
  object_type, 
  physical_rw,
  LOGICAL_READS_DELTA,             
  BUFFER_BUSY_WAITS_DELTA,         
  DB_BLOCK_CHANGES_DELTA,          
  PHYSICAL_READS_DELTA,            
  PHYSICAL_WRITES_DELTA,           
  PHYSICAL_READS_DIRECT_DELTA,     
  PHYSICAL_WRITES_DIRECT_DELTA,    
  ITL_WAITS_DELTA,                 
  ROW_LOCK_WAITS_DELTA,            
  GC_CR_BLOCKS_SERVED_DELTA,       
  GC_CU_BLOCKS_SERVED_DELTA,       
  GC_BUFFER_BUSY_DELTA,            
  GC_CR_BLOCKS_RECEIVED_DELTA,     
  GC_CU_BLOCKS_RECEIVED_DELTA,     
  SPACE_USED_DELTA,                
  SPACE_ALLOCATED_DELTA,           
  TABLE_SCANS_DELTA,               
  CHAIN_ROW_EXCESS_DELTA,          
  PHYSICAL_READ_REQUESTS_DELTA,    
  PHYSICAL_WRITE_REQUESTS_DELTA,   
  OPTIMIZED_PHYSICAL_READS_DELTA,
  seg_rank
FROM 
    ( 
        SELECT 
          r.snap_id, 
          TO_CHAR(r.tm,'MM/DD/YY HH24:MI:SS') tm, 
          r.inst, 
          n.owner, 
          n.tablespace_name, 
          n.dataobj#, 
          n.object_name, 
          CASE 
            WHEN LENGTH(n.subobject_name) < 11 
            THEN n.subobject_name 
            ELSE SUBSTR(n.subobject_name,LENGTH(n.subobject_name)-9) 
          END subobject_name, 
          n.object_type, 
          (r.PHYSICAL_READS_DELTA + r.PHYSICAL_WRITES_DELTA) as physical_rw,
          r.LOGICAL_READS_DELTA,             
          r.BUFFER_BUSY_WAITS_DELTA,         
          r.DB_BLOCK_CHANGES_DELTA,          
          r.PHYSICAL_READS_DELTA,            
          r.PHYSICAL_WRITES_DELTA,           
          r.PHYSICAL_READS_DIRECT_DELTA,     
          r.PHYSICAL_WRITES_DIRECT_DELTA,    
          r.ITL_WAITS_DELTA,                 
          r.ROW_LOCK_WAITS_DELTA,            
          r.GC_CR_BLOCKS_SERVED_DELTA,       
          r.GC_CU_BLOCKS_SERVED_DELTA,       
          r.GC_BUFFER_BUSY_DELTA,            
          r.GC_CR_BLOCKS_RECEIVED_DELTA,     
          r.GC_CU_BLOCKS_RECEIVED_DELTA,     
          r.SPACE_USED_DELTA,                
          r.SPACE_ALLOCATED_DELTA,           
          r.TABLE_SCANS_DELTA,               
          r.CHAIN_ROW_EXCESS_DELTA,          
          r.PHYSICAL_READ_REQUESTS_DELTA,    
          r.PHYSICAL_WRITE_REQUESTS_DELTA,   
          r.OPTIMIZED_PHYSICAL_READS_DELTA,
          DENSE_RANK() OVER (PARTITION BY r.snap_id ORDER BY r.PHYSICAL_READS_DELTA + r.PHYSICAL_WRITES_DELTA DESC) seg_rank
        FROM  
              dba_hist_seg_stat_obj n, 
              ( 
                SELECT  
                  s0.snap_id snap_id, 
                  s0.END_INTERVAL_TIME tm, 
                  s0.instance_number inst, 
                  b.dataobj#, 
                  b.obj#, 
                  b.dbid,                 
                  sum(b.LOGICAL_READS_DELTA) LOGICAL_READS_DELTA,            
                  sum(b.BUFFER_BUSY_WAITS_DELTA) BUFFER_BUSY_WAITS_DELTA,        
                  sum(b.DB_BLOCK_CHANGES_DELTA) DB_BLOCK_CHANGES_DELTA,         
                  sum(b.PHYSICAL_READS_DELTA) PHYSICAL_READS_DELTA,           
                  sum(b.PHYSICAL_WRITES_DELTA) PHYSICAL_WRITES_DELTA,         
                  sum(b.PHYSICAL_READS_DIRECT_DELTA) PHYSICAL_READS_DIRECT_DELTA,    
                  sum(b.PHYSICAL_WRITES_DIRECT_DELTA) PHYSICAL_WRITES_DIRECT_DELTA,  
                  sum(b.ITL_WAITS_DELTA) ITL_WAITS_DELTA,               
                  sum(b.ROW_LOCK_WAITS_DELTA) ROW_LOCK_WAITS_DELTA,           
                  sum(b.GC_CR_BLOCKS_SERVED_DELTA) GC_CR_BLOCKS_SERVED_DELTA,      
                  sum(b.GC_CU_BLOCKS_SERVED_DELTA) GC_CU_BLOCKS_SERVED_DELTA,     
                  sum(b.GC_BUFFER_BUSY_DELTA) GC_BUFFER_BUSY_DELTA,           
                  sum(b.GC_CR_BLOCKS_RECEIVED_DELTA) GC_CR_BLOCKS_RECEIVED_DELTA,    
                  sum(b.GC_CU_BLOCKS_RECEIVED_DELTA) GC_CU_BLOCKS_RECEIVED_DELTA,    
                  sum(b.SPACE_USED_DELTA) SPACE_USED_DELTA,              
                  sum(b.SPACE_ALLOCATED_DELTA) SPACE_ALLOCATED_DELTA,         
                  sum(b.TABLE_SCANS_DELTA) TABLE_SCANS_DELTA,              
                  sum(b.CHAIN_ROW_EXCESS_DELTA) CHAIN_ROW_EXCESS_DELTA,         
                  sum(b.PHYSICAL_READ_REQUESTS_DELTA) PHYSICAL_READ_REQUESTS_DELTA,   
                  sum(b.PHYSICAL_WRITE_REQUESTS_DELTA) PHYSICAL_WRITE_REQUESTS_DELTA,  
                  sum(b.OPTIMIZED_PHYSICAL_READS_DELTA) OPTIMIZED_PHYSICAL_READS_DELTA
                FROM  
                    dba_hist_snapshot s0, 
                    dba_hist_snapshot s1, 
                    dba_hist_seg_stat b 
                WHERE  
                    s0.dbid                  = &_dbid     
                    AND s1.dbid              = s0.dbid 
                    AND b.dbid               = s0.dbid 
                    --AND s0.instance_number   = &_instancenumber   
                    AND s1.instance_number   = s0.instance_number 
                    AND b.instance_number    = s0.instance_number 
                    AND s1.snap_id           = s0.snap_id + 1 
                    AND b.snap_id            = s0.snap_id + 1 
                    --AND s0.snap_id = 35547 
                GROUP BY  
                  s0.snap_id, s0.END_INTERVAL_TIME, s0.instance_number, b.dataobj#, b.obj#, b.dbid 
              ) r 
        WHERE n.dataobj#     = r.dataobj# 
        AND n.obj#           = r.obj# 
        AND n.dbid           = r.dbid 
        AND r.PHYSICAL_READS_DELTA + r.PHYSICAL_WRITES_DELTA > 0 
        ORDER BY physical_rw DESC, 
          object_name, 
          owner, 
          subobject_name 
    ) 
WHERE 
seg_rank <=10
--and snap_id in (35547,35548,35549)
order by inst, snap_id, seg_rank asc;

}}}


''References:''
SPACE_ALLOCATED_DELTA http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:7867887875624

This script is very handy for characterizing the resource hogging SQLs, once the data is pulled from tableau it's very easy to sort stuff and you'll be done in a couple of minutes.. 
<<<
''Per instance''	
	 top elap / exec
	 top disk reads
	 top buffer gets
	 top executes
	 top app wait
	 top concurrency wait
	 top cluster wait
	
''Per App Module (parsing schema)''

''or by other dimensions (inst, sql_id, module)''
<<<

{{{
set arraysize 5000

COLUMN blocksize NEW_VALUE _blocksize NOPRINT
select distinct block_size blocksize from v$datafile;

COLUMN dbid NEW_VALUE _dbid NOPRINT
select dbid from v$database;

COLUMN name NEW_VALUE _instname NOPRINT
select lower(instance_name) name from v$instance;

COLUMN name NEW_VALUE _hostname NOPRINT
select lower(host_name) name from v$instance;

COLUMN instancenumber NEW_VALUE _instancenumber NOPRINT
select instance_number instancenumber from v$instance;

-- ttitle center 'AWR Top SQL Report' skip 2
set pagesize 50000
set linesize 550

col snap_id             format 99999            heading -- "Snap|ID"
col tm                  format a15              heading -- "Snap|Start|Time"
col inst                format 90               heading -- "i|n|s|t|#"
col dur                 format 990.00           heading -- "Snap|Dur|(m)"
col sql_id              format a15              heading -- "SQL|ID"
col phv                 format 99999999999      heading -- "Plan|Hash|Value"
col module              format a50
col elap                format 999990.00        heading -- "Ela|Time|(s)"
col elapexec            format 999990.00        heading -- "Ela|Time|per|exec|(s)"
col cput                format 999990.00        heading -- "CPU|Time|(s)"
col iowait              format 999990.00        heading -- "IO|Wait|(s)"
col appwait             format 999990.00        heading -- "App|Wait|(s)"
col concurwait          format 999990.00        heading -- "Ccr|Wait|(s)"
col clwait              format 999990.00        heading -- "Cluster|Wait|(s)"
col bget                format 99999999990      heading -- "LIO"
col dskr                format 99999999990      heading -- "PIO"
col dpath               format 99999999990      heading -- "Direct|Writes"
col rowp                format 99999999990      heading -- "Rows"
col exec                format 9999990          heading -- "Exec"
col prsc                format 999999990        heading -- "Parse|Count"
col pxexec              format 9999990          heading -- "PX|Server|Exec"
col icbytes             format 99999990         heading -- "IC|MB"           
col offloadbytes        format 99999990         heading -- "Offload|MB"
col offloadreturnbytes  format 99999990         heading -- "Offload|return|MB"
col flashcachereads     format 99999990         heading -- "Flash|Cache|MB"   
col uncompbytes         format 99999990         heading -- "Uncomp|MB"       
col pctdbt              format 990              heading -- "DB Time|%"
col aas                 format 990.00           heading -- "A|A|S"
col time_rank           format 90               heading -- "Time|Rank"
col sql_text            format a6               heading -- "SQL|Text"

     select *
       from (
             select
                  trim('&_instname') instname, 
                  trim('&_dbid') db_id, 
                  trim('&_hostname') hostname, 
                  sqt.snap_id snap_id,
                  TO_CHAR(sqt.tm,'MM/DD/YY HH24:MI:SS') tm,
                  sqt.inst inst,
                  sqt.dur dur,
                  sqt.aas aas,
                  nvl((sqt.elap), to_number(null)) elap,
                  nvl((sqt.elapexec), 0) elapexec,
                  nvl((sqt.cput), to_number(null)) cput,
                  sqt.iowait iowait,
                  sqt.appwait appwait,
                  sqt.concurwait concurwait,
                  sqt.clwait clwait,
                  sqt.bget bget, 
                  sqt.dskr dskr, 
                  sqt.dpath dpath,
                  sqt.rowp rowp,
                  sqt.exec exec, 
                  sqt.prsc prsc, 
                  sqt.pxexec pxexec,
                  sqt.icbytes, 
                  sqt.offloadbytes, 
                  sqt.offloadreturnbytes, 
                  sqt.flashcachereads, 
                  sqt.uncompbytes,
                  sqt.time_rank time_rank,
                  sqt.sql_id sql_id,   
                  sqt.phv phv,     
                  sqt.parse_schema parse_schema,
                  substr(to_clob(decode(sqt.module, null, null, sqt.module)),1,50) module, 
                  st.sql_text sql_text     -- PUT/REMOVE COMMENT TO HIDE/SHOW THE SQL_TEXT
             from        (
                          select snap_id, tm, inst, dur, sql_id, phv, parse_schema, module, elap, elapexec, cput, iowait, appwait, concurwait, clwait, bget, dskr, dpath, rowp, exec, prsc, pxexec, icbytes, offloadbytes, offloadreturnbytes, flashcachereads, uncompbytes, aas, time_rank
                          from
                                             (
                                               select 
                                                      s0.snap_id snap_id,
                                                      s0.END_INTERVAL_TIME tm,
                                                      s0.instance_number inst,
                                                      round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                              + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                              + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                              + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2) dur,
                                                      e.sql_id sql_id, 
                                                      e.plan_hash_value phv, 
                                                      e.parsing_schema_name parse_schema,
                                                      max(e.module) module,
                                                      sum(e.elapsed_time_delta)/1000000 elap,
                                                      decode((sum(e.executions_delta)), 0, to_number(null), ((sum(e.elapsed_time_delta)) / (sum(e.executions_delta)) / 1000000)) elapexec,
                                                      sum(e.cpu_time_delta)/1000000     cput, 
                                                      sum(e.iowait_delta)/1000000 iowait,
                                                      sum(e.apwait_delta)/1000000 appwait,
                                                      sum(e.ccwait_delta)/1000000 concurwait,
                                                      sum(e.clwait_delta)/1000000 clwait,
                                                      sum(e.buffer_gets_delta) bget,
                                                      sum(e.disk_reads_delta) dskr, 
                                                      sum(e.direct_writes_delta) dpath,
                                                      sum(e.rows_processed_delta) rowp,
                                                      sum(e.executions_delta)   exec,
                                                      sum(e.parse_calls_delta) prsc,
                                                      sum(e.px_servers_execs_delta) pxexec,
                                                      sum(e.io_interconnect_bytes_delta)/1024/1024 icbytes,  
                                                      sum(e.io_offload_elig_bytes_delta)/1024/1024 offloadbytes,  
                                                      sum(e.io_offload_return_bytes_delta)/1024/1024 offloadreturnbytes,   
                                                      (sum(e.optimized_physical_reads_delta)* &_blocksize)/1024/1024 flashcachereads,   
                                                      sum(e.cell_uncompressed_bytes_delta)/1024/1024 uncompbytes, 
                                                      (sum(e.elapsed_time_delta)/1000000) / ((round(EXTRACT(DAY FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 1440 
                                                                                            + EXTRACT(HOUR FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) * 60 
                                                                                            + EXTRACT(MINUTE FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) 
                                                                                            + EXTRACT(SECOND FROM s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME) / 60, 2))*60) aas,
                                                      DENSE_RANK() OVER (
                                                      PARTITION BY s0.snap_id ORDER BY e.elapsed_time_delta DESC) time_rank
                                               from 
                                                   dba_hist_snapshot s0,
                                                   dba_hist_snapshot s1,
                                                   dba_hist_sqlstat e
                                                   where 
                                                    s0.dbid                   = &_dbid                -- CHANGE THE DBID HERE!
                                                    AND s1.dbid               = s0.dbid
                                                    and e.dbid                = s0.dbid                                                
                                                    --AND s0.instance_number    = &_instancenumber      -- CHANGE THE INSTANCE_NUMBER HERE!
                                                    AND s1.instance_number    = s0.instance_number
                                                    and e.instance_number     = s0.instance_number                                                 
                                                    AND s1.snap_id            = s0.snap_id + 1
                                                    and e.snap_id             = s0.snap_id + 1                                              
                                               group by 
                                                    s0.snap_id, s0.END_INTERVAL_TIME, s0.instance_number, e.sql_id, e.plan_hash_value, e.parsing_schema_name, e.elapsed_time_delta, s1.END_INTERVAL_TIME - s0.END_INTERVAL_TIME
                                             )
                          where 
                          time_rank <= 5                                     -- GET TOP 5 SQL ACROSS SNAP_IDs... YOU CAN ALTER THIS TO HAVE MORE DATA POINTS
                         ) 
                        sqt,
                        (select sql_id, dbid, nvl(b.name, a.command_type) sql_text from dba_hist_sqltext a, audit_actions b where a.command_type =  b.action(+)) st
             where st.sql_id(+)             = sqt.sql_id
             and st.dbid(+)                 = &_dbid
-- AND TO_CHAR(tm,'D') >= 1                                                  -- Day of week: 1=Sunday 7=Saturday
-- AND TO_CHAR(tm,'D') <= 7
-- AND TO_CHAR(tm,'HH24MI') >= 0900                                          -- Hour
-- AND TO_CHAR(tm,'HH24MI') <= 1800
-- AND tm >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss')     -- Data range
-- AND tm <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss')
-- AND snap_id in (338,339)
-- AND snap_id = 338
-- AND snap_id >= 335 and snap_id <= 339
-- AND lower(st.sql_text) like 'select%'
-- AND lower(st.sql_text) like 'insert%'
-- AND lower(st.sql_text) like 'update%'
-- AND lower(st.sql_text) like 'merge%'
-- AND pxexec > 0
-- AND aas > .5
             order by 
             snap_id                             -- TO GET SQL OUTPUT ACROSS SNAP_IDs SEQUENTIALLY AND ASC
             -- nvl(sqt.elap, -1) desc, sqt.sql_id     -- TO GET SQL OUTPUT BY ELAPSED TIME
             )
-- where rownum <= 20
;
}}}
Sample storage forecast here https://www.evernote.com/shard/s48/sh/9594b0d9-cf51-4bea-b0e1-ce68915c0357/a7626bde5789e0964b25d79bbcf1f6ca

Use the first two SQLs below and extract each of them in a CSV file as input to Tableau, the "per day" is the monthly high level number and the "per snap_id" would be the detail
{{{

-- per day
  SELECT a.month,
    used_size_mb ,
    used_size_mb - LAG (used_size_mb,1) OVER (PARTITION BY a.name ORDER BY a.name,a.month) inc_used_size_mb
  FROM
    (SELECT TO_CHAR(sp.begin_interval_time,'MM/DD/YY') month ,
      ts.name ,
      MAX(ROUND((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) used_size_mb
    FROM DBA_HIST_TBSPC_SPACE_USAGE tsu,
      v$tablespace ts ,
      DBA_HIST_SNAPSHOT sp,
      DBA_TABLESPACES dt
    WHERE tsu.tablespace_id    = ts.ts#
    AND tsu.snap_id            = sp.snap_id
    AND ts.name              = dt.tablespace_name
    GROUP BY TO_CHAR(sp.begin_interval_time,'MM/DD/YY'),
      ts.name
    ORDER BY 
      month
    ) A;

-- detail per snap_id
select *  from 
(
SELECT 
  s0.snap_id id,
  TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS') tm,
  ts.ts#, 
  ts.name ,
  MAX(ROUND((tsu0.tablespace_maxsize    * dt.block_size )/(1024*1024),2) ) max_size_MB ,
  MAX(ROUND((tsu0.tablespace_size       * dt.block_size )/(1024*1024),2) ) cur_size_MB ,
  MAX(ROUND((tsu0.tablespace_usedsize   * dt.block_size )/(1024*1024),2)) used_size_MB,
  MAX(ROUND(( (tsu1.tablespace_usedsize - tsu0.tablespace_usedsize)  * dt.block_size )/(1024*1024),2)) diff_used_size_MB
FROM 
  dba_hist_snapshot s0,
  dba_hist_snapshot s1,
  DBA_HIST_TBSPC_SPACE_USAGE tsu0,
  DBA_HIST_TBSPC_SPACE_USAGE tsu1,
  v$tablespace ts,
  DBA_TABLESPACES dt
WHERE s1.snap_id        = s0.snap_id + 1
AND tsu0.snap_id        = s0.snap_id
AND tsu1.snap_id        = s0.snap_id + 1
AND tsu0.tablespace_id   = ts.ts#
AND tsu1.tablespace_id   = ts.ts#
AND ts.name             = dt.tablespace_name
GROUP BY s0.snap_id, TO_CHAR(s0.END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS'), ts.ts#, ts.name
)
--where 
--tm > to_char(sysdate - 7, 'MM/DD/YY HH24:MI')
--and name = 'SYSAUX'
--and id in (224,225,226)
--and id = 225
ORDER BY id asc;



-- without dba_hist_snapshot
SELECT 
  sp.snap_id, 
  TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY') days ,
  ts.name ,
  MAX(ROUND((tsu.tablespace_maxsize    * dt.block_size )/(1024*1024),2) ) max_size_MB ,
  MAX(ROUND((tsu.tablespace_size       * dt.block_size )/(1024*1024),2) ) cur_size_MB ,
  MAX(ROUND((tsu.tablespace_usedsize   * dt.block_size )/(1024*1024),2)) used_size_MB
FROM 
  DBA_HIST_TBSPC_SPACE_USAGE tsu,
  v$tablespace ts,
  DBA_HIST_SNAPSHOT sp,
  DBA_TABLESPACES dt
WHERE tsu.tablespace_id = ts.ts#
AND tsu.snap_id         = sp.snap_id
AND ts.name             = dt.tablespace_name
--and sp.snap_id = 225
GROUP BY sp.snap_id, TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY'), ts.name
ORDER BY ts.name,
  days;


}}}
http://docs.oracle.com/cd/E50790_01/doc/doc.121/e50471/views.htm#SAGUG21166

12.1 storage software introduced a bunch of DBA_HIST views
DBA_HIST_ASM_BAD_DISK
DBA_HIST_ASM_DISKGROUP
DBA_HIST_ASM_DISKGROUP_STAT
DBA_HIST_CELL_CONFIG
DBA_HIST_CELL_CONFIG_DETAIL
DBA_HIST_CELL_DB
DBA_HIST_CELL_DISKTYPE
DBA_HIST_CELL_DISK_NAME
DBA_HIST_CELL_DISK_SUMMARY
DBA_HIST_CELL_IOREASON
DBA_HIST_CELL_IOREASON_NAME
DBA_HIST_CELL_METRIC_DESC
DBA_HIST_CELL_NAME
DBA_HIST_CELL_OPEN_ALERTS

{{{
19:42:37 SYS@dbfs1> desc V$CELL_DB
 Name                                                                                                                                                  Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------
 CELL_NAME                                                                                                                                                      VARCHAR2(400)
 CELL_HASH                                                                                                                                                      NUMBER
 INCARNATION_NUM                                                                                                                                                NUMBER
 TIMESTAMP                                                                                                                                                      DATE
 SRC_DBNAME                                                                                                                                                     VARCHAR2(256)
 SRC_DBID                                                                                                                                                       NUMBER
 METRIC_ID                                                                                                                                                      NUMBER
 METRIC_NAME                                                                                                                                                    VARCHAR2(257)
 METRIC_VALUE                                                                                                                                                   NUMBER
 METRIC_TYPE                                                                                                                                                    VARCHAR2(17)
 CON_ID                                                                                                                                                         NUMBER

19:42:39 SYS@dbfs1> desc dba_hist_cell_db
 Name                                                                                                                                                  Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------
 SNAP_ID                                                                                                                                               NOT NULL NUMBER
 DBID                                                                                                                                                  NOT NULL NUMBER
 CELL_HASH                                                                                                                                             NOT NULL NUMBER
 INCARNATION_NUM                                                                                                                                       NOT NULL NUMBER
 SRC_DBID                                                                                                                                              NOT NULL NUMBER
 SRC_DBNAME                                                                                                                                                     VARCHAR2(256)
 DISK_REQUESTS                                                                                                                                                  NUMBER
 DISK_BYTES                                                                                                                                                     NUMBER
 FLASH_REQUESTS                                                                                                                                                 NUMBER
 FLASH_BYTES                                                                                                                                                    NUMBER
 CON_DBID                                                                                                                                                       NUMBER
 CON_ID                                                                                                                                                         NUMBER
}}}
http://timurakhmadeev.wordpress.com/2012/02/15/ruoug-in-saint-petersburg/
http://iusoltsev.wordpress.com/2012/02/12/awr-snapshot-suspend-oracle-11g/

http://arjudba.blogspot.com/2010/08/ora-13516-awr-operation-failed-swrf.html
Mythbusters: AWR retention days and SYSAUX tablespace usage on it?
http://goo.gl/jTjsk

{{{
-- TO VIEW RETENTION INFORMATION
select * from dba_hist_wr_control;
set lines 300
select b.name, a.DBID,
   ((TRUNC(SYSDATE) + a.SNAP_INTERVAL - TRUNC(SYSDATE)) * 86400)/60 AS SNAP_INTERVAL_MINS,
   ((TRUNC(SYSDATE) + a.RETENTION - TRUNC(SYSDATE)) * 86400)/60 AS RETENTION_MINS,
   ((TRUNC(SYSDATE) + a.RETENTION - TRUNC(SYSDATE)) * 86400)/60/60/24 AS RETENTION_DAYS,
   TOPNSQL
from dba_hist_wr_control a, v$database b
where a.dbid = b.dbid;

/*
-- SET RETENTION PEROID TO 30 DAYS (UNIT IS MINUTES)
execute dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 43200);
-- SET RETENTION PEROID TO 365 DAYS (UNIT IS MINUTES)
exec dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 525600);

}}}

AWR snap difference (15mins and 60mins) effect on CPU sizing
''Consolidate 4 instances with different snap intervals - link'' http://www.evernote.com/shard/s48/sh/b7147378-ebb4-4eec-afb5-61222259ce2d/f94d5d98afea81c3ab10af8016775048
Master Note on AWR Warehouse (Doc ID 1907335.1)

Oracle® Database 2 Day + Performance Tuning Guide 12c Release 1 (12.1)
http://docs.oracle.com/database/121/TDPPT/tdppt_awr_warehouse.htm#TDPPT145

Analyze Long-term Performance Across Enterprise Databases Using AWR Warehouse
https://apex.oracle.com/pls/apex/f?p=44785:24:0::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:9887,29

blogs about it 
http://www.dbi-services.com/index.php/blog/entry/oracle-oem-cloud-control-12104-awr-warehouse
http://dbakevlar.com/2014/07/awr-warehouse-status/


! the workflow
''source''
when awr warehouse is deployed on a target.. it deploys jobs, and this is an agent push only
source exports the awr dump as a job on the local filesystem, this doesn't have to be the same directory path as the warehouse
if you have a 12 month retention, it will not do it all at once, it does the export per 2GB every 3hours
it first exports the oldest snap_id 

''oms''
oms does an agent to agent talk when source is transferring the dump file and then puts on the "warehouse stage directory"
oms agent checks the directory every 5 mins and if there's a new file that file gets imported to the warehouse

''warehouse''
warehouse has this ETL job and databases are partitioned per DBID 
there's a mapping table to map the database to DBID
ideally if you want to put other data on the warehouse put it on another schema and views as well, because a warehouse upgrade or patch may wipe them out
as long as you have a diag pack license on the source, you are good with the warehouse license, this is pretty much like the licensing scheme of OMS


<<<
Karl Arao
kellyn, question on awr warehouse, so it is recommended to be on a separate database. and on that separate database it requires a separate diag pack license?
so let's say you have a diag and tuning pack on the source... and then you've got to have diag pack on the target awr warehouse?
thanks!
Kellyn Pot'vin
11:09am
Kellyn Pot'vin
No,  you're diag pack from source db grants the limited ee license for the awrw
Does that make sense?
Karl Arao
11:09am
Karl Arao
i see
essentially it's free
because source would have diag and tuning pack anyway
Kellyn Pot'vin
11:10am
Kellyn Pot'vin
It took them while to come up with that,  but same for em12c omr
Now, if you add anything, rac or data guard,  then you have to license that
Karl Arao
11:11am
Karl Arao
yeap which is also the case on omr
Kellyn Pot'vin
11:12am
Kellyn Pot'vin
Exactly
Karl Arao
11:12am
Karl Arao
now, can we add anymore tables on the awr warehouse
let's say i want that to be my longer retention data for my metric extension as well
Kellyn Pot'vin
11:13am
Kellyn Pot'vin
Yes, but no additional partitioning and it may impact patches/upgrades
Karl Arao
11:13am
Karl Arao
sure
Kellyn Pot'vin
11:14am
Kellyn Pot'vin
I wouldn't do triggers or partitions
Views are cool
Karl Arao
11:16am
Karl Arao
we are going to evaluate this soon, just upgraded to r4
Kellyn Pot'vin
11:16am
Kellyn Pot'vin
Otn will post a new article of advance awr usage next week from me
Karl Arao
11:16am
Karl Arao
another question,
on my source i have 12months of data
Kellyn Pot'vin
11:17am
Kellyn Pot'vin
And know exadata team is asking how to incorporate it as part of healthcheck design
Karl Arao
11:17am
Karl Arao
will it ETL that to the warehouse
like 1 shot
Kellyn Pot'vin
11:17am
Kellyn Pot'vin
That is my focus in dev right now
Karl Arao
11:17am
Karl Arao
that's going to be 160GB of data
and with exp warehouse
there's going to be an impact for sure
Kellyn Pot'vin
11:18am
Kellyn Pot'vin
No, it has throttle and will take 2gb file loads in 3hr intervals, oldest snapshots first
Karl Arao
11:18am
Karl Arao
I'm just curious on the etl
what do you mean 3hours intervals ?
2GB to finish in 3hours
Kellyn Pot'vin
11:19am
Kellyn Pot'vin
Tgen go back to 24 hr interval auto after any catchup, same on downtime catchup
<<<



Mmm.. It's a long story, just check out this blog post..  http://karlarao.wordpress.com/2010/04/10/my-personal-wiki-karlarao-tiddlyspot-com/   :)

Also check out my Google profile here https://plus.google.com/102472804060828276067/about to know more about my web/social media presence

http://www.ardentperf.com/2011/08/19/developer-access-to-10046-trace-files/
http://dioncho.wordpress.com/2009/03/19/another-way-to-use-trace-file/
http://kb.acronis.com/content/2788
http://kb.acronis.com/search/apachesolr_search/true%20image%202012%20slow%20backup?filters=%20type%3Aarticle
http://forum.acronis.com/forum/5399
http://kb.acronis.com/content/2293


''Amanda'' http://www.amanda.org/   <-- but this requires a client agent
http://gjilevski.wordpress.com/2010/03/14/creating-oracle-11g-active-standby-database-from-physical-standby-database/
''Oracle Active Data Guard: What’s Really Under the Hood?'' http://www.oracle.com/technetwork/database/features/availability/s316924-1-175932.pdf


''Read only and vice versa''
http://www.adp-gmbh.ch/ora/data_guard/standby_read_only.html
http://juliandyke.wordpress.com/2010/10/14/oracle-11gr2-active-data-guard/
http://www.oracle-base.com/articles/11g/data-guard-setup-11gr2.php#read_only_active_data_guard


! to be in Active DG, remove "read only" step for normal managed recovery
{{{
startup mount
alter database open read only;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect;
}}}


!''Snapper on Standby Database''
<<<
On the standby site, if the database is open read only with apply you should be able to run snapper on it or do ash queries as well 
Check out some commands here http://karlarao.tiddlyspot.com/#snapper
And if you want to loop it and leave it running and check the data the next day you can do this http://karlarao.tiddlyspot.com/#snapperloop (sections “snapper loop showing activity across all instances (must use snapper v4)” and “process the snap.txt file as csv input”)

Some commands you can use and things to check is attached as well. But I would start with 
@snapper ash 5 1 all@*
Just to see what’s going on during the slow period
<<<

! triggers on ADG
Using Active Data Guard Reporting with Oracle E-Business Suite Release 12.1 and Oracle Database 11g (Doc ID 1070491.1)
<<<
Section 7: Database Triggers

ADG support delivers three schema level database triggers as follows:

Logon and Logoff
These triggers are a key component of the simulation testing. The logon trigger enables the read-only violation trace, whereas the logoff trigger records the actual number of violations. If these triggers are not enabled, the trace errors and V$ data are not recorded, in other words, the simulations are treated as having no errors. 
 
Servererror
The error trigger is only executed if an ORA-16000 is raised, which is read-only violation (the trigger does nothing on the primary). The error count for the concurrent program is incremented only if standby_error_checking has been enabled as described in 4.2 General Options. If the error trigger is not enabled, report failures will not be recorded and failures will not lead to run_on_standby being disabled. 
<<<
http://www.toadworld.com/platforms/oracle/b/weblog/archive/2014/04/27/oracle-apps-r12-offloading-reporting-workload-with-active-data-guard.aspx

! resource management on ADG
Configuring Resource Manager for Oracle Active Data Guard (Doc ID 1930540.1)
<<<
Configuring a resource plan on a physical standby database requires the plan to be created on primary database.

I/O Resource Manager helps multiple databases and workloads within the databases share the I/O resources on the Exadata storage. In a data guard environment, IORM can help protect the I/O latency for the redo apply I/Os from the standby database.
Critical I/Os from standby database backgrounds such as Managed Recovery Process (MRP) or Logical Standby Process (LSP) are automatically prioritized by enabling IORM on the Exadata storage. Database resource plans enabled on the standby databases are automatically pushed to the Exadata storage. Enabling IORM enforces database resource plans on the storage cells to minimize the latency for the critical redo-apply I/Os.  To enable IORM, set the IORM objective to 'auto' on the Exadata storage cells.

Bug 12601274: Updates to consumer group mappings on the primary database are not reflected on the standby database. This bug is fixed in 11.2.0.4 and 12.1.0.2. On older releases, the updates are only reflected on the standby upon a restart of the standby database.
<<<







http://kerryosborne.oracle-guy.com/papers/12c_Adaptive_Optimization.pdf
http://www.oracle-base.com/articles/11g/AwrBaselineEnhancements_11gR1.php <-- a good HOWTO
http://neerajbhatia.files.wordpress.com/2010/10/adaptive-thresholds.pdf
http://oracledoug.com/serendipity/index.php?/archives/1496-Adaptive-Thresholds-in-10g-Part-1-Metric-Baselines.html
http://oracledoug.com/serendipity/index.php?/archives/1497-Adaptive-Thresholds-in-10g-Part-2-Time-Grouping.html
http://oracledoug.com/serendipity/index.php?/archives/1498-Adaptive-Thresholds-in-10g-Part-3-Setting-Thresholds.html
http://oracledoug.com/metric_baselines_10g.pdf  <-- ''GOOD STUFF''
http://oracledoug.com/adaptive_thresholds_faq.pdf <-- ''GOOD STUFF''
http://www.cmg.org/conference/cmg2007/awards/7122.pdf
http://optimaldba.com/papers/IEDBMgmt.pdf
http://www.oracle-base.com/articles/11g/AwrBaselineEnhancements_11gR1.php
Strategies for Monitoring Large Data Centers with Oracle Enterprise Manager http://gavinsoorma.com/wp-content/uploads/2011/03/monitoring_large_data_centers_with_OEM.pdf
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1525205200346930663
<<<
{{{
You Asked

In version 11g of Oracle database, there is a new feature whereby current performance data (obtained from AWR snapshots) can be compared against an AWR baseline and an alarm triggered if a given metric exceeds a certain threshold. From what I understand, there are 3 types of thresholds : fixed value, percent of maximum and significance level. The first type (fixed value) is very easy to understand - alarms are triggered whenever the metric in question exceeds certain fixed values specified for the warning and critical alerts (without reference to the baseline). The 2nd type (percent of maximum) presumably means that an alert is triggered whenever the current value of the metric exceeds the specified percent of the maximum value of the metric that was observed in the whole baseline period (if I understood this correctly - correct me if I'm wrong). 
However, the 3rd type (significance level) is not at all easy to understand. The Oracle documentation is not at all clear on that point, nor could I find any Metalink notes on the subject. I also tried searching the OTN forums, to no avail. Could you please explain, in very simple terms, when exactly an alarm would be triggered if "significance level" is specified for the threshold type, if possible by giving a simple example. There are apparently 4 levels of such thresholds (high, very high, severe and extreme). 
and we said...

I asked Graham Wood and John Beresniewicz for their input on this, they are the experts in this particular area 

they said: 

Graham Wood wrote: 
> Sure, 
> Copying JB as this is his specialty area, in case I don't get it right. :-) 
> 
> The basic idea of using significance level thresholds for alerting is that we are trying to detect outliers in the distribution of metric values, rather than setting a simple threshold value. 
> 
> By looking at the historical metric data from AWR we can identify values for 25th, 50th (median), 75th, 90th, 95th and 99th percentiles. Using a curve fitting algorithm we also extrapolate the 99.9th and 99.99th percentiles. We derive these percentiles based on time grouping, such as day, night, and hour of day. 
> 
> In the adaptive baselines feature in 11g we allow the user to specify the alert level, which equates to one of these percentile values: 
> High 95th percentile 
> Very High 99th percentile 
> Severe 99.9th percentile 
> Extreme 99.99th percentile 
> 
> Using the AWR history (actually the SYSTEM_MOVING_WINDOW baseline) the database will automatically determine the threshold level for a metric that corresponds to the selected significance level for the current time period. 
> 
> Setting a significance level of Extreme means that we would only alert on values that we would only expect to see once in a 10000 observations (approximately once in every years for hourly thresholds). 
> 
> Cheers, Graham 

JB wrote: 
Shorter answer: 
--------------- 
The significance level thresholds are intended to produce alert threshold values for key performance metrics that represent the following: 

"Automatically set threshold such that values observed above the threshold are statistically unusual (i.e. significant) at the Nth percentile based on actual data observed for this metric over the SYSTEM_MOVING_WINDOW baseline." 

The premise here is that systems with relatively stable performance characteristics should show statistical stability in core performance metric values, and when unusual but high-impact performance events occur we expect these will be reflected in highly unusual observations in one or more (normally statistically stable) metrics. The significance level thresholds give users a way to specify alerting in terms of "how unusual" rather than "how much". 


Longer (original) reply: 
----------------------------- 
Hi Tom - 
Graham did a pretty good job, but I'll add some stuff. 

Fixed thresholds are set explicitly by user, and change only when user unsets or sets a different threshold. They are based entirely on user understanding of the underlying metrics in relation to the underlying application and workload. This is the commonly understood paradigm for detecting performance issues: trigger an alert when metric threshold is crossed. There are numerous issues we perceived with this basic mechanism: 

1) "Performance" expectations, and thus alert thresholds, often vary by application, workload, database size, etc. This results in what I call the MxN problem, which is that M metrics over N systems becomes MxN threshold decisions each of which can be very specific (i.e. threshold decisions not transferable.) This is potentially very manually intensive for users with many databases. 

2) Workload may vary predictably on system (e.g. online day vs. batch night) and different performance expectations (and thus alert thresholds) may pertain to different workloads, so one threshold for all workloads is inappropriate. 

3) Systems evolve over time and thresholds applicable for the system supporting 1,000 users may need to be altered when system supports 10,000 users. 

The adaptive thresholds feature tries to address these issues as follows: 

A) Thresholds are computed by the system based on a context of prior observations of this metric on this system. System-and-metric-specific thresholds are developed without obliging user to understand the specifics (helps relieve the MxN problem.) 

B) Thresholds are periodically recomputed using statistical characterizations of metric values over the SYSTEM_MOVING_WINDOW baseline. Thus the thresholds adapt to slowly evolving workload or demand, as the moving window moves forward. 

C) Metric statistics for adaptive thresholds are computed over grouping buckets (which we call "time groups") that can accommodate the common workload periodicities (day/night, weekday/weekend, etc.) Thresholds resets can happen as frequently as every hour. 

So the net-net is that metric alert thresholds are determined and set automatically by the system using actual metric observations as their basis and using metric-and-system-independent semantics (significance level or pct of max.) 

JB 

From Tom - Thanks both! 
}}}
<<<


''Oracle By Example:''
http://docs.oracle.com/cd/E11882_01/server.112/e16638/autostat.htm#CHDHBGJD
metric baseline http://www.oracle.com/webfolder/technetwork/tutorials/demos/db/10g/r2/metric_baselines.viewlet/metric_baselines_viewlet_swf.html
create baseline http://www.oracle.com/webfolder/technetwork/tutorials/demos/db/11g/r2/11gr2_baseline/11gr2_baseline_viewlet_swf.html
OEM system monitoring http://www.oracle.com/webfolder/technetwork/tutorials/obe/em/emgc10gr2/quick_start/system_monitoring/system_monitoring.htm
**Creating the Monitoring Template
**Creating the User-Defined Metrics
**Setting the Metric Baseline
SQL baseline http://www.oracle.com/webfolder/technetwork/tutorials/demos/db/10g/r2/sql_baseline.viewlet/sql_baseline_viewlet_swf.html





''Proactive Database Monitoring'' http://docs.oracle.com/cd/B28359_01/server.111/b28301/montune001.htm
''15 User-Defined Metrics'' http://docs.oracle.com/cd/B16240_01/doc/em.102/e10954/udm2.htm
''3 Cluster Database'' http://docs.oracle.com/cd/B19306_01/em.102/b25986/rac_database.htm
http://oracledoug.com/serendipity/index.php?/archives/1302-Oracle-Workload-Metrics.html
http://oracledoug.com/serendipity/index.php?/archives/1470-Time-Matters-Throughput-vs.-Response-Time.html
http://docs.oracle.com/cd/B14099_19/manage.1012/b16241/Monitoring.htm#sthref333
http://carymillsap.blogspot.com/2008/12/performance-as-service-part-2.html





-- notes and ideas about R2 and adaptive thresholds
[img[ https://lh5.googleusercontent.com/-JNRShrEzpiQ/T4W3xfgGzII/AAAAAAAABiY/VBPKaiA-zus/s800/AdaptiveThresholds.JPG ]]



http://en.wikipedia.org/wiki/Control_chart
http://en.wikipedia.org/wiki/Exponential_smoothing
http://www.sciencedirect.com/science/article/pii/S0169207003001134

http://prodlife.wordpress.com/2013/10/14/control-charts/

















http://kerryosborne.oracle-guy.com/2009/06/oracle-11g-adaptive-cursor-sharing-acs/
http://aychin.wordpress.com/2011/04/04/adaptive-cursor-sharing-and-spm/

Adaptive Cursor Sharing: Worked Example [ID 836256.1]
http://jarneil.wordpress.com/2010/11/05/11gr2-database-services-and-instance-shutdown/   <-- 11gR2 version.. 

http://pat98.tistory.com/531 <-- good stuff, well explained difference on admin and policy managed services
do this to collect the most recent occurrence of the error on any of the trace files 
{{{
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort
}}}

files to look out
{{{

Agent Log and Trace files

Note: if there are multiple Agents experiencing problems, the files must be uploaded for each Agent.

From $ORACLE_HOME/sysman/log/*.* directory for a single agent. 
From $ORACLE_HOME/host/sysman/log/*.* for a RAC agent. 
The files are: 
emagent.nohup: Agent watchdog log file, Startup errors are recorded in this file. 
emagent.log: Main agent log file 
emagent.trc: Main agent trace file 
emagentfetchlet.log: Log file for Java Fetchlets 
emagentfetchlet.trc: Trace file for Java Fetchlets

<OMS_HOME>/sysman/log/emoms.trc
<OMS_HOME>/sysman/log/emoms.log
}}}

output below 
{{{

2011-06-28 10:20:11 ./sysman/emd/state/0005.dlt
2011-06-28 10:20:11 ./sysman/emd/state/snapshot
2011-06-28 10:26:00 ./sysman/emd/cputrack/emagent_11747_2011-06-28_10-26-00_cpudiag.trc
2011-06-28 10:26:00 ./sysman/log/emctl.log
2011-06-28 10:28:43 ./sysman/emd/upload/EM_adaptive_thresholds.dat
2011-06-28 10:30:32 ./sysman/emd/state/parse-log-3CBBC0C79ED9B7E65B93EAC0D7457308
2011-06-28 10:30:39 ./sysman/emd/upload/mgmt_db_hdm_metric_helper.dat
2011-06-28 10:30:54 ./sysman/emd/upload/rawdata8.dat
2011-06-28 10:31:05 ./sysman/emd/state/adr/141DB5270B29BDF93743E123C2DF1231.alert.log.xml.state
2011-06-28 10:32:13 ./sysman/emd/state/adr/C12313AF3162E92001DE7952A752106A.alert.log.xml.state
2011-06-28 10:32:37 ./sysman/emd/upload/mgmt_ha_mttr.dat
2011-06-28 10:32:51 ./sysman/emd/upload/rawdata3.dat
2011-06-28 10:33:08 ./sysman/emd/state/adr/5A9DF4683EEF44F8898ABA391E70D194.alert.log.xml.state
2011-06-28 10:33:08 ./sysman/emd/upload/rawdata5.dat
2011-06-28 10:33:54 ./sysman/emd/agntstmp.txt
2011-06-28 10:33:55 ./sysman/emd/upload/rawdata0.dat
2011-06-28 10:34:06 ./sysman/emd/upload/rawdata9.dat
2011-06-28 10:34:09 ./sysman/emd/upload/rawdata2.dat
2011-06-28 10:34:21 ./sysman/emd/upload/rawdata4.dat
2011-06-28 10:34:25 ./sysman/emd/state/3CBBC0C79ED9B7E65B93EAC0D7457308.alerttd01db01.log
2011-06-28 10:34:25 ./sysman/emd/state/progResUtil.log
2011-06-28 10:34:27 ./sysman/emd/upload/rawdata7.dat
2011-06-28 10:34:28 ./sysman/log/emagent.trc


2011-06-28 09:51:42,537 Thread-1118013760 ERROR recvlets.aq: duplicate registration of metric Recovery_Area for target dbm rac_database
2011-06-28 09:51:42,537 Thread-1118013760 ERROR recvlets.aq: Unable to add metric Recovery_Area to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:42,537 Thread-1118013760 ERROR recvlets: Error adding metric Recovery_Area, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:42,538 Thread-1118013760 ERROR recvlets.aq: duplicate registration of metric Snap_Shot_Too_Old for target dbm rac_database
2011-06-28 09:51:42,538 Thread-1118013760 ERROR recvlets.aq: Unable to add metric Snap_Shot_Too_Old to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:42,538 Thread-1118013760 ERROR recvlets: Error adding metric Snap_Shot_Too_Old, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:42,538 Thread-1118013760 ERROR recvlets.aq: duplicate registration of metric WCR for target dbm rac_database
2011-06-28 09:51:42,538 Thread-1118013760 ERROR recvlets.aq: Unable to add metric WCR to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:42,538 Thread-1118013760 ERROR recvlets: Error adding metric WCR, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:42,539 Thread-1118013760 ERROR recvlets.aq: duplicate registration of metric wrc_client for target dbm rac_database
2011-06-28 09:51:42,539 Thread-1118013760 ERROR recvlets.aq: Unable to add metric wrc_client to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:42,539 Thread-1118013760 ERROR recvlets: Error adding metric wrc_client, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:42,540 Thread-1118013760 WARN  recvlets.aq: [oracle_database dbm_dbm1] deferred nmevqd_refreshState for dbm rac_database
2011-06-28 09:51:42,540 Thread-1118013760 WARN  upload: Upload manager has no Failure script: disabled
2011-06-28 09:51:48,569 Thread-1136912704 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:51:48,571 Thread-1136912704 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:51:48,575 Thread-1136912704 ERROR recvlets.aq: duplicate registration of metric problemTbsp for target dbm rac_database
2011-06-28 09:51:48,575 Thread-1136912704 ERROR recvlets.aq: Unable to add metric problemTbsp to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:48,575 Thread-1136912704 ERROR recvlets: Error adding metric problemTbsp, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets.aq: duplicate registration of metric Suspended_Session for target dbm rac_database
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets.aq: Unable to add metric Suspended_Session to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets: Error adding metric Suspended_Session, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets.aq: duplicate registration of metric Recovery_Area for target dbm rac_database
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets.aq: Unable to add metric Recovery_Area to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets: Error adding metric Recovery_Area, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets.aq: duplicate registration of metric Snap_Shot_Too_Old for target dbm rac_database
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets.aq: Unable to add metric Snap_Shot_Too_Old to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:48,576 Thread-1136912704 ERROR recvlets: Error adding metric Snap_Shot_Too_Old, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:48,577 Thread-1136912704 ERROR recvlets.aq: duplicate registration of metric WCR for target dbm rac_database
2011-06-28 09:51:48,577 Thread-1136912704 ERROR recvlets.aq: Unable to add metric WCR to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:48,577 Thread-1136912704 ERROR recvlets: Error adding metric WCR, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:48,577 Thread-1136912704 ERROR recvlets.aq: duplicate registration of metric wrc_client for target dbm rac_database
2011-06-28 09:51:48,577 Thread-1136912704 ERROR recvlets.aq: Unable to add metric wrc_client to AQDatabase [oracle_database dbm_dbm1] for rac_database dbm
2011-06-28 09:51:48,577 Thread-1136912704 ERROR recvlets: Error adding metric wrc_client, target dbm rac_database, to recvlet AQMetrics
2011-06-28 09:51:48,578 Thread-1136912704 WARN  recvlets.aq: [oracle_database dbm_dbm1] deferred nmevqd_refreshState for dbm rac_database
2011-06-28 09:51:48,579 Thread-1136912704 WARN  upload: Upload manager has no Failure script: disabled
2011-06-28 09:51:48,615 Thread-1136912704 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:51:48,617 Thread-1136912704 WARN  recvlets.aq: [oracle_database dbm_dbm1] deferred nmevqd_refreshState for dbm rac_database
2011-06-28 09:52:03,663 Thread-1130613056 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:52:03,669 Thread-1130613056 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:52:03,675 Thread-1130613056 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:52:03,678 Thread-1130613056 WARN  collector: the column name first_message_age in this condition does not exist in metric aq_msgs_persistentq_per_subscriber
2011-06-28 09:52:03,690 Thread-1130613056 WARN  recvlets.aq: [rac_database dbm] deferred nmevqd_refreshState for dbm rac_database
2011-06-28 09:52:03,691 Thread-1130613056 WARN  upload: Upload manager has no Failure script: disabled
2011-06-28 09:54:21,234 Thread-1136912704 ERROR vpxoci: ORA-03113: end-of-file on communication channel
2011-06-28 09:59:52,513 Thread-1146362176 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 09:59:52,513 Thread-1146362176 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 09:59:52,513 Thread-1146362176 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:00:41,308 Thread-1084578112 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:00:41,309 Thread-1084578112 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:00:41,309 Thread-1084578112 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:00:54,251 Thread-1146362176 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:00:54,251 Thread-1146362176 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:00:54,252 Thread-1146362176 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:01:11,931 Thread-1121163584 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:01:11,931 Thread-1121163584 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:01:11,932 Thread-1121163584 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:01:53,036 Thread-1130613056 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:01:53,036 Thread-1130613056 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:01:53,036 Thread-1130613056 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:34:28,828 Thread-1130613056 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:34:28,828 Thread-1130613056 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:34:28,828 Thread-1130613056 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo

2011-06-28 10:20:11 ./sysman/emd/state/snapshot
2011-06-28 10:26:00 ./sysman/emd/cputrack/emagent_11747_2011-06-28_10-26-00_cpudiag.trc
2011-06-28 10:26:00 ./sysman/log/emctl.log
2011-06-28 10:28:43 ./sysman/emd/upload/EM_adaptive_thresholds.dat
2011-06-28 10:30:32 ./sysman/emd/state/parse-log-3CBBC0C79ED9B7E65B93EAC0D7457308
2011-06-28 10:30:54 ./sysman/emd/upload/rawdata8.dat
2011-06-28 10:32:13 ./sysman/emd/state/adr/C12313AF3162E92001DE7952A752106A.alert.log.xml.state
2011-06-28 10:32:51 ./sysman/emd/upload/rawdata3.dat
2011-06-28 10:33:08 ./sysman/emd/state/adr/5A9DF4683EEF44F8898ABA391E70D194.alert.log.xml.state
2011-06-28 10:34:06 ./sysman/emd/upload/rawdata9.dat
2011-06-28 10:34:25 ./sysman/emd/state/3CBBC0C79ED9B7E65B93EAC0D7457308.alerttd01db01.log
2011-06-28 10:34:25 ./sysman/emd/state/progResUtil.log
2011-06-28 10:34:27 ./sysman/emd/upload/rawdata7.dat
2011-06-28 10:35:17 ./sysman/emd/upload/mgmt_ha_mttr.dat
2011-06-28 10:35:21 ./sysman/emd/upload/rawdata5.dat
2011-06-28 10:35:58 ./sysman/emd/upload/rawdata2.dat
2011-06-28 10:36:05 ./sysman/emd/state/adr/141DB5270B29BDF93743E123C2DF1231.alert.log.xml.state
2011-06-28 10:36:28 ./sysman/emd/upload/mgmt_db_hdm_metric_helper.dat
2011-06-28 10:36:32 ./sysman/emd/upload/rawdata4.dat
2011-06-28 10:36:37 ./sysman/log/emagent.trc
2011-06-28 10:36:51 ./sysman/emd/upload/rawdata0.dat
2011-06-28 10:36:54 ./sysman/emd/agntstmp.txt

[td01db01:oracle:dbm1] /home/oracle
> dcli -l oracle -g dbs_group id oracle
td01db01: uid=500(oracle) gid=500(oinstall) groups=500(oinstall),101(fuse),501(dba)
td01db02: uid=500(oracle) gid=500(oinstall) groups=500(oinstall),101(fuse),501(dba)
td01db03: uid=500(oracle) gid=500(oinstall) groups=500(oinstall),101(fuse),501(dba)
td01db04: uid=500(oracle) gid=500(oinstall) groups=500(oinstall),101(fuse),501(dba)

[td01db01:oracle:dbm1] /home/oracle
>

[td01db01:oracle:dbm1] /home/oracle
> dcli -l oracle -g dbs_group ls -l /u01/app/oracle/product/grid/agent11g/bin/nmo
td01db01: -rwxr-xr-x 1 oracle oinstall 32872 Jun 22 17:02 /u01/app/oracle/product/grid/agent11g/bin/nmo
td01db02: -rws--x--- 1 root oinstall 32872 Jun 22 16:07 /u01/app/oracle/product/grid/agent11g/bin/nmo
td01db03: -rws--x--- 1 root oinstall 32872 Jun 22 16:14 /u01/app/oracle/product/grid/agent11g/bin/nmo
td01db04: -rws--x--- 1 root oinstall 32872 Jun 22 16:14 /u01/app/oracle/product/grid/agent11g/bin/nmo


2011-06-28 10:01:53,036 Thread-1130613056 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:34:28,828 Thread-1130613056 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:34:28,828 Thread-1130613056 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:34:28,828 Thread-1130613056 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo
2011-06-28 10:36:37,862 Thread-1130613056 ERROR util.fileops: error: file /u01/app/oracle/product/grid/agent11g/bin/nmo is not a setuid file
2011-06-28 10:36:37,862 Thread-1130613056 WARN  Authentication: nmo binary in current oraHome doesn't have setuid privileges !!!
2011-06-28 10:36:37,863 Thread-1130613056 ERROR Authentication: altNmo binary doesn't exist ... reverting back to nmo


-rwxr-xr-x 1 oracle oinstall     5985 Jun 22 16:14 owm        | -rwxr-xr-x 1 oracle oinstall     5985 Jun 22 17:02 owm
-rwxr-xr-x 1 oracle oinstall     2994 Jun 22 16:14 orapki     | -rwxr-xr-x 1 oracle oinstall     2994 Jun 22 17:02 orapki
-rwxr-xr-x 1 oracle oinstall     2680 Jun 22 16:14 mkstore    | -rwxr-xr-x 1 oracle oinstall     2680 Jun 22 17:02 mkstore
-rwxr-xr-x 1 oracle oinstall     2326 Jun 22 16:14 bndlchk    | -rwxr-xr-x 1 oracle oinstall     2326 Jun 22 17:02 bndlchk
-rwxr-xr-x 1 oracle oinstall     3602 Jun 22 16:14 umu        | -rwxr-xr-x 1 oracle oinstall     3602 Jun 22 17:02 umu
-rwxr-xr-x 1 oracle oinstall     1641 Jun 22 16:14 eusm       | -rwxr-xr-x 1 oracle oinstall     1641 Jun 22 17:02 eusm
-rwxr-xr-x 1 oracle oinstall    60783 Jun 22 16:14 chronos_se | -rwxr-xr-x 1 oracle oinstall    60783 Jun 22 17:02 chronos_se
-rwxr-xr-x 1 oracle oinstall     1551 Jun 22 16:14 chronos_se | -rwxr-xr-x 1 oracle oinstall     1551 Jun 22 17:02 chronos_se
-rwxr-x--x 1 oracle oinstall    19217 Jun 22 16:14 tnsping    | -rwxr-x--x 1 oracle oinstall    19217 Jun 22 17:02 tnsping
-rwxr-x--x 1 oracle oinstall   418787 Jun 22 16:14 wrc        | -rwxr-x--x 1 oracle oinstall   418787 Jun 22 17:02 wrc
-rwxr-x--x 1 oracle oinstall    25297 Jun 22 16:14 adrci      | -rwxr-x--x 1 oracle oinstall    25297 Jun 22 17:02 adrci
-rwxr-x--x 1 oracle oinstall 16793110 Jun 22 16:14 rmanO      | -rwxr-x--x 1 oracle oinstall 16793110 Jun 22 17:02 rmanO
-rwxr-xr-x 1 oracle oinstall   227069 Jun 22 16:14 ojmxtool   | -rwxr-xr-x 1 oracle oinstall   227069 Jun 22 17:02 ojmxtool
-rwxr-xr-x 1 oracle oinstall    26061 Jun 22 16:14 nmupm      | -rwxr-xr-x 1 oracle oinstall    26061 Jun 22 17:02 nmupm
-rwxr-xr-x 1 oracle oinstall    84093 Jun 22 16:14 nmei       | -rwxr-xr-x 1 oracle oinstall    84093 Jun 22 17:02 nmei
-rwx------ 1 oracle oinstall   112352 Jun 22 16:14 emdctl     | -rwx------ 1 oracle oinstall   112352 Jun 22 17:02 emdctl
-rwxr-xr-x 1 oracle oinstall    37130 Jun 22 16:14 emagtmc    | -rwxr-xr-x 1 oracle oinstall    54596 Jun 22 17:02 emagtm
-rwxr-xr-x 1 oracle oinstall    54596 Jun 22 16:14 emagtm     | -rwx------ 1 oracle oinstall    15461 Jun 22 17:02 emagent
-rwx------ 1 oracle oinstall    15461 Jun 22 16:14 emagent    | -rwxr-xr-x 1 oracle oinstall      656 Jun 22 17:02 commonenv.
-rwxr-xr-x 1 oracle oinstall      656 Jun 22 16:14 commonenv. | -rwx------ 1 oracle oinstall      347 Jun 22 17:02 opmnassoci
-rwx------ 1 oracle oinstall      347 Jun 22 16:14 opmnassoci | -rwxr-xr-x 1 oracle oinstall     2934 Jun 22 17:02 onsctl.opm
-rwxr-xr-x 1 oracle oinstall     2934 Jun 22 16:14 onsctl.opm | -rwxr-xr-x 1 oracle oinstall   484287 Jun 22 17:02 nmosudo
-rwxr-xr-x 1 oracle oinstall   484287 Jun 22 16:14 nmosudo    | -rwxr-xr-x 1 oracle oinstall    24725 Jun 22 17:02 nmocat
-rwxr-xr-x 1 oracle oinstall    24725 Jun 22 16:14 nmocat     | -rwxr-xr-x 1 oracle oinstall    32872 Jun 22 17:02 nmo.0
-rwxr-xr-x 1 oracle oinstall    32872 Jun 22 16:14 nmo.0      | -rwxr-xr-x 1 oracle oinstall    32872 Jun 22 17:02 nmo
-rws--x--- 1 root   oinstall    32872 Jun 22 16:14 nmo        | -rwxr-xr-x 1 oracle oinstall    58483 Jun 22 17:02 nmhs.0
-rwxr-xr-x 1 oracle oinstall    58483 Jun 22 16:14 nmhs.0     | -rwxr-xr-x 1 oracle oinstall    58483 Jun 22 17:02 nmhs
-rws--x--- 1 root   oinstall    58483 Jun 22 16:14 nmhs       | -rwxr-xr-x 1 oracle oinstall    22746 Jun 22 17:02 nmb.0
-rwxr-xr-x 1 oracle oinstall    22746 Jun 22 16:14 nmb.0      | -rwxr-xr-x 1 oracle oinstall    22746 Jun 22 17:02 nmb
-rws--x--- 1 root   oinstall    22746 Jun 22 16:14 nmb        | -rwsr-s--- 1 oracle oinstall    76234 Jun 22 17:02 emtgtctl2
-rwsr-s--- 1 oracle oinstall    76234 Jun 22 16:14 emtgtctl2  | -rwxr-xr-x 1 oracle oinstall  3895446 Jun 22 17:02 emsubagent
-rwxr-xr-x 1 oracle oinstall  3895446 Jun 22 16:14 emsubagent | -rwxr-xr-x 1 oracle oinstall    37130 Jun 22 17:02 emagtmc
-rwxr-xr-x 1 oracle oinstall  3031365 Jun 22 16:14 e2eme      | -rwxr-xr-x 1 oracle oinstall  3031365 Jun 22 17:02 e2eme
-rwx------ 1 oracle oinstall     1634 Jun 22 16:14 dmstool    | -rwx------ 1 oracle oinstall     1634 Jun 22 17:02 dmstool
-rwxr-xr-x 1 oracle oinstall     2639 Jun 22 16:14 db2gc      | -rwxr-xr-x 1 oracle oinstall     2639 Jun 22 17:02 db2gc
-rwxr-xr-x 1 oracle oinstall     5258 Jun 22 16:14 emutil     | -rwxr-xr-x 1 oracle oinstall     5258 Jun 22 17:02 emutil
-rwxr-xr-x 1 oracle oinstall     1516 Jun 22 16:14 emtgtctl   | -rwxr-xr-x 1 oracle oinstall     1516 Jun 22 17:02 emtgtctl
-rwx------ 1 oracle oinstall    19063 Jun 22 16:14 emctl.pl   | -rwx------ 1 oracle oinstall    19063 Jun 22 17:02 emctl.pl
-rwxr--r-- 1 oracle oinstall    14476 Jun 22 16:14 emctl      | -rwxr--r-- 1 oracle oinstall    14476 Jun 22 17:02 emctl
-rwxr-xr-x 1 oracle oinstall      641 Jun 22 16:14 commonenv  | -rwxr-xr-x 1 oracle oinstall      641 Jun 22 17:02 commonenv
-rwxr-xr-x 1 oracle oinstall      701 Jun 22 16:14 agentca    | -rwxr-xr-x 1 oracle oinstall      701 Jun 22 17:02 agentca
-rwxr-x--x 1 oracle oinstall 16792553 Jun 22 16:14 rman       | -rwxr-x--x 1 oracle oinstall 16792553 Jun 22 17:03 rman

}}}
Grid Control Target Maintenance: Steps to Diagnose Issues Related to "Agent Unreachable" Status [ID 271126.1]
In Grid Control Receiving Agent Unreachable Notification Emails Very Often After 10.2.0.4 Agent Upgrade [ID 752296.1]
https://blogs.oracle.com/db/entry/oracle_support_master_note_for_10g_grid_control_enterprise_manager_communication_and_upload_issues_d
http://wikis.sun.com/display/Performance/Aligning+Flash+Modules+for+Optimal+Performance
http://blogs.oracle.com/lisan/entry/io_sizes_and_alignments_with
http://guyharrison.squarespace.com/blog/2011/6/8/a-first-look-at-oracle-on-amazon-rds.html

High perf IOPS on AWS http://aws.typepad.com/aws/2012/09/new-high-performance-provisioned-iops-amazon-rds.html

service dashboard status http://status.aws.amazon.com/

''a Systematic Look at EC2 I/O'' http://blog.scalyr.com/2012/10/16/a-systematic-look-at-ec2-io/

''EC2 compute units'' http://gevaperry.typepad.com/main/2009/03/figuring-out-the-roi-of-infrastructureasaservice.html, http://stackoverflow.com/questions/4849723/a-question-about-amazon-ec2-compute-units

Find Answers Faster
By Jonathan Gennick and Anthony Molinaro 
http://www.oracle.com/technology/oramag/oracle/05-mar/o25dba.html

LAG
http://www.appsdba.com/blog/?p=383

CAST function
http://www.oracle.com/technetwork/database/focus-areas/manageability/diag-pack-ow08-131537.pdf
http://psoug.org/reference/cast.html

SQL – RANK, MAX Analytical Functions, DECODE, SIGN
http://hoopercharles.wordpress.com/2009/12/26/sql-–-rank-max-analytical-functions-decode-sign/


http://www.slideshare.net/hamcdc/sep13-analytics
http://www.odtug.com/p/cm/ld/fid=65&tid=35&sid=972
http://www.amazon.com/Window-Functions-SQL-Jonathan-Gennick-ebook/dp/B006YITKJO/ref=sr_1_2?ie=UTF8&qid=1385753351&sr=8-2&keywords=window+functions+in+sql
http://gennick.com/database/?tag=WindowSS

Analytic Functions in Oracle 8i Srikanth Bellamkonda  http://infolab.stanford.edu/infoseminar/archive/SpringY2000/speakers/agupta/paper.pdf
Enhanced subquery optimizations in Oracle http://www.vldb.org/pvldb/2/vldb09-423.pdf
Analytic SQL in 12c http://www.oracle.com/technetwork/database/bi-datawarehousing/wp-in-database-analytics-12c-2132656.pdf
Adaptive and big data scale parallel execution in oracle http://dl.acm.org/citation.cfm?id=2536235






https://forums.oracle.com/forums/thread.jspa?threadID=2220970

''analyze table sysadm.PSOPRDEFN                   validate structure cascade online ; ''
''andrew ng''
publications http://cs.stanford.edu/people/ang/?page_id=414
http://en.wikipedia.org/wiki/Andrew_Ng
http://cs.stanford.edu/people/ang/
http://creiley.wordpress.com/
https://www.coursera.org/course/ml

Oracle Clusterware and Application Failover Management [ID 790189.1]

Application Management http://www.oracle.com/technetwork/oem/app-mgmt/app-mgmt-084358.html


http://onlineappsdba.com/index.php/2010/08/30/time-out-while-waiting-for-a-managed-process-to-stop-http_server/

cman http://arup.blogspot.com/2011/08/setting-up-oracle-connection-manager.html
Database Resident Connection Pool (drcp) http://www.oracle-base.com/articles/11g/database-resident-connection-pool-11gr1.php	

[img(50%,50%)[ https://lh6.googleusercontent.com/-TEaGT5fnFH0/UZpDd8TgAaI/AAAAAAAAB7A/EqsT3qE_WLg/w599-h798-no/timfoxconnectionpool.JPG ]]

[img(5