<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6964914631494495523</id><updated>2012-02-16T06:16:58.864-05:00</updated><category term='Oracle Check for Blocking Locks'/><category term='Oracle Advanced Compression'/><category term='Move OEM Grid Agent to another OMS'/><category term='Oracle see who has been granted SYSDBA'/><category term='Oracle 11g REF Partitioning'/><category term='Oracle Table Data Compression'/><category term='Setup Oracle Flashback Database'/><category term='Oracle Heterogenenous Connectivity to MySQL'/><category term='Oracle Flashback Query'/><category term='Rebuild targets.xml for Oracle Enterprise Manager Grid Control Agent'/><category term='Central AWR Update 1'/><category term='Oracle Index Key Compression'/><category term='Oracle ASM Management Overview'/><category term='Monitoring and Tuning Oracle Flashback Capabilities'/><category term='Oracle Flashback Table'/><category term='RMAN Proactive Health Check'/><category term='Oracle Hidden (_) Parameter Values'/><category term='RMAN Backup using a Wallet for Authentication'/><category term='Oracle Global Temporary Tables'/><category term='Oracle 11g RMAN New Compression Type (ZLIB)'/><category term='Oracle Audit Failed Login Attempts'/><category term='Accessing Monitored Database Objects with OEM Grid Control Reports'/><category term='Oracle 11g Interval Partitioning'/><category term='Oracle Fine Grained Auditing'/><category term='RMAN Data Recovery Advisor'/><category term='Oracle Flashback Transaction Query'/><category term='Oracle Stored Outlines'/><category term='Setup Oracle Transactional Flashback Capability (Automatic Undo)'/><category term='Rename Target in OEM Grid Control Without Removing Target'/><category term='Add Remove ASM Disk Groups on Live Database'/><title type='text'>MRMESSIN Oracle Database Administration</title><subtitle type='html'>Just some thoughts, experiences, test results all from  being an Oracle DBA.  Everything here was put here to possibly be helpful to myself and others in the future.  Please as all good Oracle DBAs should, test everything in a sand box environment before trying in production.  

Any views expressed are my own and do not reflect the views of my employer in anyway.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>60</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8294463153118733422</id><published>2012-02-13T15:17:00.000-05:00</published><updated>2012-02-13T15:17:50.698-05:00</updated><title type='text'>ASM Move ASM Disk from one disk group to another, when using ASMlib rename the ASM Disk</title><content type='html'>1. determine the disk group asm disk that you want to move, this SQL will provide a list of the ASM diskgroups and their associated disks, ensure that you use the size values to determine that if you remove a disk from the disk group that you have enough free space to do so.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;select dg.name, d.name, d.label, dg.type, d.path, d.state, d.OS_MB, d.TOTAL_MB, d.FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;from v$asm_disk d, v$asm_diskgroup dg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;where dg.group_number = d.group_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;order by dg.name, d.name ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Select the disk to remove, in this case we will select RECO3 to remove from the RECO Disk Group.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set head off&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;select dg.name, d.name, d.label, dg.type, d.path, d.state, d.OS_MB, d.TOTAL_MB, d.FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;from v$asm_disk d, v$asm_diskgroup dg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;where dg.group_number = d.group_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; and dg.name = 'RECO'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;order by dg.name, d.name ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO RECO1 RECO1 EXTERN&lt;/span&gt; &lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:RECO1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 15606&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO RECO2 RECO2 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:RECO2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 15605&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO RECO3 RECO3 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:RECO3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 15607&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Remove the ASM disk from the disk group&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SQL&amp;gt; alter diskgroup RECO drop disk RECO3 ; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Diskgroup altered.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. monitor the disk group rebal operation that removes the disk until complete.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SQL&amp;gt; select * from v$asm_operation;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ERROR_CODE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;--------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;3 REBAL RUN 1 1 570 10189 903 10&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;1 row selected.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SQL&amp;gt; select * from v$asm_operation;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;no rows selected&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. ensure the disk is no longer part of the diskgroup&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;select dg.name, d.name, d.label, dg.type, d.path, d.state, d.OS_MB, d.TOTAL_MB, d.FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;from v$asm_disk d, v$asm_diskgroup dg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;where dg.group_number = d.group_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;and dg.name = 'RECO'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;order by dg.name, d.name ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NAME NAME LABEL TYPE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;------------------------------ ------------------------------ ------------------------------- ------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;----------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;STATE OS_MB TOTAL_MB FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;-------- ---------- ---------- ----------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO RECO1 RECO1 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:RECO1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 10912&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO RECO2 RECO2 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:RECO2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 10909&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. To rename the ASM disk removed to match the disk names of the disk group you are putting the disk into&lt;br /&gt;in this example we are taking the disk from RECO (disk RECO3) and putting into the DATA disk group, some may want to rename the ASM disk from RECO03 to DATA5 to match the new diskgroup &lt;br /&gt;** DATA4 Name is already used as an ASM disk name, but not and ASM lib disk name.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;select dg.name, d.name, d.label, dg.type, d.path, d.state, d.OS_MB, d.TOTAL_MB, d.FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;from v$asm_disk d, v$asm_diskgroup dg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;where dg.group_number = d.group_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;and dg.name = 'DATA'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;order by dg.name, d.name ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NAME NAME LABEL TYPE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;------------------------------ ------------------------------ ------------------------------- ------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;----------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;STATE OS_MB TOTAL_MB FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;-------- ---------- ---------- ---------- &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA1 DATA1 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 8192&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA2 DATA2 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 8193&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA3 DATA3 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 8195&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA4 STAGEASMDATA4 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:STAGEASMDATA4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24995 24995 8192&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Ensure the name we want to use is not used in an ASM Name already.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_group_name format a20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_file_path format a30&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_file_name format a20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_file_fail_group format a20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SELECT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NVL(a.name, '[CANDIDATE]') disk_group_name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;, b.path disk_file_path&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;, b.name disk_file_name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;, b.failgroup disk_file_fail_group&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;FROM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORDER BY&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;a.name;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DISK_GROUP_NAME DISK_FILE_PATH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISK_FILE_NAME FILE_FAIL_GROUP&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;--------------- ------------------ -------------- ---------------&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:STAGEASMDATA4 DATA4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DATA4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:DATA1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:DATA2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:DATA3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:OCR_VOTE01&amp;nbsp;&amp;nbsp;&amp;nbsp; OCR_VOTE01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCR_VOTE01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:OCR_VOTE03&amp;nbsp;&amp;nbsp;&amp;nbsp; OCR_VOTE03&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCR_VOTE03&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:OCR_VOTE02&amp;nbsp;&amp;nbsp;&amp;nbsp; OCR_VOTE02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCR_VOTE02&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:RECO2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECO2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECO2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORCL:RECO1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECO1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECO1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;** As we see here the ASMlib name and DISKFILE NAME do not match, this will cause as disk name issue so we have to give our new disk a different name to avoid a duplicate name in the ASM instance.&lt;br /&gt;In our case we will use DATA5 as it is not used already.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. When using ASM lib you can rename the disk using ASM lib best to do as root, when using OS level, check the OS level name and change it there for most operating systems there is no change need unless the device name changes. When using the OS check the device name which would be the disk path as they can be name when using multi path so use the configuration there to rename.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;[root]# /etc/init.d/oracleasm querydisk -p RECO3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Disk "RECO3" is a valid ASM disk&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;/dev/sdk1: LABEL="RECO3" TYPE="oracleasm" &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;[root]# /etc/init.d/oracleasm force-renamedisk RECO3 DATA5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Renaming disk "RECO3" to "DATA5": [ OK ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. list the disks if using ASMlib, to ensure the disk is renamed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;[root]# /etc/init.d/oracleasm listdisks&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE02&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE03&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;STAGEASMDATA4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. Ensure disk is a candidate disk now to be added to a diskgroup.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_group_name format a20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_file_path format a30&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_file_name format a20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;column disk_file_fail_group format a20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SELECT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NVL(a.name, '[CANDIDATE]') disk_group_name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;, b.path disk_file_path&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;, b.name disk_file_name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;, b.failgroup disk_file_fail_group&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;FROM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORDER BY&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;a.name;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DISK_GROUP_NAME DISK_FILE_PATH DISK_FILE_NAME FILE_FAIL_GROUP&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;--------------- ------------------ -------------- ---------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA ORCL:STAGEASMDATA4 DATA4 DATA4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA ORCL:DATA1 DATA1 DATA1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA ORCL:DATA2 DATA2 DATA2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA ORCL:DATA3 DATA3 DATA3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE ORCL:OCR_VOTE01 OCR_VOTE01 OCR_VOTE01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE ORCL:OCR_VOTE03 OCR_VOTE03 OCR_VOTE03&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OCR_VOTE ORCL:OCR_VOTE02 OCR_VOTE02 OCR_VOTE02&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO ORCL:RECO2 RECO2 RECO2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RECO ORCL:RECO1 RECO1 RECO1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;[CANDIDATE] ORCL:DATA5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. Add disk to disk to group, in our case disk DATA4 to diskgroup DATA&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SQL&amp;gt; alter diskgroup DATA add disk 'ORCL:DATA5' ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Diskgroup altered.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. Monitor Rebal operation that is bringing in the new disk &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select * from v$asm_operation;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ERROR_CODE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;--------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;1 REBAL RUN 1 1 682 13467 987 12&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;SQL&amp;gt; select * from v$asm_operation;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;no rows selected&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;11. Ensure the disk is now part of the diskgroup&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;set pagesize 1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;select dg.name, d.name, d.label, dg.type, d.path, d.state, d.OS_MB, d.TOTAL_MB, d.FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;from v$asm_disk d, v$asm_diskgroup dg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;where dg.group_number = d.group_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;and dg.name = 'DATA'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;order by dg.name, d.name ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NAME NAME LABEL TYPE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;------------------------------ ------------------------------ ------------------------------- ------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;----------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;STATE OS_MB TOTAL_MB FREE_MB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;-------- ---------- ---------- ----------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA1 DATA1 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 11525&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA2 DATA2 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 11525&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA3 DATA3 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 11525&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA4 STAGEASMDATA4 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:STAGEASMDATA4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 25995 25995 11985&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;DATA DATA5 DATA5 EXTERN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;ORCL:DATA5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;NORMAL 24999 24999 11527&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8294463153118733422?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8294463153118733422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8294463153118733422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8294463153118733422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8294463153118733422'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2012/02/asm-move-asm-disk-from-one-disk-group.html' title='ASM Move ASM Disk from one disk group to another, when using ASMlib rename the ASM Disk'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-1472995106855312607</id><published>2011-08-11T10:51:00.000-04:00</published><updated>2011-08-11T10:51:43.290-04:00</updated><title type='text'>Optimal Undo Tablespace Size and Undo Retention</title><content type='html'>The undo tablespace and its size is related to the retention period and the transactional activity of the database.&amp;nbsp; These must be regularly reviewed and check to ensure that 1, you are not trying to have a retention period that the undo tablespace can not handle, 2 that you are size properly so that you do not encounter the dreaded ORA-01555 snapshot too old.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Optimal Undo Size and Retention&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;I have seen many environments where the undo tablespace is far to small for the undo retention setting and they target undo retention the environment requires.&amp;nbsp; This is due to the fact that the undo tablespace was size and undo retention set, but never rechecked or updated as the environment grew or activity changed.&amp;nbsp; Therefore if the expectation is that a flashback query can go back 2 hours, but the tablespace is too small the reality is that they really can not go back 2 hours.&lt;br /&gt;&lt;br /&gt;First we need to check the Optimal Undo Size based on our desired retention as in most environments this will change regularly based on increases or decreases in the trasnactional activity.&lt;br /&gt;&lt;br /&gt;The script below will ask for the desired undo retention, then will examine your database and tell you the optimal undo retention setting for the current environment as the undo tablespace size and transactional activity indicates, but will also show you what the size of the undo tablespace needs to be to be able to support the desired undo retention you have entered. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;---------------------------------------------------------------------------------&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;-- Script: see_optimal_undo_retention.sql&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;-- Author: Michael Messina, Management Consultant TUSC a Rolta Company&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;--&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;-- Description:&amp;nbsp; Will calculate based on undo utilization and undo size&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the optimal value for undo_retention.&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;---------------------------------------------------------------------------------&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;set serveroutput on size 1000000&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;set feedback off&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ACCEPT desired_undo_retention PROMPT "Enter Desired Undo Retention in Seconds -&amp;gt;" &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DECLARE &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_desired_undo_retention&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER := &amp;amp;desired_undo_retention ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_block_size&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_undo_size&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_undo_blocks_per_sec&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_optimal_undo_retention&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_current_undo_retention&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_undo_size_desired_ret&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;BEGIN&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; -- get the current undo retention setting&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; select TO_NUMBER(value)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; INTO v_current_undo_retention&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; FROM v$parameter&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; WHERE name = 'undo_retention' ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; -- Calculate Actual Undo Size&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; SELECT SUM(a.bytes) &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; INTO v_undo_size&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; FROM v$datafile a,&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v$tablespace b,&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dba_tablespaces c&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; WHERE c.contents = 'UNDO'&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND c.status = 'ONLINE'&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b.name = c.tablespace_name&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND a.ts# = b.ts#;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; -- Calcuate the Undo Blocks per Second&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; SELECT MAX(undoblks/((end_time-begin_time)*3600*24))&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; INTO v_undo_blocks_per_sec&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; FROM v$undostat ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; -- Get the database block size&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; SELECT TO_NUMBER(value) &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; INTO v_block_size&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; FROM v$parameter&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; WHERE name = 'db_block_size';&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_optimal_undo_retention := v_undo_size/(v_block_size * v_undo_blocks_per_sec) ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; v_undo_size_desired_ret := ((v_block_size * v_undo_blocks_per_sec) * (v_desired_undo_retention)) / 1024 / 1024 ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; DBMS_OUTPUT.PUT_LINE ('&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Current undo Size --&amp;gt; ' || TO_CHAR(v_undo_size/1024/1024) || 'MB') ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; DBMS_OUTPUT.PUT_LINE (' Current undo_retention Setting --&amp;gt; ' || TO_CHAR(v_current_undo_retention) || ' Seconds') ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; DBMS_OUTPUT.PUT_LINE (' Optimal undo_retention Setting --&amp;gt; ' || TO_CHAR(ROUND(v_optimal_undo_retention,2)) || ' Seconds') ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; DBMS_OUTPUT.PUT_LINE (' Desired undo_retention Setting --&amp;gt; ' || TO_CHAR(ROUND(v_desired_undo_retention,2)) || ' Seconds') ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; DBMS_OUTPUT.PUT_LINE ('Undo Size for desired retention --&amp;gt; ' || TO_CHAR(ROUND(v_undo_size_desired_ret,2)) || 'MB') ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;END ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Example Execution of script:&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;SQL&amp;gt; @see_optimal_undo_retention.sql&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Enter Desired Undo Retention in Seconds -&amp;gt;7200&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;old&amp;nbsp;&amp;nbsp; 2:&amp;nbsp;&amp;nbsp;&amp;nbsp; v_desired_undo_retention&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER := &amp;amp;desired_undo_retention ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;new&amp;nbsp;&amp;nbsp; 2:&amp;nbsp;&amp;nbsp;&amp;nbsp; v_desired_undo_retention&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER := 7200 ;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Current undo Size --&amp;gt; 1980MB&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Current undo_retention Setting --&amp;gt; 900 Seconds&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Optimal undo_retention Setting --&amp;gt; 100504.96 Seconds&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Desired undo_retention Setting --&amp;gt; 7200 Seconds&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Undo Size for desired retention --&amp;gt; 141.84MB&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this example on a very small database with no activity I want a retention of 2 hours, The output shows the current undo tablespace size, the current undo retention setting, the optimal undo retention setting indicates what I could make the undo retention based on the current activity and size of the undo tablespace, the desired undo retention that I entered and the undo tablespace size required to meet my desired undo retention setting.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-1472995106855312607?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/1472995106855312607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=1472995106855312607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1472995106855312607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1472995106855312607'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2011/08/optimal-undo-tablespace-size-and-undo.html' title='Optimal Undo Tablespace Size and Undo Retention'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-4911458774323540878</id><published>2011-08-09T19:57:00.001-04:00</published><updated>2011-08-09T19:59:55.836-04:00</updated><title type='text'>SQL Performance Analyzer, Step 2 Create Analysis Task, Make the Changes and  Review Impact</title><content type='html'>I started this with the goal of being able to measure the impact of partitioning a table or set of tables.&amp;nbsp; The first Step is to get all the SQL I can from the system that executes against the table(s) that are intended to be partitioned so that we can ensure that we make a positive impact on the SQL and ensure that we are not going to make a negative impact on any existing SQL.&lt;br /&gt;&lt;br /&gt;In this case I am choosing to use SQL Performance Analyzer to measure the impact on the SQL I gathered into my SQL Tuning Set&amp;nbsp; from &lt;br /&gt;&lt;br /&gt;&lt;i&gt;** Keep in mind I am using a test environment where I can capture the SQL, execute and measure my changes all in the same database, in same cases you may need to capture the SQL tuning set in production and then transfer the SQL Tuning Set to a test environment to execute the analysis make the changes and then make the comparison.&amp;nbsp; See &lt;a href="http://oramrmessin.blogspot.com/2010/02/transfer-sql-tuning-sets-between.html"&gt;Transfer SQL Tuning Sets between Databases&lt;/a&gt; post from October 2010.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Create an Analysis Task&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;In this case I will be using the dbms_sqlpa package using the create_analysis_task which will allow me to analyze the SQL in my SQL Tuning Set which is the SQL I captured that executes against the table(s) I am planning on partitioning.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;dbms_sqlpa.create_analysis_task(sqlset_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;STS_SPA_1&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;task_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;sts_spa1_task&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;description =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;test partitioning&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Execute the Analysis Task&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Once the Analysis Task has been created we will need to execute the task to create the baseline that will be used to compare against after we make the changes.&amp;nbsp; We will be using the dbms_sqlpa package and the execute_analysis_task procedure.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-left: 0.25in;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;dbms_sqlpa.execute_analysis_task(task_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;STS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;_SPA1_task&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-left: 0.25in;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_type =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;test execute&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-left: 0.25in;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;before_partition_change&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Once the execution of the analysis task is complete we can make our changes.&amp;nbsp; Once the change has been made then we will need to execute another analysis task to get the information to compare against the base after the change.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;dbms_sqlpa.execute_analysis_task(task_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;STS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;_SPA1_task&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_type =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;test execute&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;after_partition_change&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;); &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Compare Analysis Task&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Once the initial analysis task is done, the change is made the post analysis task is done we are read yo compare the initial to the after.&amp;nbsp; Again we will use the dbms_sqlpa package, this time we will use the execute_analysis task again but will set the analysis to compare performance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;dbms_sqlpa.execute_analysis_task(&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;task_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;STS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;_SPA1_task&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_type =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;compare performance&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_name =&amp;gt; &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;analysis_results&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_params =&amp;gt; dbms_advisor.arglist(&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_name1&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;before_partition_change&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;execution_name2&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;, &lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;after_partition_change&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: .25in;"&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;comparison_metric&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;,&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;buffer_gets&lt;/span&gt;&lt;span style="color: black;"&gt;‘&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;));&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Run Compare Report&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Once the Compare Analysis is complete we can run a report that will show us the results of the compare analysis.&amp;nbsp; The follow short script will output to a file called SPA_COMPARE_REPORT.out 3 possible reports, the first being the full analysis report, the second being a summary report and the 3 being like a top offenders report called a finding report from the analysis.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/pre&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;-- Script: spa_compare.sql&lt;/span&gt;&lt;/pre&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;-- Author; Michael R. Messina, Managing Consultant&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;-- Rolta-TUSC, Infrastructure Services&lt;/span&gt;&lt;/pre&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;--&lt;/span&gt;&lt;/pre&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;-- Executes a SQL Tuning Set Comparison and then outputs a report&lt;/span&gt;&lt;/pre&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;-- from Performance Analyzer. &lt;/span&gt;&lt;/pre&gt;&lt;pre style="tab-stops: .5in 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;spool SPA_COMPARE_REPORT.out&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;-- Get the whole report for the single statement case.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;SELECT DBMS_SQLPA.REPORT_ANALYSIS_TASK(&lt;/span&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;STS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;_SPA1_task&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;'&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;) from dual;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;-- Show me the summary for the sts case.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;SELECT DBMS_SQLPA.REPORT_ANALYSIS_TASK(&lt;/span&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;STS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;_SPA1_task&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;'&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;, 'TEXT', 'TYPICAL', 'SUMMARY')&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;FROM DUAL;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;-- Show me the findings for the statement I'm interested in.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;SELECT DBMS_SQLPA.REPORT_ANALYSIS_TASK(&lt;/span&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;STS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;_SPA1_task&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN" style="font-size: 9pt;"&gt;'&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;, 'TEXT', 'TYPICAL', 'FINDINGS', 5) from dual;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt;"&gt;spool off&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-4911458774323540878?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/4911458774323540878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=4911458774323540878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4911458774323540878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4911458774323540878'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2011/08/sql-performance-analyzer-step-2-create.html' title='SQL Performance Analyzer, Step 2 Create Analysis Task, Make the Changes and  Review Impact'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-5385715102823990302</id><published>2011-08-09T19:31:00.000-04:00</published><updated>2011-08-09T19:31:33.196-04:00</updated><title type='text'>SQL Performance Analyzer, Step 1 Create a SQL Tuning Set</title><content type='html'>I was dealing with a performance issue for a particular application  and wanted to partition the table then measure the impact of the  partitioning based on the the SQL uses that table.&amp;nbsp; This got me thinking  how could make use of SQL performance Analyzer for this that way I  could have the before and after analysis.&lt;br /&gt;&lt;br /&gt;First step  would be to gather the SQL that executes against the table from the live  production system.&amp;nbsp; We can do this by creating a SQL tuning set and  putting that SQL into that SQL tuning set.&amp;nbsp; We would base this SQL  tuning set on tuning set from the cache over a period time to capture  the SQL into our SQL tuning set for the SQL that executes on the table.&amp;nbsp;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Create a SQL Tuning Set&lt;/h2&gt;&lt;div class="MsoNoSpacing"&gt;We can use the DBMS_SQLTUNE package to create the SQL tuning set with the SQL that executes against the table.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;For example if we want to capture the SQL execute against the table for a 24 hour period, take a sample at 5 minute intervals it would looks like the following.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;We create a SQL Tuning Set called STS_SPA_1, then setup the capture of the SQL Tuning Set to come from the cursor cache over a the 24 hour period for just the SQL that contains ORDER for the ORDERS and ORDERS_ITEMS tables.&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- Script: spa_create_sts.sql&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- Author; Michael R. Messina, Managing Consultant &lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- Rolta-TUSC, Infrastructure Services&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;--&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- Setup a SQL Tuning Set to create a for the SQL&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- This will serve SQL Performance Analyzer well or allow us to create profiles.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- From there we can make generate before and after pictures&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- Then evaluate the impact of changes.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;--&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;set feedback on&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- Set up the SQL Set and what sql we want to make&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;-- part of the sql tuning set&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;BEGIN&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- Create the sql set&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DBMS_SQLTUNE.CREATE_SQLSET(sqlset_name =&amp;gt; 'STS_SPA_1');&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- Limit the sql in the set to Just on the ORDERS and ORDER_ITEMS&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- The CAPTURE_CURSOR_CACHE_SQLSET will collect SQL statements&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- over a peeriod of time from the cursor cache.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This helps build a more realistic&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- set of SQL load from the system by capturing the live SQL for 24 hours at 5 min&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- intervals&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DBMS_SQLTUNE.CAPTURE_CURSOR_CACHE_SQLSET(&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sqlset_name =&amp;gt; 'STS_SPA_1'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;,basic_filter=&amp;gt; q'#UPPER(sql_text) LIKE '%ORDER%' #'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;,time_limit&lt;span&gt;&amp;nbsp; &lt;/span&gt;=&amp;gt; 86400&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt; &lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;,repeat_interval =&amp;gt; 300&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;END;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: xx-small;"&gt; &lt;/span&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span&gt;/&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 8pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 8pt;"&gt;** I would show the steps for Grid Control except the blog would never save with the Grid&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 8pt;"&gt;Images. &lt;/span&gt;&lt;/pre&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;The next Step will be to use the SQL Tuning Set to compare a before and  after our changes, which I will be doing with SQL Performance Analyzer.&amp;nbsp; To do this we Create an analysis task..... SQL Performance Analyzer, Step 2 Create Analysis Task &lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-5385715102823990302?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/5385715102823990302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=5385715102823990302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5385715102823990302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5385715102823990302'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2011/08/sql-performance-analyzer-step-1-create.html' title='SQL Performance Analyzer, Step 1 Create a SQL Tuning Set'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-2182799719731468119</id><published>2011-04-05T11:45:00.014-04:00</published><updated>2011-04-05T11:53:24.789-04:00</updated><title type='text'>Configure SQL Net using Infiniband Interface</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Infiniband&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNormal"&gt;Infiniband is a high speed network interface typically utilized in System/Storage Area Networks (SANs) which are networks connecting machines and storage in close proximity and require very low latency and very high bandwidth. Oracle has supported the use of infiniband for SQL Net traffic for quite some time.&amp;nbsp; Typically TCP over Infiniband has been utilized.&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;Sockets Direct Protocol Support&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNormal"&gt;The Sockets Direct Protocol (SDP) is a standard protocol for Infiniband.&amp;nbsp; The SDP protocol is an interface the moves most of the messaging burden to the network interface card therefore reducing the amount of host CPU involved.&amp;nbsp; This frees the host CPU bandwidth for other processing.&amp;nbsp; &amp;nbsp;This is a big advantage for mid-tier server connections to the database that require high performance communication between the database and middle tier application servers.&amp;nbsp; While Oracle provides support for SQL Net client activity via the SDP protocol for SQL Net traffic over an infiniband network it is recommended to stick with TCP over infiniband as I have never gotten the SDP protocol to work as of yet.&amp;nbsp; &lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;Database Server Configuration&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNormal"&gt;A database server with an infiniband network interface has the ability to communicate across that infiniband interface allowing database connections the increased bandwidth and lower latency of infiniband.&amp;nbsp; The SQL-Net interface for the infiniband can be configured using TCP protocol.&amp;nbsp; When using the TCP protocol it is recommended to configure the SDU sizes appropriately on the client and server.&amp;nbsp; On the database server side the Oracle TNS listener must configured to listen for the specific protocol on the infiniband network address so that will be used in the communication initiated to the database so that communication can be recognized.&amp;nbsp; To configure the server to accept connections to the database with the TCP it is recommended to configure 2 listeners, 1 listener for TCP communication over the normal network interface and a second listener for the TCP communication over the infiniband network.&amp;nbsp; If the infiniband connection is management network for activities such as backup, Storage communication, management, data guard, streams or golden gate connectivity a second dedicated listener for this communication is a must.&amp;nbsp; When the second listener is configured a second port is utilized and therefore the connection requests are completely isolated.&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;Additional Listener TCP&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;LISTENER_MGMT=&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;&amp;nbsp; (DESCRIPTION=&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (ADDRESS_LIST=&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (ADDRESS=(PROTOCOL=tcp)(HOST=infini-server)(PORT=1522)) ) )&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;Database Client Configuration&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNormal"&gt;The database sqlnet client configuration will require a tns entry in the local tnsanames.ora as well as entries in the local sqlnet.ora.&amp;nbsp; When using SDP with infiniband rather than TCP there is no complicated listener or tns setup as with TCP when dealing with larger bandwidth data transfers.&amp;nbsp; Typically the hostname given to a database servers infiniband network interface is not in the DNS therefore you must add the database server hostname for that interface to the client and server hosts file (applies to both Windows and Unix/Linux).&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;hosts&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;# Connections (infiniband)&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;192.168.1.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db02-priv.localdomain db02-priv&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;"&gt;192.168.1.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db01-priv.localdomain db01-priv&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;tnsnames.ora (non-rac example)&lt;/b&gt;&lt;/span&gt;&lt;pre&gt;prd =&lt;/pre&gt;&lt;pre&gt;(DESCRIPTION=&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; (ADDRESS_LIST=&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;(ADDRESS=(PROTOCOL=tcp)(HOST=db01-priv)(PORT=1522))&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; (CONNECT_DATA =&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (SERVICE_NAME = prd.localdomain)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; )&lt;/pre&gt;&lt;pre&gt;&amp;nbsp; )&lt;/pre&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;tnsnames.ora (rac example)&lt;/b&gt;&lt;/span&gt;&lt;pre&gt;prd_rac =&lt;/pre&gt;&lt;pre&gt;(DESCRIPTION=&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; (ADDRESS_LIST=&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (ADDRESS=(PROTOCOL=tcp)(HOST=db01-priv)(PORT=1522))&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (ADDRESS=(PROTOCOL=tcp)(HOST=db02-priv)(PORT=1522))&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; (LOAD_BALANCE = ON)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; (FAILOVER = ON)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; (CONNECT_DATA =&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (SERVICE_NAME = prd.localdomain)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (FAILOVER_MODE=(TYPE=select)(METHOD=basic)(RETRIES=20)(DELAY=15))&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp; )&lt;/pre&gt;&lt;pre&gt;&amp;nbsp; )&lt;/pre&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;Check Database Connection Configuration&lt;/b&gt;&lt;/span&gt;&lt;div class="MsoNormal"&gt;After the configuration is complete a good way to test the connectivity is working is to test the connection across the infiniband from a client machine connected to the infiniband network.&amp;nbsp; Using SQL Plus or another client tool that will utilize the Oracle Client interface test the connection to the database through the listener listening on the infiniband network.&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;C:\&amp;gt; sqlplus messinam@prd&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 1 18:00:10 2010&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;Copyright (c) 1982, 2010, Oracle.&amp;nbsp; All rights reserved.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;Enter password:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;Connected to:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;With the Partitioning, Real Application Clusters, Automatic Storage Management,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;OLAP,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;Data Mining and Real Application Testing options&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;"&gt;SQL&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-2182799719731468119?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/2182799719731468119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=2182799719731468119' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2182799719731468119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2182799719731468119'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2011/04/configure-sql-net-using-infiniband.html' title='Configure SQL Net using Infiniband Interface'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-6937429360030671837</id><published>2011-04-05T11:39:00.001-04:00</published><updated>2011-04-05T11:40:13.971-04:00</updated><title type='text'>Running an AWR Compare Report Across Databases</title><content type='html'>&lt;b&gt;Extract the AWR Data from Production Database&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There are time when I want to run an AWR compare report from my production activity and my test database load test activity.  We can do this by extracting the AWR data from the production database and loading it into the test database and then run a compare report between the 2 sets of snap data.&lt;br /&gt;&lt;br /&gt;Oracle provides a utility to extract the AWR data from a database.  In $ORACLE_HOME/rdbms the script awrextr.sql is used for this purpose for an interactive extract.&lt;br /&gt;&lt;br /&gt;ORACLE_HOME/rdbms/admin/awrextr.sql&lt;br /&gt;&lt;br /&gt;** Note: This will extract the AWR data for the snap periods that are selected.    This processes uses the data pump utility to extract the AWR data to a data pump dump file.  Therefore you must have a defined directory to write the dump file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Move the AWR Datapump Dump File.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Move the Data Pump dump file created by the awrextr.sql script to the test server so it can be loaded.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Load the AWR Data into the Test Database&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Oracle makes the import of AWR date as simple as the extraction of AWR data. &lt;br /&gt;&lt;br /&gt;Oracle provides a script awrload.sql in the ORACLE_HOME/rdbms/admin directory. &lt;br /&gt;&lt;br /&gt;** Note: Before attempting to load the AWR data from the data pump dump file ensure that an Oracle directory exists for the location of the data pump dump file the needs loaded.  Also When loading AWR data into another database make sure the tablespace SYSAUX, the stage tablespace selected, example will use SYSAUX, and the TEMP tablespace have enough room to complete the operation.  May want to have another session open to the database to monitor freespace. &lt;br /&gt;&lt;br /&gt;ORACLE_HOME/rdbms/admin/awrload.sql                                     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Run the Compare Report Between the 2 databases AWR Data&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;Now that we have AWR data from multiple databases we can compare across snap time periods from one database, run normal AWR reports over snap time periods, or even compare snap time periods across the different databases.  Oracle provides an easy way to execute the compares across the script awrddrpi.sql in the ORACLE_HOME/rdbms/admin directory. &lt;br /&gt;&lt;br /&gt;ORACLE_HOME/rdbms/admin/awrddrpi.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify the Report Type&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;Would you like an HTML report, or a plain text report?&lt;br /&gt;Enter 'html' for an HTML report, or 'text' for plain text&lt;br /&gt;Defaults to 'html'&lt;br /&gt;Enter value for report_type: text&lt;br /&gt;&lt;br /&gt;Type Specified:  text&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Instances in this Workload Repository schema&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;&lt;br /&gt;DB Id     Inst Num DB Name      Instance     Host&lt;br /&gt;------------ -------- ------------ ------------ ------------&lt;br /&gt;3742289852        1 AWR2         awr2         ORADBPROD01&lt;br /&gt;* 744414708         1 ORCL11G      orcl11g      MRMESSIN&lt;br /&gt;&lt;br /&gt;Database Id and Instance Number for the First Pair of Snapshots&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;Enter value for dbid: 3742289852&lt;br /&gt;Using 3742289852 for Database Id for the first pair of snapshots&lt;br /&gt;Enter value for inst_num: 1&lt;br /&gt;Using 1 for Instance Number for the first pair of snapshots&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify the number of days of snapshots to choose from&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;Entering the number of days (n) will result in the most recent&lt;br /&gt;(n) days of snapshots being listed.  Pressing &lt;return&gt; without&lt;br /&gt;specifying a number lists all completed snapshots.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Enter value for num_days: 3&lt;br /&gt;&lt;br /&gt;Listing the last 3 days of Completed Snapshots&lt;br /&gt;&lt;br /&gt;Snap&lt;br /&gt;Instance     DB Name        Snap Id    Snap Started    Level&lt;br /&gt;------------ ------------ --------- ------------------ -----&lt;br /&gt;awr2         AWR2                 1 20 Feb 2008 17:42      1&lt;br /&gt;2 20 Feb 2008 19:00      1&lt;br /&gt;3 20 Feb 2008 20:00      1&lt;br /&gt;4 20 Feb 2008 21:00      1&lt;br /&gt;5 20 Feb 2008 22:00      1&lt;br /&gt;6 20 Feb 2008 23:00      1&lt;br /&gt;7 21 Feb 2008 00:00      1&lt;br /&gt;8 21 Feb 2008 01:00      1&lt;br /&gt;9 21 Feb 2008 02:00      1&lt;br /&gt;10 21 Feb 2008 03:00      1&lt;br /&gt;………&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify the First Pair of Begin and End Snapshot Ids&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;Enter value for begin_snap: 1&lt;br /&gt;First Begin Snapshot Id specified: 1&lt;br /&gt;&lt;br /&gt;Enter value for end_snap: 9&lt;br /&gt;First End   Snapshot Id specified: 9&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Instances in this Workload Repository schema&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;&lt;br /&gt;DB Id     Inst Num DB Name      Instance     Host&lt;br /&gt;------------ -------- ------------ ------------ ------------&lt;br /&gt;3742289852        1 AWR2         awr2         ORADBPROD01&lt;br /&gt;* 744414708         1 ORCL11G      orcl11g      MRMESSIN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Database Id and Instance Number for the Second Pair of Snapshots&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;&lt;br /&gt;Enter value for dbid2: 744414708&lt;br /&gt;Using 744414708 for Database Id for the second pair of snapshots&lt;br /&gt;Enter value for inst_num2: 1&lt;br /&gt;Using 1 for Instance Number for the second pair of snapshots&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify the number of days of snapshots to choose from&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;Entering the number of days (n) will result in the most recent&lt;br /&gt;(n) days of snapshots being listed.  Pressing &lt;return&gt; without&lt;br /&gt;specifying a number lists all completed snapshots.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Enter value for num_days2: 3&lt;br /&gt;&lt;br /&gt;Listing the last 3 days of Completed Snapshots&lt;br /&gt;&lt;br /&gt;Snap&lt;br /&gt;Instance     DB Name        Snap Id    Snap Started    Level&lt;br /&gt;------------ ------------ --------- ------------------ -----&lt;br /&gt;orcl11g      ORCL11G            355 26 Feb 2008 07:34      1&lt;br /&gt;356 26 Feb 2008 09:00      1&lt;br /&gt;357 26 Feb 2008 10:00      1&lt;br /&gt;358 26 Feb 2008 11:00      1&lt;br /&gt;……………&lt;br /&gt;405 02 Mar 2008 00:00      1&lt;br /&gt;406 02 Mar 2008 01:00      1&lt;br /&gt;407 02 Mar 2008 02:00      1&lt;br /&gt;408 02 Mar 2008 03:00      1&lt;br /&gt;409 02 Mar 2008 04:00      1&lt;br /&gt;410 02 Mar 2008 05:00      1&lt;br /&gt;411 02 Mar 2008 06:00      1&lt;br /&gt;412 02 Mar 2008 07:00      1&lt;br /&gt;413 02 Mar 2008 08:00      1&lt;br /&gt;………&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify the Second Pair of Begin and End Snapshot Ids&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;Enter value for begin_snap2: 405&lt;br /&gt;Second Begin Snapshot Id specified: 405&lt;br /&gt;&lt;br /&gt;Enter value for end_snap2: 413&lt;br /&gt;Second End   Snapshot Id specified: 413&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify the Report Name&lt;br /&gt;~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;The default report file name is awrdiff_1_1_1_405.txt  To use this name,&lt;br /&gt;press &lt;return&gt; to continue, otherwise enter an alternative.&lt;br /&gt;&lt;br /&gt;Enter value for report_name: awrdiff_awr2_orcl11g.txt&lt;/return&gt;&lt;/return&gt;&lt;/return&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-6937429360030671837?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/6937429360030671837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=6937429360030671837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/6937429360030671837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/6937429360030671837'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/10/running-awr-compare-report-accross.html' title='Running an AWR Compare Report Across Databases'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-1632144070911548721</id><published>2011-04-05T11:37:00.001-04:00</published><updated>2011-04-05T11:37:40.256-04:00</updated><title type='text'>Collaborate 2011</title><content type='html'>Are you getting ready for collaborate?   &lt;br /&gt;&lt;br /&gt;I am speaking again this year, hope to see you there.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-1632144070911548721?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/1632144070911548721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=1632144070911548721' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1632144070911548721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1632144070911548721'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2011/04/collaborate-2011.html' title='Collaborate 2011'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8601499655484458737</id><published>2011-04-05T11:35:00.000-04:00</published><updated>2011-04-05T11:35:06.816-04:00</updated><title type='text'>Oracle 11gR2 Installing CTX Knowledge Base</title><content type='html'>&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;The Oracle Text option requires the use of certain context knowledge bases that are not part of the typical installation of the Oracle 11gR2 database software.  To be able to create context indexes these knowledge bases may be required.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Example:&lt;/i&gt;&lt;br /&gt;DRG-11446: supplied knowledge base file /u01/app/oracle/product/11.2.0/dbhome_1/ctx/data/enlx/droldUS.dat not installed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Download the Oracle Examples Installation (formally Companion CD)&lt;br /&gt;&lt;br /&gt;http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html&lt;br /&gt;&lt;br /&gt;2. Unzip the Oracle Examples Installation&lt;br /&gt;&lt;br /&gt;$ unzip linux.x64_11gR2_examples.zip&lt;br /&gt;&lt;br /&gt;3. Goto the location in the installation media for the CTX Filegroups&lt;br /&gt;&lt;br /&gt;$ cd examples/stage/Components/oracle.ctx.companion/11.2.0.1.0/1/DataFiles&lt;br /&gt;&lt;br /&gt;4. unzip the CTX Knowledge base files&lt;br /&gt;&lt;br /&gt;$ unzip filegroup1.jar&lt;br /&gt;Archive:  filegroup1.jar&lt;br /&gt;  inflating: ctx/data/enlx/drofdUS.dat  &lt;br /&gt;  inflating: ctx/data/enlx/drofiUS.dat  &lt;br /&gt;  inflating: ctx/data/enlx/droldUS.dat  &lt;br /&gt;  inflating: ctx/data/enlx/droliUS.dat  &lt;br /&gt;  inflating: ctx/data/enlx/drolkUS.dat  &lt;br /&gt;  inflating: ctx/data/enlx/drolsUS.dat  &lt;br /&gt;&lt;br /&gt;5. Goto the location of the knowledge base files we just extracted and copy them to the Oracle Database Home location&lt;br /&gt;&lt;br /&gt;$ cd  ctx/data/enlx/&lt;br /&gt;$ cp * $ORACLE_HOME/ctx/data/enlx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8601499655484458737?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8601499655484458737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8601499655484458737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8601499655484458737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8601499655484458737'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2011/04/oracle-11gr2-installing-ctx-knowledge.html' title='Oracle 11gR2 Installing CTX Knowledge Base'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-7250897842381259435</id><published>2010-10-18T11:47:00.000-04:00</published><updated>2010-10-18T11:47:54.864-04:00</updated><title type='text'>Oracle Grid Control Exadata Storage Cell Plug-in Installation/Upgrade</title><content type='html'>The Oracle Enterprise Manager Grid Control Exadata Storage Cell Plug-in allows that management agent to be able to monitor and assist with the basic management of the Exadata Storage Cells. The Exadata Storage Cell Plug-in is compatible with Oracle Enterprise Manager Grid Control version 10.2.0.4 and above. &lt;br /&gt;The installation and upgrade process is basically the same process. The difference is that on an upgrade is the pre-installation setup will not be needed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Pre-Installation Setup&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Prior to initial installation of the Exadata Storage Cell Plug-in you will need to identify a server that will have an agent that will be the monitoring agent for the Storage Cells. The that will have the Grid Control Agent that will monitor the Storage Cells must have connectivity to the Exadata Storage Cells via SSH. For this to happen that server must have a network interface on the management network or the infini-band for the Exadata.&lt;br /&gt;&lt;br /&gt;1. Setup Server with Network connectivity to the Exadata Network which has the storage cells.&lt;br /&gt;&lt;br /&gt;2. Setup hosts file on the server that will house the agents to see each of the storage cells.&lt;br /&gt;&lt;br /&gt;3. Setup ssh connectivity to each of the storage cells&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. generate the ssh keys on the sever that will house the agent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i. ssh-keygen -t dsa -f id_dsa&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b. copy the ssh key to each of the storage cell servers as the celladmin user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i. scp id_dsa.pub &lt;a href="mailto:celladmin@dm01cel01"&gt;celladmin@dm01cel01&lt;/a&gt;:~&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ii. repeat for each storage cell&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c. log into the storage cell as the root user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i. ssh root@dm01cel01&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d. Add contents of the id_dsa file to the authorized_keys file for the cellmonitor user on each of the storage cells.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i. check if the authorized_keys file exists for the cellmonitor user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. ls -l /home/cellmonitor/.ssh/*&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ii. if the authorized keys file exists for the cellmonitor user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. cat /home/celladmin/id_dsa.pub &amp;gt;&amp;gt; /home/cellmonitor/.ssh/authorized_keys&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iii. if the authorized keys file does not exist for the cell monitor user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. cp /home/celladmin/id_dsa.pub /home/cellmonitor/.ssh/authorized_keys&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iv. repeat for each of the storage cell servers&lt;br /&gt;&lt;br /&gt;4. Test ssh connectivity from the server that will house the Grid Control Agent for each of the storage cells.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. ssh -l cellmonitor dm01cel01 cellcli -e 'list cell detail'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;i&gt;&lt;span style="color: blue;"&gt;** If you prompted for a password it not not working correctly need to check/repeat setup steps&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;** If you asked to confirm indicates Yes to continue with connection&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b. repeat test for each storage cell server.&lt;br /&gt;&lt;br /&gt;5. Install the Oracle Enterprise Manager Grid Control Agent on the server that will serve as the monitoring Exadata Storage Cell monitoring Agent for the Grid Control Plug-in.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="color: blue;"&gt;** It is ok for the monitoring agent for the Exadata Storage Cells to be the Gird Control Management Server Agent.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Plug-in Installation&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;For the plug-in installation the plug-in is imported into OEM Grid Control. This is the case for a new installation or a new version for an existing installation. This also assumes that you have an Oracle Grid Control Management Server/Service Setup and accessible.&lt;br /&gt;&lt;br /&gt;1. Download the Oracle Enterprise Manager Grid Control Exadata Storage Server Plug-in.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. &lt;a href="http://www.oracle.com/technetwork/database/exadata/index.html"&gt;http://www.oracle.com/technetwork/database/exadata/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Import the Plug-in into the Oracle Enterprise Manager Grid Control.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. Select Setup from the Top Right portion of the Browser Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b. Select Management Plug-ins from the list menu on the right hand side of the window.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c. Select Import Option&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d. Select Browse to locate the Exadata Storage Cell Plug-in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e. Locate and Select the Exadata Storage Cell Plug-in File Downloaded and Select Open&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f. Select List Archive to Expand out the Plug-in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g. Select the oracle_cell Plug-in ensuring the check mark is present next to the Plug-in then select OK&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h. Verify the Plug-in Version is now in the list of Plug-ins.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j. Management Plug-in Installation Complete. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Plug-in Deployment&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The Plug-in deployment is done the same regardless if there is an existing plug-in version deployed. Once the Plug-in is imported you deploy the plug-in the same. This process assumes that the Grid Control Monitoring Agent that will serve as the monitoring agent for the Exadata Storage Cells is installed and registered with you Oracle Management Service.&lt;br /&gt;1. Log into Oracle Enterprise Manager Grid Control Management Service.&lt;br /&gt;&lt;br /&gt;2. Set Preferred Credentials for the host of monitoring agent Plug-in will be deployed to as well as the monitoring agent.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. Select Preferences from top right of Browser Window displaying management console.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b. select preferred credentials&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c. select Set Credentials Icon for Host&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d. locate host and enter the credentials for the oracle operating system user credentials&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e. select test credentials to ensure credentials entered are working.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f. select apply.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g. select Preferred Credentials in the upper left part of the screen&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h. select Set Credentials Icon for Agent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i. Locate the agent to set credentials for and enter the oracle operating system user credentials&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j. select apply&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; k. Select Home Tab to return to the Home Console Screen&lt;br /&gt;&lt;br /&gt;3. Select Setup from the Top Right portion of the Browser Window&lt;br /&gt;&lt;br /&gt;4. Select Management Plug-ins from the list menu on the right hand side of the window.&lt;br /&gt;&lt;br /&gt;5. For the Exadata Plug-in to Deploy Select the Deploy icon. When Upgrading the Exadata Plug-in Select the new version to deploy. &lt;br /&gt;&lt;br /&gt;6. Add Agent to the List of Agents to Deploy Plug-in to.&lt;br /&gt;&lt;br /&gt;7. Select the Agent that will serve as the monitoring agent for the Exadata Storage Cells and then press Select.&lt;br /&gt;&lt;br /&gt;8. To Add More Agents, repeat the Add Agent Steps, When finished Select Next to Continue with Deploying Plug-in.&lt;br /&gt;&lt;br /&gt;9. Select Finish to Deploy Agent.&lt;br /&gt;&lt;br /&gt;10. Deployment Completed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-7250897842381259435?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/7250897842381259435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=7250897842381259435' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7250897842381259435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7250897842381259435'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/10/oracle-grid-control-exadata-storage.html' title='Oracle Grid Control Exadata Storage Cell Plug-in Installation/Upgrade'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-2702638795624732529</id><published>2010-10-01T14:16:00.039-04:00</published><updated>2010-10-18T10:37:31.977-04:00</updated><title type='text'>Exadata Hybrid Columnar Compression</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Hybrid Columnar Compression was introduced with the Exadata version 2 and is one of the most highlighted advantages of an Exadata as it improves performance and significantly reduces the storage footprint of the data on physical storage. By reducing the foot print of the data on physical storage it also reduces the foot print of that data in the database cache area as well therefore offering overall improvement in system memory resources in addition to physical storage. While you can use the columnar compression options in Exadata it does not prevent you from using the Oracle 11gR2 Advanced Compression as well giving you three different levels of compress based on the data within your database.&lt;br /&gt;&lt;br /&gt;There are 2 types of columnar compression with Exadata, compress for query and compress for archive. The compress for query option offers a high level of compression, but not as high as for archive, but offers better query performance then the for archive option. While the OLTP compression in 11gR2 could work well for more online type access. &lt;br /&gt;&lt;br /&gt;The advantages to the multiple types of compression is the level of compression based on the type of data. This gives the ability to true start to consider the Information Lifecycle Management of your data in regards to how it is stored and better manage your storage resources. For example let say you have a very large table partitioned by month where the first 24 months of data is subject to regular insert, update, delete and query activity, then from 24 months to 60 months the data is not updated, but query activity is heavy then data over 60 months is rarely accessed but does need to be available. Your best option for the most recent 24 months of database would most likely be OLTP compression. For the data between 24 and 60 months compress for query columnar compression would be your best option and the data over 60 months old would be best suited for compress for archive column compression. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Compress for Query Columnar Compression&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Compress for query Columnar Compress offers a good balance between frequent query access and compression level. The compress for query can be high (default) or low. This indicates the level of compression and subsequently impact on CPU resources to handle the compression. The query option has between a 5-10% runtime hot on direct loads over an uncompress table load which in most cases can be considered minimal when compared to the disk savings achieved. The compression significantly reduces the size of the table and at the same time improves the performance of queries without very high impact on other system resources. With the implementation of Hybrid Columnar Compression for query high reduction consistently has between 60-70% . The table compress for query below shows some real world results when using the compress for query high option. With the implementation of Hybrid Columnar Compression with the compress for archive option &lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Compress for Query High&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Uncompressed(MB) Compress for Query(MB) Reduction(MB)&amp;nbsp;% Reduction&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;903&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 559&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 61.90&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1088&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 408&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 680&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;62.50&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;960&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 361&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;599&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 62.40&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1088&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 416&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;672&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 61.76&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1152&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 752&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65.28&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1091&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 691&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 63.33&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1216&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 760&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 62.50&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;1112&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 408&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;704&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 63.31&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Compress for Archive Columnar Compression&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The compress for archive columnar compression offers the highest level of compression available, but with the higher level of compression the impact to system CPU resources increases therefore making it a less desired option where consistent query access is needed. The archive compress option averages between 70-80% size reduction over uncompressed tables. The archive option is also a significant hit on direct load runtimes as an average 50% runtime hits have been experienced over query compressed table direct loads. This hit on load time could also make this a less desired option for objects with frequent load activities where load runtimes are critical. As the name indicates it works very well for compressing down data that is archived and needs to be available, but is not accessed frequently or load times are a critical requirement. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Compress for Archive&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Uncompressed(MB) Compress for Query(MB) Reduction(MB)&amp;nbsp;% Reduction&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;903&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 264&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 639&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70.76&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1088&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 304&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 784&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;72.06&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;960&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 272&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 688&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;71.67&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1088&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 312&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 776&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71.32&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1152&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 336&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;816&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70.83&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1091&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 328&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 763&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;69.94&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1216&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 352&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;864&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71.05&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1112&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 304&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 808&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;72.66&lt;/span&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="background-color: white; color: black; font-family: inherit; font-size: large;"&gt;Effectively Utilizing the Hybrid Column Compression&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="background-color: white; font-family: inherit;"&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Query and Archive Hybrid Columnar Compressions is most effective for historical tables/date where the data no longer changes.&amp;nbsp; Being that they are historical tables they are typically quite large we usually will utilize with a partitioned table as best practice for large tables is to partition them.&amp;nbsp; The most effective use of the Hybrid Columnar Compression is to use them both within your partitioned historical table where the more frequently queries data partitions are query hybrid columnar compressed and the less frequently accessed data is archive columnar compressed.&amp;nbsp; This creates an effect Information Life Cycle Management that will help you manage your partition sizes based on their age and access frequency.&lt;/span&gt;&lt;span style="font-family: inherit; font-size: small;"&gt; &lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Notice in the example below the more recently accessed data is partitioned by month allowing faster access to data through more fine tuned partition elimination.&amp;nbsp; Space is saved through the query hybrid columnar compression on those partitions.&amp;nbsp; Now as the data gets older partition maintenance is performed to combined partitions by year and the new partition for the entire year utilizes hybrid columnar compression to save a little more space and still keep the data accessible.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNoSpacing" style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;u&gt;Example&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;CREATE TABLE ARCHIVE."CLAIM" &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp; "CLAIM_ID" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;VARCHAR2(36) &amp;nbsp;&amp;nbsp;NOT NULL ENABLE, &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "CLAIM_TYPE_CODE" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;VARCHAR2(2) &amp;nbsp;&amp;nbsp;&amp;nbsp;NOT NULL ENABLE, &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "PAYER_PROCESS_STAGE" VARCHAR2(10), &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SYS_CREATE_DATE" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DATE, &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SYS_UPDATE_DATE" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DATE) &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;TABLESPACE ARCHIVE_2004 &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;PARTITION BY RANGE (SYS_CREATE_DATE) interval (NUMTOYMINTERVAL(1,'month'))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; (PARTITION CLAIM_2004 VALUES LESS THAN (TO_DATE ('1-JAN-2005','DD-MON-YYYY'))&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOLOGGING TABLESPACE ARCHIVE_2004 compress for archive high,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PARTITION CLAIM_2005 VALUES LESS THAN (TO_DATE ('1-JAN-2006','DD-MON-YYYY'))&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOLOGGING TABLESPACE ARCHIVE_2005 compress for archive high,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PARTITION CLAIM_2006 VALUES LESS THAN (TO_DATE ('1-JAN-2007','DD-MON-YYYY'))&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOLOGGING TABLESPACE ARCHIVE_2006 compress for archive high,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PARTITION CLAIM_200701 VALUES LESS THAN (TO_DATE ('1-FEB-2007','DD-MON-YYYY'))&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOLOGGING TABLESPACE OTHER_PART_QUERY compress for query,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PARTITION CLAIM_200702 VALUES LESS THAN (TO_DATE ('1-MAR-2007','DD-MON-YYYY'))&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOLOGGING TABLESPACE OTHER_PART_QUERY compress for query,&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PARTITION CLAIM_200703 VALUES LESS THAN (TO_DATE ('1-APR-2007','DD-MON-YYYY'))&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NOLOGGING TABLESPACE OTHER_PART_QUERY compress for query&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; )&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNoSpacing" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;compress for archive high;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-2702638795624732529?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/2702638795624732529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=2702638795624732529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2702638795624732529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2702638795624732529'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/10/exadata-columnar-compression.html' title='Exadata Hybrid Columnar Compression'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-4491153885549845612</id><published>2010-09-17T23:26:00.000-04:00</published><updated>2010-09-17T23:26:21.216-04:00</updated><title type='text'></title><content type='html'>&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_M1FJlXCTa7M/TJQw9oTYAlI/AAAAAAAAABM/PhiPF7yS9gw/s1600/10040370_oow_imspeaking_125x125.gif" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" qx="true" src="http://1.bp.blogspot.com/_M1FJlXCTa7M/TJQw9oTYAlI/AAAAAAAAABM/PhiPF7yS9gw/s320/10040370_oow_imspeaking_125x125.gif" /&gt;&lt;/a&gt;&lt;/div&gt;Hope to see you all at open World&lt;br /&gt;Will be attending the Oracle Exadata SIG&lt;br /&gt;Presenting Sunday and Monday&lt;br /&gt;Spending some time in the Rolta-TUSC Booth Monday&lt;br /&gt;Come by and see me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-4491153885549845612?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/4491153885549845612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=4491153885549845612' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4491153885549845612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4491153885549845612'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/09/hope-to-see-you-all-at-open-world-will.html' title=''/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_M1FJlXCTa7M/TJQw9oTYAlI/AAAAAAAAABM/PhiPF7yS9gw/s72-c/10040370_oow_imspeaking_125x125.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-2875311034074248388</id><published>2010-03-23T22:35:00.000-04:00</published><updated>2010-03-23T22:35:37.605-04:00</updated><title type='text'>Oracle Compression Advisor</title><content type='html'>Every once and awhile I come across a valuable utility, I have come across a new &lt;br /&gt;Oracle utility that can be utilized starting with 9i release 2 that can help estimate the space savings from compression.&lt;br /&gt;&lt;br /&gt;The process creates tables in the default tablespace of the user executing the procedure.  It is recommended that you make sure the default tablespace is other then SYSTEM or SYSAUX.&lt;br /&gt;&lt;br /&gt;The process is created via a package procedure available via a download from Oracle Technet at &lt;br /&gt;&lt;br /&gt;http://www.oracle.com/technology/products/database/compression/compression-advisor.html&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example of the package installation&lt;/b&gt;&lt;br /&gt;[oracle@oel54node1 compression_advisor]$ sqlplus / as sysdba&lt;br /&gt;&lt;br /&gt;SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 23 22:33:57 2010&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2009, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Connected to:&lt;br /&gt;Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;&lt;br /&gt;SQL&gt; @dbmscomp.sql&lt;br /&gt;&lt;br /&gt;Package created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Synonym created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;br /&gt;No errors.&lt;br /&gt;SQL&gt; @prvtcomp.plb&lt;br /&gt;&lt;br /&gt;Package body created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Synonym created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;br /&gt;No errors.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Here is an example of its execution&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; set serveroutput on&lt;br /&gt;SQL&gt; exec dbms_comp_advisor.getratio('SYS','AUD$','OLTP',20) ;&lt;br /&gt;Sampling table: SYS.AUD$&lt;br /&gt;Sampling percentage: 20%&lt;br /&gt;Compression Type: OLTP&lt;br /&gt;Compression ratio: 1.53&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-2875311034074248388?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/2875311034074248388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=2875311034074248388' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2875311034074248388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2875311034074248388'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/03/oracle-compression-advisor.html' title='Oracle Compression Advisor'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-4875096641329587774</id><published>2010-02-20T15:32:00.000-05:00</published><updated>2010-02-20T15:39:20.078-05:00</updated><title type='text'>Change OEM Grid Control SYSMAN Password</title><content type='html'>1. Set the ORACLE_HOME and associated environment variables such as PATH, etc.&lt;br /&gt; $ export ORACLE_HOME=/u01/app/oracle/product/oms10g&lt;br /&gt; $ export PATH=ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH&lt;br /&gt;&lt;br /&gt;2. Stop the OMS instances that are associated with the repository&lt;br /&gt; $ cd $ORACLE_HOME/opmn/bin&lt;br /&gt; $ opmnctl stopall&lt;br /&gt;&lt;br /&gt;3. Log into the OEM Grid Control Repository Database as a DBA user and change the SYSMAN password&lt;br /&gt; $ sqlplus system@oem&lt;br /&gt; SQL&gt;  alter user  sysman identified by newpassword;&lt;br /&gt; SQL&gt; exit &lt;br /&gt;&lt;br /&gt;4. Update the emoms.properties file on each management server host&lt;br /&gt; $ export ORACLE_HOME=/u01/app/oracle/product/oms10g&lt;br /&gt; $ export PATH=ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH&lt;br /&gt; $ cd $ORACLE_HOME/sysman/config&lt;br /&gt; $ cp emoms.properties emoms.properties.backup&lt;br /&gt; $ vi emoms.properties file &lt;br /&gt;  Change the Following:&lt;br /&gt;   oracle.system.eml.mntr.emdRepPwd=new_password      oracle.sysman.eml.mntr.emdRepPwdEncrypted=FALSE&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** NOTE: When you restart the OMS, the FALSE setting will change to TRUE and the password will become encrypted in the file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5. On the Management Repository host stop the Grid Control Agent&lt;br /&gt; $ export ORACLE_HOME=/01/app/oracle/product/agent10g&lt;br /&gt; $ cd $ORACLE_HOME/bin&lt;br /&gt; $  ./emctl stop agent&lt;br /&gt;&lt;br /&gt;6. Update the targets.xml file in the AGENT_HOME/sysman/emd directory and save changes&lt;br /&gt; $ cd $ORACLE_HOME/sysman/emd&lt;br /&gt; $ vi targets.xml&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Update the Following&lt;/span&gt;&lt;br /&gt;..&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Property NAME="password" VALUE="newpassword" ENCRYPTED="FALSE"&lt;/span&gt;&lt;br /&gt;..&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** NOTE:  The TRUE value will change to FALSE and the newpassword will become encrypted when you restart the Agent.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;6. Re-Start the Agent&lt;br /&gt; $ cd $ORACLE_HOME/bin&lt;br /&gt; $ ./emctl start agent&lt;br /&gt;&lt;br /&gt;7. Set the ORACLE_HOME, etc for the OMS&lt;br /&gt; $ export ORACLE_HOME=/u01/app/oracle/product/oms10g&lt;br /&gt; $ export PATH=ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH&lt;br /&gt;&lt;br /&gt;8.  Re-start each of the OMS's associated with the Grid Control Repository database.&lt;br /&gt; $ cd $ORACLE_HOME/opmn/bin&lt;br /&gt; $ ./opmnctl startall&lt;br /&gt;&lt;br /&gt;9. Change the OMS using WEB Browser&lt;br /&gt;&lt;br /&gt; http://oel54node1.localdomain:7777/em/console/logon/logon&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-4875096641329587774?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/4875096641329587774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=4875096641329587774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4875096641329587774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4875096641329587774'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/02/change-oem-grid-control-sysman-password.html' title='Change OEM Grid Control SYSMAN Password'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-7903340694318164822</id><published>2010-02-20T15:22:00.000-05:00</published><updated>2010-02-20T15:30:58.094-05:00</updated><title type='text'>Real Application Testing Database Replay</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Apply all Recommended Patches for Database Replay&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. For 11.1.0.6 a patch is recommended for proper database replay functionality.  The patch can be download for 11.1.0.6 for you platform from Metalink.  For Unix the patch number is 6865809 and the patch for windows 32-bit 7044721 &lt;br /&gt;&lt;span style="font-style:italic;"&gt;** For other database platforms see Appendix A: Real Application Testing for Earlier Releases&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2. Shutdown all databases and listeners running within the ORACLE_HOME being patched.&lt;br /&gt;&lt;br /&gt;3. Ensure that opatch utility version 11.1.0.6.3 is installed prior to installing patch set&lt;br /&gt;&lt;br /&gt;C:\Oracle\product\11.1.0\db_1\OPatch&gt;.\opatch version&lt;br /&gt;Invoking OPatch 11.1.0.6.2&lt;br /&gt;&lt;br /&gt;OPatch Version: 11.1.0.6.2&lt;br /&gt;&lt;br /&gt;OPatch succeeded.&lt;br /&gt;&lt;br /&gt;4. Change directory to the location where the 7044721 patch was extracted to&lt;br /&gt;&lt;br /&gt;5. Apply the patch using the opatch utility&lt;br /&gt; opatch apply&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** Ensure that all patch instructions are followed completely including post apply steps.  See specific patch notes.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Bring all databases and listeners back up.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Verify database connectivity and listener status&lt;br /&gt;Setup Source Database for Database Replay Capture&lt;br /&gt;Database Releases prior to 11g can be utilized for capturing a workload for replay on an 11g and above database, however there is some setup that is required.  For database release 10.2.0.4 there are no required patches for the capture functionality however for releases prior to 10.2.0.4 a patch is required.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** See Appendix A: Real Application Testing for Earlier Releases, for Versions prior to 10.2.0.4 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Run the wrrenbl.sql script, only required for 10.2.0.4 and is optional for other releases prior to 11g:&lt;br /&gt;Script will enable the PRE_11G_ENABLE_CAPTURE database initialization parameter.&lt;br /&gt;&lt;br /&gt;a. cd $ORACLE_HOME/rdbms/admin&lt;br /&gt;b. sqlplus / as sysdba&lt;br /&gt;c. SQL&gt; @wrrenbl.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Prepare to Capture Workload&lt;/span&gt;&lt;br /&gt;On the source database where we will be capturing the workload for replay we need to prepare the database for capture.&lt;br /&gt;&lt;br /&gt;1. Create a directory location where the workload capture file can be written.&lt;br /&gt;a. C:\Oracle&gt;mkdir dbcapture&lt;br /&gt;&lt;br /&gt;2. Create a directory within the source database where workload is to be captured.&lt;br /&gt;a. SQL&gt; create directory dbcapture as 'c:\oracle\dbcapture' ;&lt;br /&gt;&lt;br /&gt;3. Determine the workload to be captured.  In this example the workload is artificially generated using a script process.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** see Appendix B: Script that Generates an Artificial Workload&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Capture Workload&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. start the capture process&lt;br /&gt;a. SQL&gt; exec dbms_workload_capture.start_capture(’NRML_ACTIVITY’, ’DBCAPTURE’) ;&lt;br /&gt;&lt;br /&gt;2. Run the workload&lt;br /&gt;a. This is where the script for the artificial workload is executed&lt;br /&gt;&lt;br /&gt;3. When the workload is complete or you have captured the desired workload stop the capture process.&lt;br /&gt;a. SQL&gt; exec dbms_workload_capture.finish_capture() ;&lt;br /&gt;&lt;br /&gt;4. Execute a report on the Capture.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** See Appendix C: Generate Workload Capture Report (HTML)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Prepare the Workload for Replay&lt;/span&gt;&lt;br /&gt;** This database that processes the captured workload must be an 11.1.0.6 or above database as the packages to process the captured workload are not available in prior releases.&lt;br /&gt;&lt;br /&gt;1. Create a directory location for the captured workload to be paced for processing and replay on both the processing database and the replay database if the processing and replay databases are different.  Best practice is to process the workload on the same database that will execute the replay.&lt;br /&gt;a. C:\Oracle&gt; mkdir Replay&lt;br /&gt;&lt;br /&gt;2. Copy the captured workload files to another directory if on same host as database where workload was captured or to destination system location to be processed.  &lt;br /&gt;a. copy C:\Oracle\dbcapture\* C:\Oracle\Replay&lt;br /&gt;&lt;br /&gt;3. Create directory in the oracle database that will process the captured workload.&lt;br /&gt;a. SQL&gt; create directory REPLAY as ‘c:\Oracle\Replay’ ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Process the Workload for Replay&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** This is a resource intensive process therefore it should be done on a non-production system.  Therefore if you captured the workload on your production system move the capture files to a test or development system to prepare them for replay.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Process the captured workload&lt;br /&gt;a. SQL&gt; exec dbms_workload_replay.process_capture ('REPLAY') ;&lt;br /&gt;&lt;br /&gt;The process will create the following files in the REPLAY directory during the processing of the captured workload.&lt;br /&gt;&lt;br /&gt;wcr_login.pp&lt;br /&gt;WCR_SCN_ORDER.EXTB&lt;br /&gt;WCR_SEQ_DATA.EXTB&lt;br /&gt;WCR_CONN_DATA.EXTB&lt;br /&gt;wcr_process.wmd&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Prepare to Replay the Workload&lt;/span&gt;&lt;br /&gt;1. Go to database where replay is to be executed if different from database the processed workload.  If the replay database is the same as the database that processed the workload skip to step 3 otherwise process step 2.&lt;br /&gt;&lt;br /&gt;2. If not done so already go to Prepare workload for Replay Section and execute the steps on the database that will replay the workload.&lt;br /&gt;&lt;br /&gt;3. Initialize the replay &lt;br /&gt;a. SQL&gt; exec dbms_workload_replay.initialize_replay ('TEST_REPLAY','REPLAY') ;&lt;br /&gt;&lt;br /&gt;4. Prepare for Workload Replay&lt;br /&gt;a. SQL&gt; exec dbms_workload_replay.prepare_replay(synchronization=&gt;TRUE) ;&lt;br /&gt;&lt;br /&gt;5. Calibrate the Workload to determine the number of workload replay clients.  &lt;br /&gt;a. At the command line change to the replay directory&lt;br /&gt;i. cd C:\Oracle\Replay&lt;br /&gt;ii. c:\Oracle\Replay&gt; wrc mode=calibrate&lt;br /&gt;&lt;br /&gt;Workload Replay Client: Release 11.1.0.6.0 - Production on Thu Jul 24 10:38:41 2008&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2007, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Report for Workload in: .&lt;br /&gt;-----------------------&lt;br /&gt;&lt;br /&gt;Recommendation:&lt;br /&gt;Consider using at least 1 clients divided among 1 CPU(s).&lt;br /&gt;&lt;br /&gt;Workload Characteristics:&lt;br /&gt;- max concurrency: 9 sessions&lt;br /&gt;- total number of sessions: 46&lt;br /&gt;&lt;br /&gt;Assumptions:&lt;br /&gt;- 1 client process per 50 concurrent sessions&lt;br /&gt;- 4 client process per CPU&lt;br /&gt;- think time scale = 100&lt;br /&gt;- connect time scale = 100&lt;br /&gt;- synchronization = TRUE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Execute the Workload Replay&lt;/span&gt;&lt;br /&gt;Now that the workload has been captured and processed the workload is now ready to be replayed.&lt;br /&gt;&lt;br /&gt;1. Take the number of workload replay clients indicated in the previous section that will be needed to execute the processed workload.&lt;br /&gt;&lt;br /&gt;2. Open up a window for each workload replay client that will be needed as these will each be separate executions.&lt;br /&gt;** Only Need 1 client as indicated in the pervious step for the example workload&lt;br /&gt;&lt;br /&gt;3. From the command line enter the replay command with the wrc utility for the number of replay clients needed, should be one command in each window.&lt;br /&gt;a. C:\Oracle\proccapture&gt;wrc system/xxxxx@orcl11g replaydir=c:\Oracle\Replay&lt;br /&gt;&lt;br /&gt;4.   Start each of the replay clients needed.&lt;br /&gt;&lt;br /&gt;C:\Oracle\proccapture&gt;wrc system/xxxxx@orcl11g replaydir=c:\Oracle\Replay&lt;br /&gt;&lt;br /&gt;Workload Replay Client: Release 11.1.0.6.0 - Production on Thu Jul 24 15:09:15 2&lt;br /&gt;008&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2007, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Wait for the replay to start (15:09:15)&lt;br /&gt;Replay started (15:09:40)&lt;br /&gt;Replay finished (16:01:41)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. AWR information will be available for the time period where the workload apply was executed, it is generally recommended that the workload apply that is executed at least cover 1 complete snap period to provide the most useful data or that a snap is taken prior to the start and immediately after the workload execution.  (this is optional)&lt;br /&gt;&lt;br /&gt;SQL&gt; execute DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();&lt;br /&gt;&lt;br /&gt;6. In another window login to the database where the workload apply is to be execute and start the workload apply process.  You will see an indication that the workload has been started.&lt;br /&gt;&lt;br /&gt;$ sqlplus /@orcl11g&lt;br /&gt;&lt;br /&gt;SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jul 24 13:55:39 2008&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2007, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Connected to:&lt;br /&gt;Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;&lt;br /&gt;SQL&gt; exec dbms_workload_replay.start_replay ;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Monitor the workload apply until completed.  AWR information will be available for the time period where the workload apply was executed, it is generally recommended that the workload apply that is executed at least cover 1 complete snap period to provide the most useful data or that a snap is taken prior to the start and immediately after the workload execution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Once the workload apply is complete optionally take another AWR snaphot.&lt;br /&gt;&lt;br /&gt;SQL&gt; execute DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. Execute workload replay report extraction and evaluate the results from the report.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;** See Appendix D: Generate Workload Replay Report (HTML)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Appendix A: Real Application Testing for Earlier Releases&lt;/span&gt;&lt;br /&gt;See Metalink Note: 560977.1&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Appendix B: Script that Generates an Artificial Workload&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- create_workload.sql&lt;br /&gt;-- put in sql script to be executed to generate workload.&lt;br /&gt;create table orders tablespace users as select * from oe.orders ;&lt;br /&gt;&lt;br /&gt;create table order_items tablespace users as select * from oe.order_items ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- insert more rows into orders and order items to bulk up amount of data for&lt;br /&gt;-- a more true high volume test.&lt;br /&gt;declare&lt;br /&gt;   cursor my_cur is&lt;br /&gt;    select * from oe.orders ;&lt;br /&gt;   lcnt           number ;&lt;br /&gt;   v_order_id     oe.orders.order_id%type ;&lt;br /&gt;   v_order_date   oe.orders.order_date%type ;&lt;br /&gt;   v_order_mode   oe.orders.order_mode%type ;&lt;br /&gt;   v_customer_id  oe.orders.customer_id%type ;&lt;br /&gt;   v_order_status oe.orders.order_status%type ;&lt;br /&gt;   v_order_total  oe.orders.order_total%type ;&lt;br /&gt;   v_sales_rep_id oe.orders.sales_rep_id%type ;&lt;br /&gt;   v_promotion_id oe.orders.promotion_id%type ;&lt;br /&gt;   cursor my_cur_2 is&lt;br /&gt;      select line_item_id, product_id, unit_price, quantity&lt;br /&gt;      from oe.order_items where order_id = v_order_id ;&lt;br /&gt;   v_line_item_id  oe.order_items.line_item_id%type ;&lt;br /&gt;   v_product_id    oe.order_items.product_id%type ;&lt;br /&gt;   v_unit_price    oe.order_items.unit_price%type ;&lt;br /&gt;   v_quantity      oe.order_items.quantity%type ;&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;   select max(order_id) + 1 into lcnt from orders ;&lt;br /&gt;&lt;br /&gt;   loop&lt;br /&gt;      if lcnt = 10000 then&lt;br /&gt;        exit ;&lt;br /&gt;      end if ;&lt;br /&gt;&lt;br /&gt;      open my_cur ;&lt;br /&gt;      loop&lt;br /&gt;         fetch my_cur into v_order_id, v_order_date, v_order_mode, v_customer_id, &lt;br /&gt;                           v_order_status, v_order_total, v_sales_rep_id, v_promotion_id ;&lt;br /&gt;         exit when my_cur%notfound ;&lt;br /&gt;&lt;br /&gt;         insert into orders values (lcnt, v_order_date, v_order_mode, v_customer_id,&lt;br /&gt;                                    v_order_status, v_order_total, v_sales_rep_id, v_promotion_id) ;&lt;br /&gt;         commit ;&lt;br /&gt;     &lt;br /&gt;         open my_cur_2 ;&lt;br /&gt;         loop&lt;br /&gt;            fetch my_cur_2 into v_line_item_id, v_product_id, v_unit_price, v_quantity ;&lt;br /&gt;            exit when my_cur_2%notfound ;           &lt;br /&gt;&lt;br /&gt;            insert into order_items values (lcnt, v_line_item_id, v_product_id, v_unit_price, v_quantity) ;&lt;br /&gt;         end loop ;&lt;br /&gt;         close my_cur_2 ;&lt;br /&gt;&lt;br /&gt;         lcnt := lcnt + 1 ;&lt;br /&gt;      end loop ;   &lt;br /&gt;&lt;br /&gt;      close my_cur ;&lt;br /&gt;   end loop ;&lt;br /&gt;end ;&lt;br /&gt;/&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Appendix C: Generate Workload Capture Report (HTML)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- Capture Report&lt;br /&gt;DECLARE&lt;br /&gt;  cap_id            NUMBER;&lt;br /&gt;  cap_rpt           CLOB;&lt;br /&gt;  buffer            VARCHAR2(32767);&lt;br /&gt;  buffer_size       CONSTANT BINARY_INTEGER := 32767;&lt;br /&gt;  amount            BINARY_INTEGER;&lt;br /&gt;  offset            NUMBER(38);&lt;br /&gt;  file_handle       UTL_FILE.FILE_TYPE;&lt;br /&gt;  directory_name    CONSTANT VARCHAR2(80) := 'DBCAPTURE';&lt;br /&gt;  v_filename        CONSTANT VARCHAR2(80) := 'Capture.html';&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;  cap_id  := DBMS_WORKLOAD_CAPTURE.GET_CAPTURE_INFO(dir=&gt;directory_name);&lt;br /&gt;  cap_rpt := DBMS_WORKLOAD_CAPTURE.REPORT(capture_id =&gt; cap_id,&lt;br /&gt;                           format =&gt; DBMS_WORKLOAD_CAPTURE.TYPE_HTML);&lt;br /&gt;&lt;br /&gt;   -- Write Report to file&lt;br /&gt;   DBMS_OUTPUT.ENABLE(100000);&lt;br /&gt;&lt;br /&gt;   -- --------------------------------&lt;br /&gt;   -- OPEN NEW XML FILE IN WRITE MODE&lt;br /&gt;   -- --------------------------------&lt;br /&gt;   file_handle := UTL_FILE.FOPEN(location     =&gt; directory_name,&lt;br /&gt;                                 filename     =&gt; v_filename,&lt;br /&gt;                                 open_mode    =&gt; 'w',&lt;br /&gt;                                 max_linesize =&gt; buffer_size);&lt;br /&gt;&lt;br /&gt;   amount := buffer_size;&lt;br /&gt;   offset := 1;&lt;br /&gt;&lt;br /&gt;    WHILE amount &gt;= buffer_size&lt;br /&gt;    LOOP&lt;br /&gt;        DBMS_LOB.READ(lob_loc    =&gt; cap_rpt,&lt;br /&gt;                      amount     =&gt; amount,&lt;br /&gt;                      offset     =&gt; offset,&lt;br /&gt;                      buffer     =&gt; buffer);&lt;br /&gt;&lt;br /&gt;        offset := offset + amount;&lt;br /&gt;&lt;br /&gt;        UTL_FILE.PUT(file      =&gt; file_handle,&lt;br /&gt;                     buffer    =&gt; buffer);&lt;br /&gt;&lt;br /&gt;        UTL_FILE.FFLUSH(file =&gt; file_handle);&lt;br /&gt;    END LOOP;&lt;br /&gt;&lt;br /&gt;    UTL_FILE.FCLOSE(file =&gt; file_handle);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Appendix D: Generate Workload Replay Report (HTML)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- Replay Report&lt;br /&gt;DECLARE&lt;br /&gt;  cap_id            NUMBER;&lt;br /&gt;  rep_id            NUMBER;&lt;br /&gt;  rep_rpt           CLOB;&lt;br /&gt;  buffer            VARCHAR2(32767);&lt;br /&gt;  buffer_size       CONSTANT BINARY_INTEGER := 32767;&lt;br /&gt;  amount            BINARY_INTEGER;&lt;br /&gt;  offset            NUMBER(38);&lt;br /&gt;  file_handle       UTL_FILE.FILE_TYPE;&lt;br /&gt;  directory_name    CONSTANT VARCHAR2(80) := 'PROCCAPTURE';&lt;br /&gt;  v_filename        CONSTANT VARCHAR2(80) := 'Replay.html';&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;   cap_id := DBMS_WORKLOAD_REPLAY.GET_REPLAY_INFO(dir =&gt; 'PROCCAPTURE');&lt;br /&gt;   &lt;br /&gt;   select max(id) &lt;br /&gt;   into rep_id&lt;br /&gt;   from dba_workload_replays&lt;br /&gt;   where capture_id = cap_id ;&lt;br /&gt;  &lt;br /&gt;   rep_rpt := DBMS_WORKLOAD_REPLAY.REPORT(replay_id =&gt; rep_id,&lt;br /&gt;                                          format =&gt; DBMS_WORKLOAD_REPLAY.TYPE_HTML);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    -- Write Report to file&lt;br /&gt;   DBMS_OUTPUT.ENABLE(100000);&lt;br /&gt;&lt;br /&gt;   -- --------------------------------&lt;br /&gt;   -- OPEN NEW XML FILE IN WRITE MODE&lt;br /&gt;   -- --------------------------------&lt;br /&gt;   file_handle := UTL_FILE.FOPEN(location     =&gt; directory_name,&lt;br /&gt;                                 filename     =&gt; v_filename,&lt;br /&gt;                                 open_mode    =&gt; 'w',&lt;br /&gt;                                 max_linesize =&gt; buffer_size);&lt;br /&gt;&lt;br /&gt;   amount := buffer_size;&lt;br /&gt;   offset := 1;&lt;br /&gt;&lt;br /&gt;    WHILE amount &gt;= buffer_size&lt;br /&gt;    LOOP&lt;br /&gt;        DBMS_LOB.READ(lob_loc    =&gt; rep_rpt,&lt;br /&gt;                      amount     =&gt; amount,&lt;br /&gt;                      offset     =&gt; offset,&lt;br /&gt;                      buffer     =&gt; buffer);&lt;br /&gt;&lt;br /&gt;        offset := offset + amount;&lt;br /&gt;&lt;br /&gt;        UTL_FILE.PUT(file      =&gt; file_handle,&lt;br /&gt;                     buffer    =&gt; buffer);&lt;br /&gt;&lt;br /&gt;        UTL_FILE.FFLUSH(file =&gt; file_handle);&lt;br /&gt;    END LOOP;&lt;br /&gt;&lt;br /&gt;    UTL_FILE.FCLOSE(file =&gt; file_handle);&lt;br /&gt;END;&lt;br /&gt;/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-7903340694318164822?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/7903340694318164822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=7903340694318164822' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7903340694318164822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7903340694318164822'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/02/real-application-testing-database.html' title='Real Application Testing Database Replay'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-4565473174922959621</id><published>2010-02-20T15:17:00.000-05:00</published><updated>2010-02-20T15:19:03.554-05:00</updated><title type='text'>Transfer SQL Tuning Sets between Databases</title><content type='html'>1. Create a staging table to put the SQL tuning sets into.  Then put the SQL Tuning Sets into the staging table.&lt;br /&gt;See Appendix A: Create SQL Tuning Set table and put SQL Tuning Sets into table&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Ensure that you have a directory in Oracle to use to export the table using datapump&lt;br /&gt;SQL&gt; create directory DATA_PUMP_DIR as ‘C:\oracle\product\10.2.0\admin\orcl\dpdump\’ ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Export the SQL Tuning Set Staging Table to a file as to analyze the SQL tuning set will need to be done in a 11g database.&lt;br /&gt;&lt;br /&gt;expdp /@orcl directory=DATA_PUMP_DIR dumpfile=sqlset_stage_tab_exp.dmp logfile=sqlnet_stage_tab_exp.log tables=mrmessin.sqlnet_stage_tab&lt;br /&gt;&lt;br /&gt;Export: Release 10.2.0.4.0 - Production on Monday, 04 August, 2008 19:40:41&lt;br /&gt;&lt;br /&gt;Copyright (c) 2003, 2007, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;Starting "MRMESSIN"."SYS_EXPORT_TABLE_01":  /********@orcl directory=DATA_PUMP_DIR dumpfi&lt;br /&gt;xp.dmp logfile=sqlnet_stage_tab_exp.log tables=MRMESSIN.SQLSET_STAGE_TAB&lt;br /&gt;Estimate in progress using BLOCKS method...&lt;br /&gt;Processing object type TABLE_EXPORT/TABLE/TABLE_DATA&lt;br /&gt;Total estimation using BLOCKS method: 640 KB&lt;br /&gt;Processing object type TABLE_EXPORT/TABLE/TABLE&lt;br /&gt;Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX&lt;br /&gt;. . exported "MRMESSIN"."SQLSET_STAGE_TAB"               49.13 KB      44 rows&lt;br /&gt;. . exported "MRMESSIN"."SQLSET_STAGE_TAB_CPLANS"        73.24 KB     175 rows&lt;br /&gt;. . exported "MRMESSIN"."SQLSET_STAGE_TAB_CBINDS"        9.492 KB       0 rows&lt;br /&gt;Master table "MRMESSIN"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded&lt;br /&gt;******************************************************************************&lt;br /&gt;Dump file set for MRMESSIN.SYS_EXPORT_TABLE_01 is:&lt;br /&gt;  C:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\DPDUMP\SQLSET_STAGE_TAB_EXP.DMP&lt;br /&gt;Job "MRMESSIN"."SYS_EXPORT_TABLE_01" successfully completed at 19:41:16&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. create a directory for the 11g database we are going to import the sqlset staging table into.&lt;br /&gt; create directory DATA_PUMP_DIR as ‘c:\oracle\admin\orcl11g\dpdump\’ ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Copy the file to the 10g database DATA_PUMP_DIR location to the DATA_PUMP_DIR location for the 11g database.&lt;br /&gt; copy C:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\DPDUMP\SQLSET_STAGE_TAB_EXP.DMP c:\oracle\admin\orcl11g\dpdump\&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Import the SQL tuning set staging table into the 11g database.&lt;br /&gt;&lt;br /&gt;impdp /@orcl11g full=y dumpfile=sqlset_stage_tab_exp.dmp directory=DATA_PUMP_DIR logfile=sqlset_stage_tab_imp.log&lt;br /&gt;&lt;br /&gt;Import: Release 11.1.0.6.0 - Production on Monday, 04 August, 2008 20:04:38&lt;br /&gt;&lt;br /&gt;Copyright (c) 2003, 2007, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;Master table "MRMESSIN"."SYS_IMPORT_FULL_01" successfully loaded/unloaded&lt;br /&gt;Starting "MRMESSIN"."SYS_IMPORT_FULL_01":  /********@orcl11g full=y dumpfile=sqlset_stage_ta&lt;br /&gt;y=DATA_PUMP_DIR logfile=sqlset_stage_tab_imp.log&lt;br /&gt;Processing object type TABLE_EXPORT/TABLE/TABLE&lt;br /&gt;Processing object type TABLE_EXPORT/TABLE/TABLE_DATA&lt;br /&gt;. . imported "MRMESSIN"."SQLSET_STAGE_TAB"               49.13 KB      44 rows&lt;br /&gt;. . imported "MRMESSIN"."SQLSET_STAGE_TAB_CPLANS"        73.24 KB     175 rows&lt;br /&gt;. . imported "MRMESSIN"."SQLSET_STAGE_TAB_CBINDS"        9.492 KB       0 rows&lt;br /&gt;Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX&lt;br /&gt;Job "MRMESSIN"."SYS_IMPORT_FULL_01" successfully completed at 20:06:22&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Move the SQL Tuning Sets in the imported Staging table back into database SQL Tuning Sets&lt;br /&gt;See APPENDIX B: Put SQL Tuning Sets in Imported Staging Table Back into Database SQL Tuning Sets &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Run Analysis on the SQL Tuning Sets&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Appendix A: Create SQL Tuning Set table and Put SQL Tuning Sets into Table&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Script: spa_sts_to_table.sql&lt;br /&gt;-- Author; Michael R. Messina, Senior Consultant TUSC, A Rolta Company&lt;br /&gt;--&lt;br /&gt;-- create a staging table to put the SQL tuning sets into and then&lt;br /&gt;-- put the SQL tuning sets into the stage table to be moved to another&lt;br /&gt;-- database.&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;--&lt;br /&gt;set serveroutput on size 1000000&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt; DBMS_OUTPUT.PUT_LINE ('Creating the staging table to put the sql tuning set into.') ;&lt;br /&gt; -- create the staging table to put the sql tuning set into&lt;br /&gt; DBMS_SQLTUNE.create_stgtab_sqlset(table_name      =&gt; 'SQLSET_STAGE_TAB',&lt;br /&gt;                                   schema_name     =&gt; 'MRMESSIN',&lt;br /&gt;                                   tablespace_name =&gt; 'USERS');&lt;br /&gt;&lt;br /&gt; DBMS_OUTPUT.PUT_LINE ('Putting the first SQL tuning sets into the staging table.') ;&lt;br /&gt; -- put the first SQL tuning set into the staging table&lt;br /&gt; DBMS_SQLTUNE.pack_stgtab_sqlset(sqlset_name          =&gt; 'STS_SPA_1',&lt;br /&gt;                                 sqlset_owner         =&gt; 'MRMESSIN',&lt;br /&gt;                                 staging_table_name   =&gt; 'SQLSET_STAGE_TAB',&lt;br /&gt;                                 staging_schema_owner =&gt; 'MRMESSIN');&lt;br /&gt;&lt;br /&gt;END ;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Query and view our sql tuning sets&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;select owner, name, created, statement_count from dba_sqlset ;&lt;br /&gt;&lt;br /&gt;spool off&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;APPENDIX B: Put SQL Tuning Sets in Imported Staging Table Back into Database SQL Tuning Sets&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Script: spa_stage_tab_to_sts.sql&lt;br /&gt;-- Author; Michael R. Messina, Senior Consultant TUSC, A Rolta Company&lt;br /&gt;--&lt;br /&gt;-- take the imported staging table for the SQL Tuning Sets and unpack them&lt;br /&gt;-- back into STS for analysis&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;--&lt;br /&gt;-- Write Output to a file for later review if needed.&lt;br /&gt;spool spa_stage_tab_to_sts.out&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;  DBMS_SQLTUNE.unpack_stgtab_sqlset(sqlset_name          =&gt; '%',&lt;br /&gt;                                    sqlset_owner         =&gt; 'MRMESSIN',&lt;br /&gt;                                    replace              =&gt; TRUE,&lt;br /&gt;                                    staging_table_name   =&gt; 'SQLSET_STAGE_TAB',&lt;br /&gt;                                    staging_schema_owner =&gt; 'MRMESSIN');&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Query and view our sql tuning sets&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;select owner, name, created, statement_count from dba_sqlset ;&lt;br /&gt;&lt;br /&gt;spool off&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-4565473174922959621?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/4565473174922959621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=4565473174922959621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4565473174922959621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4565473174922959621'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/02/transfer-sql-tuning-sets-between.html' title='Transfer SQL Tuning Sets between Databases'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-7386174902916176069</id><published>2010-02-19T21:43:00.000-05:00</published><updated>2010-02-19T21:46:16.509-05:00</updated><title type='text'></title><content type='html'>Just came back from RMOUG and excited about all the technical discussions I was able to have with everyone.  I saw some good presentations and met some great people.  I was able to get through all my presentations and able to give away a lot of free stuff in them as well.  Hope everyone enjoyed the free stuff, I enjoyed giving it out.  Come see me at collaborate, I will give out some more free stuff, you never know what I might give out next.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-7386174902916176069?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/7386174902916176069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=7386174902916176069' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7386174902916176069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7386174902916176069'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2010/02/just-came-back-from-rmoug-and-excited.html' title=''/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-3312809571614768879</id><published>2009-10-17T08:25:00.000-04:00</published><updated>2009-10-17T08:27:16.106-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Central AWR Update 1'/><title type='text'></title><content type='html'>All,&lt;br /&gt;&lt;br /&gt;There was a lot of interest in my Oracle Open World Presentation on Centralizing the Automatic Worklad Repository (Central AWR).  If you are interested you can email me, leave a message for me here or watch here as I will update when I have further information on its availability.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-3312809571614768879?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/3312809571614768879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=3312809571614768879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3312809571614768879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3312809571614768879'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/10/all-there-was-lot-of-interest-in-my.html' title=''/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-2515755769727857051</id><published>2009-01-28T10:38:00.001-05:00</published><updated>2009-01-28T15:44:44.667-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring and Tuning Oracle Flashback Capabilities'/><title type='text'>Monitoring and Tuning Oracle Flashback Capabilities</title><content type='html'>&lt;a name="_Toc219689002"&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Determining the Current Flashback Database Window&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;At any given time, the earliest point in time to which you can actually rewind your database by using Flashback Database can be determined by querying the V$FLASHBACK_DATABASE_LOG view as shown in this example:&lt;br /&gt;&lt;a name="1016763"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; SELECT OLDEST_FLASHBACK_SCN, OLDEST_FLASHBACK_TIME&lt;br /&gt;&lt;/span&gt;&lt;a name="1016764"&gt;&lt;/a&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;FROM V$FLASHBACK_DATABASE_LOG;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name="_Toc219689003"&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Monitoring Flashback Logs&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;Monitoring the flashback logs can be monitored to help understand the overhead and the nature of flashback log generation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; select * from v$flashback_database_stat ;&lt;/span&gt;&lt;br /&gt;&lt;a name="_Toc219689004"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Determine Transactional Flashback&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;Definitions&lt;br /&gt;&lt;/em&gt;Current Undo Size – Current space for the undo tablespace in MB&lt;br /&gt;&lt;br /&gt;Current undo_retention Setting – value of undo_retention database initialization parameter&lt;br /&gt;&lt;br /&gt;Optimal undo_retention Setting – current capability of undo retention in seconds based on undo transactional activity and current undo size.&lt;br /&gt;&lt;br /&gt;Desired undo_retention Setting – value in seconds to meeting undo/transactional flashback requirements&lt;br /&gt;&lt;br /&gt;Steps to Gather Data for undo/transactional Flashback&lt;br /&gt;1. Locate/Create see_optimal_undo_retention.&lt;br /&gt;See Appendix A: see_optimal_undo_retention.sql&lt;br /&gt;&lt;br /&gt;2. Execute see_optimal_undo_retention.sql&lt;br /&gt;SQL&gt; @see_optimal_undo_retention.sql&lt;br /&gt;&lt;br /&gt;3. Enter Desired Undo Retention in Seconds&lt;br /&gt;259200 -- 72 hours or 3 days in seconds&lt;br /&gt;&lt;br /&gt;4. Evaluate output results&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Output from see_optimal_undo_retention.sql&lt;/em&gt;&lt;br /&gt;Enter Desired Undo Retention in Seconds -&gt;259200&lt;br /&gt;old 2: v_desired_undo_retention NUMBER := &amp;amp;desired_undo_retention ;&lt;br /&gt;new 2: v_desired_undo_retention NUMBER := 259200 ;&lt;br /&gt;&lt;br /&gt;Current undo Size --&gt; 16912MB&lt;br /&gt;Current undo_retention Setting --&gt; 25200 Seconds&lt;br /&gt;Optimal undo_retention Setting --&gt; 221129.88 Seconds&lt;br /&gt;Desired undo_retention Setting --&gt; 259200 Seconds&lt;br /&gt;Undo Size for desired retention --&gt; 10021.36MB&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Evaluating output results from see_optimal_undo_retention.sql&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;Is the current undo_retention optimal?&lt;br /&gt;To evaluate if the current undo_retention is being met and see if undo_retention can be increased look at the current undo_retention setting and the optimal undo_retention_setting over several executions over a period of time. If the optimal undo_retention_setting is consistently more then the current undo_retention_setting then undo_retention can be increased.&lt;br /&gt;&lt;br /&gt;Can the database meet the desired undo_retention?&lt;br /&gt;The main consideration from the output is boiled down to the current value of the desired undo_retention setting and the optimal undo retention setting. When the optimal undo retention setting is lower then the desired undo_retention setting it means that the database is not able to meet the desired retention. Evaluate the undo size for desired retention to determine the undo tablespace size require to minimally meet the desired undo_retention.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;Monitor Undo Retention &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;With undo_retention set we need to ensure that the undo_retention is being met by the database. Therefore the undo_retention capability must be consistently monitored.&lt;br /&gt;&lt;br /&gt;1. Locate/create verify_undo_retention_target.sql&lt;br /&gt;See Appendix B: verify_undo_retention_target.sql&lt;br /&gt;&lt;br /&gt;2. Execute the verify_undo_retention.sql script&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; @verify_undo_retention_target &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Evaluate output from script&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example Output when Undo Retention is being met&lt;br /&gt;&lt;/em&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; @verify_undo_retention_target&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;Example Output when Undo Retention is no being met&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; @verify_undo_retention_target&lt;br /&gt;Undo Retention Target can not be Met! Undo Adjustments Needed!&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;Current undo Size --&gt; 30MB&lt;br /&gt;Current undo_retention Setting --&gt; 2000 Seconds&lt;br /&gt;Current undo_retention Capable --&gt; 1106.1 Seconds&lt;br /&gt;Undo Size for desired retention --&gt; 54.24MB&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:arial;color:#000000;"&gt;Performance Tuning for Flashback Database &lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;&lt;a name="1016769"&gt;&lt;/a&gt;&lt;br /&gt;Changed blocks are written from memory to the flashback logs at relatively infrequent, regular intervals, to limit processing and I/O overhead.&lt;br /&gt;&lt;br /&gt;To achieve good performance for large production databases with Flashback Database enabled, Oracle recommends:&lt;br /&gt;&lt;br /&gt;&lt;a name="1016771"&gt;&lt;/a&gt;&lt;br /&gt;· Use a fast file system for your flash recovery area, preferably without operating system file caching. Files the database creates in the flash recovery area, including flashback logs, are typically large. Operating system file caching is typically not effective for these files, and may actually add CPU overhead for reading from and writing to these files. Thus, it is recommended to use a file system that avoids operating system file caching, such as ASM, or the Solaris 2.8 file system with direct I/O.&lt;br /&gt;&lt;br /&gt;&lt;a name="1020307"&gt;&lt;/a&gt;· Configure enough disk spindles for the file system that will hold the flash recovery area. For large production databases, multiple disk spindles may be needed to support the required disk throughput for the database to write the flashback logs effectively.&lt;br /&gt;&lt;a name="1016773"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;· If the storage system used to hold the flash recovery area does not have non-volatile RAM, try to configure the file system on top of striped storage volumes, with a relatively small stripe size such as 128K. This will allow each write to the flashback logs to be spread across multiple spindles, improving performance&lt;br /&gt;&lt;a name="1016777"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;· For large, production databases, set the init.ora parameter LOG_BUFFER to be at least 8MB. This makes sure the database allocates maximum memory (typically 16MB) for writing flashback database logs.&lt;br /&gt;&lt;a name="1016778"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The overhead of turning on logging for Flashback Database depends on the read-write mix of the database workload. The more write-intensive the workload, the higher the overhead caused by turning on logging for Flashback Database. (Queries do not change data and thus do not contribute to logging activity for Flashback Database.)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name="_Toc219689005"&gt;&lt;span&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Appendix A: see_optimal_undo_retention.sql &lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;-- Script: see_optimal_undo_retention.sql&lt;br /&gt;-- Author: Michael Messina&lt;br /&gt;--&lt;br /&gt;-- Description: Will calculate based on undo utilization and undo size&lt;br /&gt;-- the optimal value for undo_retention.&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;set serveroutput on size 1000000&lt;br /&gt;set feedback off&lt;br /&gt;&lt;br /&gt;ACCEPT desired_undo_retention PROMPT "Enter Desired Undo Retention in Seconds -&gt;"&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;v_desired_undo_retention NUMBER := &amp;amp;desired_undo_retention ;&lt;br /&gt;v_block_size NUMBER ;&lt;br /&gt;v_undo_size NUMBER ;&lt;br /&gt;v_undo_blocks_per_sec NUMBER ;&lt;br /&gt;v_optimal_undo_retention NUMBER ;&lt;br /&gt;v_current_undo_retention NUMBER ;&lt;br /&gt;v_undo_size_desired_ret NUMBER ;&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;-- get the current undo retention setting&lt;br /&gt;select TO_NUMBER(value)&lt;br /&gt;INTO v_current_undo_retention&lt;br /&gt;FROM v$parameter&lt;br /&gt;WHERE name = 'undo_retention' ;&lt;br /&gt;&lt;br /&gt;-- Calculate Actual Undo Size&lt;br /&gt;SELECT SUM(a.bytes)&lt;br /&gt;INTO v_undo_size&lt;br /&gt;FROM v$datafile a,&lt;br /&gt;v$tablespace b,&lt;br /&gt;dba_tablespaces c&lt;br /&gt;WHERE c.contents = 'UNDO'&lt;br /&gt;AND c.status = 'ONLINE'&lt;br /&gt;AND b.name = c.tablespace_name&lt;br /&gt;AND a.ts# = b.ts#;&lt;br /&gt;&lt;br /&gt;-- Calcuate the Undo Blocks per Second&lt;br /&gt;SELECT MAX(undoblks/((end_time-begin_time)*3600*24))&lt;br /&gt;INTO v_undo_blocks_per_sec&lt;br /&gt;FROM v$undostat ;&lt;br /&gt;&lt;br /&gt;-- Get the database block size&lt;br /&gt;SELECT TO_NUMBER(value)&lt;br /&gt;INTO v_block_size&lt;br /&gt;FROM v$parameter&lt;br /&gt;WHERE name = 'db_block_size';&lt;br /&gt;&lt;br /&gt;v_optimal_undo_retention := v_undo_size/(v_block_size * v_undo_blocks_per_sec) ;&lt;br /&gt;v_undo_size_desired_ret := ((v_block_size * v_undo_blocks_per_sec) * (v_desired_undo_retention)) / 1024 / 1024 ;&lt;br /&gt;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Current undo Size --&gt; '  TO_CHAR(v_undo_size/1024/1024)  'MB') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Current undo_retention Setting --&gt; '  TO_CHAR(v_current_undo_retention)  ' Seconds') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Optimal undo_retention Setting --&gt; '  TO_CHAR(ROUND(v_optimal_undo_retention,2))  ' Seconds') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Desired undo_retention Setting --&gt; '  TO_CHAR(ROUND(v_desired_undo_retention,2))  ' Seconds') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('Undo Size for desired retention --&gt; '  TO_CHAR(ROUND(v_undo_size_desired_ret,2))  'MB') ;&lt;br /&gt;END ;&lt;br /&gt;/&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;Appendix B: verify_undo_retention_target.sql&lt;/span&gt;&lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;---------------------------------------------------------------------------------&lt;br /&gt;-- Script: verify_undo_retention_target.sql&lt;br /&gt;-- Author: Michael Messina&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;--&lt;br /&gt;-- Description: Will calculate based on undo utilization and undo size&lt;br /&gt;-- the optimal value for undo_retention and compare against&lt;br /&gt;-- current undo_retention value.&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;set serveroutput on size 1000000&lt;br /&gt;set feedback off&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;v_block_size NUMBER ;&lt;br /&gt;v_undo_size NUMBER ;&lt;br /&gt;v_undo_blocks_per_sec NUMBER ;&lt;br /&gt;v_optimal_undo_retention NUMBER ;&lt;br /&gt;v_current_undo_retention NUMBER ;&lt;br /&gt;v_undo_size_desired_ret NUMBER ;&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;-- get the current undo retention setting&lt;br /&gt;select TO_NUMBER(value)&lt;br /&gt;INTO v_current_undo_retention&lt;br /&gt;FROM v$parameter&lt;br /&gt;WHERE name = 'undo_retention' ;&lt;br /&gt;&lt;br /&gt;-- Calculate Actual Undo Size&lt;br /&gt;SELECT SUM(a.bytes)&lt;br /&gt;INTO v_undo_size&lt;br /&gt;FROM v$datafile a,&lt;br /&gt;v$tablespace b,&lt;br /&gt;dba_tablespaces c&lt;br /&gt;WHERE c.contents = 'UNDO'&lt;br /&gt;AND c.status = 'ONLINE'&lt;br /&gt;AND b.name = c.tablespace_name&lt;br /&gt;AND a.ts# = b.ts#;&lt;br /&gt;&lt;br /&gt;-- Calculate the Undo Blocks per Second&lt;br /&gt;SELECT MAX(undoblks/((end_time-begin_time)*3600*24))&lt;br /&gt;INTO v_undo_blocks_per_sec&lt;br /&gt;FROM v$undostat ;&lt;br /&gt;&lt;br /&gt;-- Get the database block size&lt;br /&gt;SELECT TO_NUMBER(value)&lt;br /&gt;INTO v_block_size&lt;br /&gt;FROM v$parameter&lt;br /&gt;WHERE name = 'db_block_size';&lt;br /&gt;&lt;br /&gt;v_optimal_undo_retention := v_undo_size/(v_block_size * v_undo_blocks_per_sec) ;&lt;br /&gt;&lt;br /&gt;if v_current_undo_retention &gt; v_optimal_undo_retention then&lt;br /&gt;v_undo_size_desired_ret := ((v_block_size * v_undo_blocks_per_sec) * (v_current_undo_retention)) / 1024&lt;br /&gt;/ 1024 ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('Undo Retention Target can not be Met! Undo Adjustments Needed!') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('---------------------------------------------------------------') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Current undo Size --&gt; '  TO_CHAR(v_undo_size/1024/1024)  'MB')&lt;br /&gt;;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Current undo_retention Setting --&gt; '  TO_CHAR(v_current_undo_retention)  ' S&lt;br /&gt;econds') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' Current undo_retention Capable --&gt; '  TO_CHAR(ROUND(v_optimal_undo_retention,2&lt;br /&gt;))  ' Seconds') ;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('Undo Size for desired retention --&gt; '  TO_CHAR(ROUND(v_undo_size_desired_ret,2)&lt;br /&gt;)  'MB') ;&lt;br /&gt;end if ;&lt;br /&gt;&lt;br /&gt;END ;&lt;br /&gt;/&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-2515755769727857051?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/2515755769727857051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=2515755769727857051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2515755769727857051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2515755769727857051'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/monitoring-and-tuning-oracle-flashback.html' title='Monitoring and Tuning Oracle Flashback Capabilities'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8517868947679329719</id><published>2009-01-28T10:24:00.000-05:00</published><updated>2009-01-28T15:45:15.747-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Flashback Table'/><title type='text'>Oracle Flashback Table</title><content type='html'>&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Oracle Flashback Table provides the capability to essentially recover a single table or multiple tables to a prior specified point in time without taking impacting any part of the databases availability. Flashback Table allows the contents of one or more individual tables to revert to their state at some past SCN or time. Flashback Table can eliminate the need to perform auxiliary point-in-time recovery operations. Flashback Table can restore tables to a prior point in time while maintaining all associated indexes, triggers and constraints. This is most valuable when a large amount of data in the table has been removed or updated by a process and you want to bring the table back to the state prior to the process execution.&lt;br /&gt;&lt;br /&gt;Flashback Table uses the undo tablespace block data to execute the restoration of the table. You do not have to restore any data from backups, and the rest of your database remains available while the Flashback Table operation is being performed.&lt;br /&gt;&lt;br /&gt;Flashback Table does however require row movement to be enabled and the flashback object privilege or the flashback any table system privilege in addition to select, insert, update, delete and alter permissions on the table.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#ff0000;"&gt;** Note: This is a permanent process, once the table is flashed back you can not bring it back forward again, therefore be careful about the flash back table operations you perform.&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Performing Flashback Table&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Simple example will utilize the scott.emp table with the following records:&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Setting up for the example we will remove some rows from the scott.emp table.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select to_char(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') from dual ;&lt;br /&gt;&lt;br /&gt;TO_CHAR(SYSDATE,'MM&lt;br /&gt;-------------------&lt;br /&gt;01/23/2009 08:38:01&lt;br /&gt;&lt;br /&gt;SQL&gt; delete from scott.emp where empno = 7369 ;&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;SQL&gt; delete from scott.emp where empno = 7782 ;&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;1. Verify the data is missing. In the example setup above we will check scott.emp for the missing records.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;12 rows selected.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span &gt;Or a way to show what is missing or updated using a flashback query.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp as of timestamp to_timestamp('01/23/2009 08:38:00','mm/dd/yyyy hh24:mi:ss') minus select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-family:arial;"&gt;2. Identify the time or SCN the table has to go back to.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;3. Flashback the table&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; ALTER TABLE scott.emp ENABLE ROW MOVEMENT;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; FLASHBACK TABLE SCOTT.EMP TO TIMESTAMP&lt;br /&gt;2 TO_TIMESTAMP('2009-01-23 08:38:00', 'YYYY-MM-DD HH24:MI:SS')&lt;br /&gt;3 ;&lt;br /&gt;&lt;br /&gt;Flashback complete.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;4. Check the table and verify it is back to prior state.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;&lt;br /&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;5. Show that the operation can not be rolled back.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;&lt;br /&gt;SQL&gt; rollback ;&lt;br /&gt;&lt;br /&gt;Rollback complete.&lt;br /&gt;&lt;br /&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;6. Even if we exit the session and log back in the changes are still in place&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;&lt;br /&gt;SQL&gt; exit&lt;br /&gt;Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;&lt;br /&gt;$ sqlplus mrmessin@orcl&lt;br /&gt;&lt;br /&gt;SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jan 23 08:56:43 2009&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2008, Oracle. All rights reserved.&lt;br /&gt;&lt;br /&gt;Enter password:&lt;br /&gt;&lt;br /&gt;Connected to:&lt;br /&gt;Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;/span&gt;SQL&gt; select * from scott.emp;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8517868947679329719?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8517868947679329719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8517868947679329719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8517868947679329719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8517868947679329719'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/oracle-flashback-table.html' title='Oracle Flashback Table'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-1362924272414292939</id><published>2009-01-28T10:13:00.000-05:00</published><updated>2009-01-28T15:47:26.346-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Flashback Query'/><title type='text'>Oracle Flashback Query</title><content type='html'>&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Oracle Flashback Query feature utilizes the undo segments within the undo tablespace to execute a query as the query would have returned at a prior point in time using a timestamp or SCN number. This feature is powerful in the event of erroneously delete or update rows. How far back to a previous point in time Flashback Query is capable of executing directly depends on the transaction rate of you database in relationship to the size of the undo tablespace. While the undo_retention database initialization parameter is used to target the undo retention time that makes flashback query possible there must be enough undo tablespace to handle the transactional activity of the database to meet the undo_retention target. The undo_retention is a target and if the transactional activity of the database is high enough and the database needs undo space to continue executing transaction it will overwrite undo information needed to meet the retention. Keep this in mind when setting up and planning your undo retention capabilities.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Executing a Flashback Query&lt;br /&gt;&lt;/strong&gt;Procedure assumes that the flashback capabilities were setup and tuned as outline in Setup Oracle Transactional Flashback Capability (Automatic Undo)&lt;br /&gt;&lt;br /&gt;Simple examples will utilize the scott.emp table with the following records:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Delete Example&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Setting up for the example we will remove some rows from the scott.emp table.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select to_char(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') from dual ;&lt;br /&gt;&lt;br /&gt;TO_CHAR(SYSDATE,'MM&lt;br /&gt;-------------------&lt;br /&gt;01/21/2009 09:53:21&lt;br /&gt;&lt;br /&gt;SQL&gt; delete from scott.emp where empno = 7369 ;&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;SQL&gt; delete from scott.emp where empno = 7782 ;&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Verify the data is missing. In the example setup above we will check scott.emp for the missing records.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:courier new;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;12 rows selected.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;2. Next step is to identify what prior point in time the table has the records you are looking for. This will more then likely require input from the customer that reporting the missing data.&lt;br /&gt;In the example case we will want to go back before 01/21/2009 9:53am.&lt;br /&gt;&lt;br /&gt;3. Execute the query with flashback syntax using a timestamp&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp as of timestamp to_timestamp('01/21/2009 09:53:00','mm/dd/yyyy hh24:mi:ss') minus select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;OR&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp as of timestamp to_timestamp('01/21/2009 09:53:00','mm/dd/yyyy hh24:mi:ss') ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;** 7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;** 7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;** As you can see the rows deleted are there……&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4. Execute Repair and put the deleted rows back&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; insert into scott.emp values ('7369','SMITH','CLERK','7902', TO_DATE('17-DEC-1980','DD-MON-YYYY'),800,NUL&lt;br /&gt;L,20) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into scott.emp values ('7782','CLARK','MANAGER','7839',TO_DATE('09-JUN-1981','DD-MON-YYYY'),2450,N&lt;br /&gt;ULL,10) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Update Example&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Setting up for the example we will update some rows from the scott.emp table.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select to_char(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') from dual ;&lt;br /&gt;&lt;br /&gt;TO_CHAR(SYSDATE,'MM&lt;br /&gt;-------------------&lt;br /&gt;01/22/2009 10:36:18&lt;br /&gt;&lt;br /&gt;SQL&gt; update scott.emp set sal=10000 where empno=7369 ;&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; update scott.emp set sal=10000 where empno=7782 ;&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;1. Verify the data is updated&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 10000 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 10000 10&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;2. Next step is to identify what prior point in time the table has the records correctly. This will more then likely require input from the customer that reporting the missing data.&lt;br /&gt;&lt;br /&gt;3. Execute the query with flashback syntax using a timestamp&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp as of timestamp to_timestamp('01/22/2009 10:36:00','mm/dd/yyyy hh24:mi:ss') ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;OR Show only the rows that are different.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp as of timestamp to_timestamp('01/21/2009 10:36:00','mm/dd/yyyy hh24:mi:ss')&lt;br /&gt;2 minus&lt;br /&gt;3 select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4. Execute Repair and put the deleted rows back&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; update scott.emp set sal=800 where empno=7369 ;&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; update scott.emp set sal=2450 where empno=7782 ;&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-1362924272414292939?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/1362924272414292939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=1362924272414292939' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1362924272414292939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1362924272414292939'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/oracle-flashback-query.html' title='Oracle Flashback Query'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-49544787532260302</id><published>2009-01-28T09:21:00.001-05:00</published><updated>2009-01-28T10:06:25.447-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Setup Oracle Flashback Database'/><title type='text'>Setup Oracle Flashback Database</title><content type='html'>&lt;strong&gt;Requirements for Flashback Database&lt;br /&gt;&lt;/strong&gt;1. Your database must be running in ARCHIVELOG mode.&lt;br /&gt;&lt;br /&gt;2. You must have a flash recovery area enabled, because flashback logs can only be stored in the flash recovery area.&lt;br /&gt;&lt;br /&gt;3. For Real Application Clusters databases, the flash recovery area must be stored in a clustered file system or in ASM.&lt;br /&gt;&lt;br /&gt;4. To enable Flashback Database, set the DB_FLASHBACK_RETENTION_TARGET initialization parameter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Setups for Setup Oracle Flashback Database&lt;/strong&gt;&lt;br /&gt;1. Check that the db_flashback_retention_target, db_recovery_file_dest and db_recovery_file_dest_size are set&lt;br /&gt;&lt;br /&gt;SQL&gt; select name, value from v$parameter where name like '%flash%';&lt;br /&gt;NAME VALUE&lt;br /&gt;-------------------------------- --------------------------------------- db_flashback_retention_target 1440&lt;br /&gt;&lt;br /&gt;SQL&gt; select name, value from v$parameter where name like '%recovery%';&lt;br /&gt;NAME VALUE&lt;br /&gt;------------------------ --------------------------------------- db_recovery_file_dest /opt/oracle/flash_recovery_area&lt;br /&gt;db_recovery_file_dest_size 2147483648&lt;br /&gt;&lt;br /&gt;2. Make sure the database is in archive log mode.&lt;br /&gt;SQL&gt; select name, log_mode from v$database ;&lt;br /&gt;NAME LOG_MODE&lt;br /&gt;--------- ------------&lt;br /&gt;ORCL NOARCHIVELOG&lt;br /&gt;&lt;br /&gt;3. If database not in archive log mode turn on Archive log mode.&lt;br /&gt;SQL&gt; shutdown immediate&lt;br /&gt;Database closed.&lt;br /&gt;Database dismounted.&lt;br /&gt;ORACLE instance shut down.&lt;br /&gt;&lt;br /&gt;SQL&gt; startup mount&lt;br /&gt;ORACLE instance started.&lt;br /&gt;Total System Global Area 368263168 bytes&lt;br /&gt;Fixed Size 1299988 bytes&lt;br /&gt;Variable Size 268437996 bytes&lt;br /&gt;Database Buffers 92274688 bytes&lt;br /&gt;Redo Buffers 6250496 bytes&lt;br /&gt;Database mounted.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter database archivelog ;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter database open ;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;4. Turn the flashback on&lt;br /&gt;SQL&gt; shutdown immediate&lt;br /&gt;Database closed.&lt;br /&gt;Database dismounted.&lt;br /&gt;ORACLE instance shut down.&lt;br /&gt;&lt;br /&gt;SQL&gt; startup mount&lt;br /&gt;ORACLE instance started.&lt;br /&gt;Total System Global Area 368263168 bytes&lt;br /&gt;Fixed Size 1299988 bytes&lt;br /&gt;Variable Size 268437996 bytes&lt;br /&gt;Database Buffers 92274688 bytes&lt;br /&gt;Redo Buffers 6250496 bytes&lt;br /&gt;Database mounted.&lt;br /&gt;&lt;br /&gt;SQL&gt; ALTER DATABASE FLASHBACK ON;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter database open ;&lt;br /&gt;Database altered.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-49544787532260302?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/49544787532260302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=49544787532260302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/49544787532260302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/49544787532260302'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/setup-oracle-flashback-database.html' title='Setup Oracle Flashback Database'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8469459280652776580</id><published>2009-01-28T09:02:00.000-05:00</published><updated>2009-01-28T10:11:05.337-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Setup Oracle Transactional Flashback Capability (Automatic Undo)'/><title type='text'>Setup Oracle Transactional Flashback Capability (Automatic Undo)</title><content type='html'>&lt;p&gt;1. Check if Automatic Undo Management is begin used, undo tablespace is set and undo_retention is set?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;SQL&gt; select name, value from v$parameter where name like 'undo%';&lt;br /&gt;&lt;br /&gt;NAME VALUE&lt;br /&gt;---------------------- -----------------------------------------&lt;br /&gt;undo_management AUTO&lt;br /&gt;undo_tablespace UNDOTBS1&lt;br /&gt;undo_retention 900&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;2. If Not Using Automatic Undo Setup Automatic Undo&lt;br /&gt;&lt;br /&gt;Create undo tablespace&lt;br /&gt;create undo tablespace undotbs1 datafile ‘c:\oracle\data\ORCL\undotbl1.dbf’ size 500M ;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Set undo_tablespace to undo tablespace created&lt;br /&gt;Alter system set undo_tablespace=undotbs1 scope=spfile ;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Set undo_retention to time period for transactional flashbacks alter system set undo_retention=900 scope=spfile ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;3. If had to setup auto undo bounce database&lt;br /&gt;SQL&gt; shutdown immediate&lt;br /&gt;SQL&gt; startup&lt;br /&gt;&lt;br /&gt;4. Update transactional flashback sizing and retention over time&lt;br /&gt;See Sizing Transactional Flashback Capabilities - Sizing the undo tablespace and undo_retention&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8469459280652776580?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8469459280652776580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8469459280652776580' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8469459280652776580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8469459280652776580'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/setup-transactional-flashback.html' title='Setup Oracle Transactional Flashback Capability (Automatic Undo)'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-2060188559055710558</id><published>2009-01-28T08:49:00.000-05:00</published><updated>2009-01-28T15:46:45.054-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Flashback Transaction Query'/><title type='text'>Oracle Flashback Transaction Query</title><content type='html'>&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Flashback Transaction Query has a lot of the same functionality as Log Miner without the additional overhead associated with Log Miner mining redo logs for undo information. Flashback Transaction Query utilizes an access path to undo data which makes it faster than LogMiner at extracting the undo information. Unlike flashback query, flashback transaction query requires the select any transaction system privilege. How far back to a previous point in time Flashback Transaction Query is capable of executing directly depends on the transaction rate of you database in relationship to the size of the undo tablespace. While the undo_retention database initialization parameter is used to target the undo retention time that makes flashback query possible there must be enough undo tablespace to handle the transactional activity of the database to meet the undo_retention target. The undo_retention is a target and if the transactional activity of the database is high enough and the database needs undo space to continue executing transaction it will overwrite undo information needed to meet the retention. Keep this in mind when setting up and planning your undo retention capabilities.&lt;br /&gt;See Monitoring and Tuning Flashback Capabilities&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Executing Flashback Transaction Query&lt;br /&gt;&lt;/strong&gt;Procedure assumes that the transaction flashback capabilities were setup and tuned as outline in Setup Transactional Flashback Capability (Automatic Undo)&lt;br /&gt;&lt;br /&gt;Simple example will utilize the scott.emp table with the following records:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;1. Record current scn prior to making any changes&lt;br /&gt;&lt;br /&gt;SQL&gt; select current_scn scn from sys.v_$database ;&lt;br /&gt;&lt;br /&gt;SCN&lt;br /&gt;----------&lt;br /&gt;1068761&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Change some records with various inserts, updates and deletes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; delete from scott.emp where empno = 7369 ;&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;SQL&gt; delete from scott.emp where empno = 7782 ;&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;SQL&gt; update scott.emp set sal=10000 where empno = 7876 ;&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; update scott.emp set sal=0 where empno = 7839 ;&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3. Verify data changes&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 0 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 10000 20&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;12 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;4. Review Undo for Changes Made&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; select /*undo_change#,*/ undo_sql&lt;br /&gt;2 from flashback_transaction_query&lt;br /&gt;3 where table_name = 'EMP' and&lt;br /&gt;4 table_owner = 'SCOTT' and&lt;br /&gt;5 logon_user = 'SYS' and&lt;br /&gt;6 commit_scn &gt; 1068761&lt;br /&gt;7 order by undo_change# ;&lt;br /&gt;&lt;br /&gt;UNDO_SQL&lt;br /&gt;----------------------------------------------------------------------------------------------------&lt;br /&gt;update "SCOTT"."EMP" set "SAL" = '5000' where ROWID = 'AAAMlsAAEAAAAAgAAI';&lt;br /&gt;update "SCOTT"."EMP" set "SAL" = '1100' where ROWID = 'AAAMlsAAEAAAAAgAAK';&lt;br /&gt;insert into "SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO") values ('7782','CLARK','MANAGER','7839',TO_DATE('09-JUN-81', 'DD-MON-RR'),'2450',NULL,'10');&lt;br /&gt;insert into "SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO") values ('7369','SMITH','CLERK','7902',TO_DATE('17-DEC-80', 'DD-MON-RR'),'800',NULL,'20');&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;5. Undo Changes&lt;br /&gt;See Example Script Below Appendix A: Fix Script Example using Flashback Transaction Query&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;SQL&gt; @flashback_transaction_query.sql&lt;br /&gt;Enter value for scnnumber: 1068761&lt;br /&gt;old 8: commit_scn &gt; &amp;amp;scnnumber&lt;br /&gt;new 8: commit_scn &gt; 1068761&lt;br /&gt;undo_change#: 1&lt;br /&gt;update "SCOTT"."EMP" set "SAL" = '5000' where ROWID = 'AAAMlsAAEAAAAAgAAI';&lt;br /&gt;undo_change#: 2&lt;br /&gt;update "SCOTT"."EMP" set "SAL" = '1100' where ROWID = 'AAAMlsAAEAAAAAgAAK';&lt;br /&gt;undo_change#: 3&lt;br /&gt;insert into&lt;br /&gt;"SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO")&lt;br /&gt;values ('7782','CLARK','MANAGER','7839',TO_DATE('09-JUN-81',&lt;br /&gt;'DD-MON-RR'),'2450',NULL,'10');&lt;br /&gt;undo_change#: 4&lt;br /&gt;insert into&lt;br /&gt;"SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO")&lt;br /&gt;values ('7369','SMITH','CLERK','7902',TO_DATE('17-DEC-80',&lt;br /&gt;'DD-MON-RR'),'800',NULL,'20');&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;Or execute the SQL statements from the prior query&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:78%;"&gt;update "SCOTT"."EMP" set "SAL" = '5000' where ROWID = 'AAAMlsAAEAAAAAgAAI';&lt;br /&gt;&lt;br /&gt;update "SCOTT"."EMP" set "SAL" = '1100' where ROWID = 'AAAMlsAAEAAAAAgAAK';&lt;br /&gt;&lt;br /&gt;insert into "SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO") values ('7782','CLARK','MANAGER','7839',TO_DATE('09-JUN-81', 'DD-MON-RR'),'2450',NULL,'10');&lt;br /&gt;&lt;br /&gt;insert into "SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO") values ('7369','SMITH','CLERK','7902',TO_DATE('17-DEC-80', 'DD-MON-RR'),'800',NULL,'20');&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;6. Verify Changes are Un-done&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:courier new;"&gt;SQL&gt; select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7782 CLARK MANAGER 7839 09-JUN-81 2450 10&lt;br /&gt;7369 SMITH CLERK 7902 17-DEC-80 800 20&lt;br /&gt;7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30&lt;br /&gt;7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30&lt;br /&gt;7566 JONES MANAGER 7839 02-APR-81 2975 20&lt;br /&gt;7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30&lt;br /&gt;7698 BLAKE MANAGER 7839 01-MAY-81 2850 30&lt;br /&gt;7788 SCOTT ANALYST 7566 19-APR-87 3000 20&lt;br /&gt;7839 KING PRESIDENT 17-NOV-81 5000 10&lt;br /&gt;7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30&lt;br /&gt;7876 ADAMS CLERK 7788 23-MAY-87 1100 20&lt;br /&gt;&lt;br /&gt;EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO&lt;br /&gt;---------- ---------- --------- ---------- --------- ---------- ---------- ----------&lt;br /&gt;7900 JAMES CLERK 7698 03-DEC-81 950 30&lt;br /&gt;7902 FORD ANALYST 7566 03-DEC-81 3000 20&lt;br /&gt;7934 MILLER CLERK 7782 23-JAN-82 1300 10&lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Appendix A: Fix Script Example using Flashback Transaction Query&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SET SERVEROUTPUT ON SIZE 1000000&lt;br /&gt;begin&lt;br /&gt;for r in (&lt;br /&gt;&lt;br /&gt;select /*undo_change#,*/ undo_sql&lt;br /&gt;from flashback_trasnaction_query&lt;br /&gt;where table_name = 'EMP' and&lt;br /&gt;table_owner = 'SCOTT' and&lt;br /&gt;logon_user = 'SYS' and&lt;br /&gt;commit_scn &gt; &amp;amp;scnnumber&lt;br /&gt;order by undo_change#&lt;br /&gt;) loop&lt;br /&gt;&lt;br /&gt;dbms_output.put_line('r.undo_change#: '  r.undo_change#);&lt;br /&gt;dbms_output.put_line(' '  r.undo_sql);&lt;br /&gt;&lt;br /&gt;execute immediate&lt;br /&gt;substr(r.undo_sql, 1, length(r.undo_sql)-1);&lt;br /&gt;&lt;br /&gt;end loop;&lt;br /&gt;end ;&lt;br /&gt;/&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-2060188559055710558?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/2060188559055710558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=2060188559055710558' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2060188559055710558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/2060188559055710558'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/oracle-flashback-transaction-query.html' title='Oracle Flashback Transaction Query'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-5696152662322486614</id><published>2009-01-14T21:41:00.000-05:00</published><updated>2009-08-18T15:04:18.156-04:00</updated><title type='text'>RMAN Backup Encryption</title><content type='html'>&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Oracle backups are necessary to ensure that data is not lost in the event of hardware failures. RMAN is the Oracle recommended way to backup Oracle databases. RMAN has significantly improve Oracle database backups through multi-threaded hot backups, compression, simplified recovery and others. However backups are a way the database data could be exposed. Oracle backups by default are not encrypted and therefore unprotected should the backup be exposed to outside copies that are capable of being restored sue to lack of protection. So how to protect RMAN backups from being able to be restored by unauthorized persons and exposing the data? The answer is encrypting the RMAN backups. RMAN backup encryption requires the use of the Advanced Security Option (ASO). Advanced Security Option requires an additional license therefore before using check your Oracle license and ensure you are authorized to use the Advanced Security Option. Keep in mind that image and datafile copies can not be encrypted.&lt;br /&gt;&lt;br /&gt;Oracle offers several flavors for encrypting the RMAN backups:&lt;br /&gt;&lt;br /&gt;1. Transparent Encryption -&gt; Requires Wallet on backup and recovery. (Do Not Lose the Wallet!)&lt;br /&gt;&lt;br /&gt;2. Password Only -&gt; Required Password on backup and recovery (Do Not Lose Password!)&lt;br /&gt;&lt;br /&gt;3. Dual (Password or Transparent Encryption) -&gt; Can be backed up or restored using the password or a wallet. This works well where database is restored locally where the wallet exists, but has a need to be able to be restored off site where the wallet does not exist.&lt;br /&gt;&lt;br /&gt;When restoring encrypted backups Oracle RMAN always assumes transparent encryption using a wallet. Therefore during a restore operation and using transparent data encryption ensure the wallet is open, when using password only the password must be supplied, when using dual either the wallet must be open or the password must be supplied.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Setup and Create a Wallet for TDE&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Set the encryptrion wallet location in the sqlnet.ora file on the database server&lt;br /&gt;Unix server sqlnet.ora&lt;br /&gt;ENCRYPTION_WALLET_LOCATION=&lt;br /&gt;(SOURCE=&lt;br /&gt; (METHOD=FILE)&lt;br /&gt;  (METHOD_DATA=&lt;br /&gt;   (DIRECTORY= /cnd7bsw/oracle/network/admin/encrypt)&lt;br /&gt;      )&lt;br /&gt;)&lt;br /&gt;WALLET_LOCATION=&lt;br /&gt;(SOURCE=&lt;br /&gt; (METHOD=FILE)&lt;br /&gt;  (METHOD_DATA=&lt;br /&gt;   (DIRECTORY= /cnd7bsw/oracle/network/admin/authent)&lt;br /&gt;      )&lt;br /&gt;)&lt;br /&gt;SQLNET.WALLET_OVERRIDE = TRUE&lt;br /&gt;SSL_CLIENT_AUTHENTICATION = FALSE&lt;br /&gt;SSL_VERSION = 0&lt;br /&gt;&lt;br /&gt;2. Create the wallet &lt;br /&gt;o Ensure the oracle account running the database has permissions on the encryption wallet directory defined in the sqlnet.ora file or an ORA-28368: cannot auto-create wallet will occur.&lt;br /&gt;o sqlplus “/ AS SYSDBA”&lt;br /&gt;o SQL&gt; ALTER SYSTEM SET ENCRYPTION KEY AUTHENTICATED BY “mypass” ; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Opening and Closing the Wallet&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY password&gt;&lt;br /&gt;ALTER SYSTEM SET ENCRYPTION WALLET CLOSE&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Encrypting the RMAN Backup&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;1. Check the available algorithms for encryption.&lt;br /&gt;SELECT * FROM v$rman_encryption_algorithms ORDER BY algorithm_name ;&lt;br /&gt;&lt;br /&gt;ALGORITHM_ID ALGORITHM_NAME&lt;br /&gt;------------ ----------------------------------------------------------------&lt;br /&gt;ALGORITHM_DESCRIPTION IS_ RES&lt;br /&gt;---------------------------------------------------------------- --- ---&lt;br /&gt;1 AES128&lt;br /&gt;AES 128-bit key YES NO&lt;br /&gt;&lt;br /&gt;2 AES192&lt;br /&gt;AES 192-bit key NO NO&lt;br /&gt;&lt;br /&gt;3 AES256&lt;br /&gt;AES 256-bit key NO NO&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Set the Backup Encryption Type via RMAN&lt;br /&gt;&lt;br /&gt;Connect to the target database and RMAN catalog database if being used. Within RMAN set the encryption type via an RMAN configure command. This setting will be stored within the database control file and the RMAN catalog if one is being used.&lt;br /&gt;&lt;br /&gt;RMAN&gt; CONFIGURE ENCRYPTION ALGORITHM 'AES192';&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Configure the encryption for the backup&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Transparent Backup Encryption (Requires Wallet)&lt;br /&gt;&lt;/em&gt;CONFIGURE ENCRYPTION FOR DATABASE ON ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Turn Encryption off&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;CONFIGURE ENCRYPTION FOR DATABASE OFF ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Password Only Encryption&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SET ENCRYPTION ON IDENTIFIED BY password ONLY ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Dual Password/Transparent Encryption&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SET ENCRYPTION ON IDENTIFIED BY password ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Execute the backup Database Backup Encrypted&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Transparent Encryption** Wallet Must be opened &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;RMAN&gt; RUN {&lt;br /&gt;&lt;br /&gt;# Set the RMAN Encryption&lt;br /&gt;CONFIGURE ENCRYPTION FOR DATABASE ON ;&lt;br /&gt;&lt;br /&gt;# Backup the database&lt;br /&gt;BACKUP DATABASE ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Database Backup Encrypted using Password Encryption Only &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;RMAN&gt; RUN {&lt;br /&gt;# Set password Encryption&lt;br /&gt;SET ENCRYPTION ON IDENTIFIED BY &lt;password&gt;ONLY ;&lt;br /&gt;&lt;br /&gt;# Backup the database&lt;br /&gt;BACKUP DATABASE ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Database Backup Encrypted using Password Encryption or Wallet Encryption &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;RMAN&gt; RUN {&lt;br /&gt;# Set password Encryption&lt;br /&gt;SET ENCRYPTION ON IDENTIFIED BY &lt;password&gt;;&lt;br /&gt;&lt;br /&gt;# Backup the database&lt;br /&gt;BACKUP DATABASE ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Tablespace Backup Encryption&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;RMAN&gt; RUN {&lt;br /&gt;# First, clear the current RMAN encryption settings ...&lt;br /&gt;CONFIGURE ENCRYPTION FOR DATABASE OFF ;&lt;br /&gt;&lt;br /&gt;# ... then activate encryption for specific tablespaces&lt;br /&gt;CONFIGURE ENCRYPTION FOR TABLESPACE example ON;&lt;br /&gt;CONFIGURE ENCRYPTION FOR TABLESPACE tbs_encrypted ON;&lt;br /&gt;&lt;br /&gt;BACKUP TABLESPACE example, tbs_encrypted;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Restore Encrypted RMAN Backup&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Transparent Encryption Restore&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;RMAN&gt; RUN {&lt;br /&gt;RESTORE DATABASE ;&lt;br /&gt;RECOVER DATABASE ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Password Encryption Restore &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;RMAN&gt; RUN {&lt;br /&gt;SET DECRYPTION IDENTIFIED BY &lt;password&gt;;&lt;br /&gt;RESTORE DATABASE ;&lt;br /&gt;RECOVER DATABASE ;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-5696152662322486614?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/5696152662322486614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=5696152662322486614' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5696152662322486614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5696152662322486614'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2009/01/rman-backup-encryption.html' title='RMAN Backup Encryption'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-3980923068477147154</id><published>2008-12-14T17:55:00.000-05:00</published><updated>2009-09-07T10:53:33.250-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Heterogenenous Connectivity to MySQL'/><title type='text'>Oracle Heterogenenous Connectivity to MySQL with Database Link 10g</title><content type='html'>1. We need to install the ODBC driver for the non-Oracle database we are going to connect to.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Once the ODBC Driver is installed we will need to configure a data source for the non-Oracle database. For Windows open the control panel and locate the Administrative Tools. Then locate the Data Sources (ODBC) and double click on the Data Sources.&lt;br /&gt;Select the System DSN as for the HS service it will need to be a System DSN then Click on Add button.&lt;br /&gt;Select the Driver for the non-Oracle data source. In this case we will be using the MySQL 3.51 Driver for a local MySQL database.&lt;br /&gt;In this case we will give this data source the name of mysql configured on the localhost, we will be connecting with the root user. In this case we are on the default port therefore we done have to configure the connect options.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. After configuring the connection settings we can test if the connection is working by pressing the test button near the bottom left of the Window. A window will indicate if the connection was successful.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Configure the init.ora for the HS service that well be used for the non-Oracle database connectivity.&lt;br /&gt;&lt;br /&gt;initmysql.ora&lt;br /&gt;&lt;br /&gt;# This is a sample agent init file that contains the HS parameters that are&lt;br /&gt;# needed for an ODBC Agent.&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# HS init parameters&lt;br /&gt;#&lt;br /&gt;#HS_DB_NAME = mysql&lt;br /&gt;HS_FDS_CONNECT_INFO = mysql&lt;br /&gt;HS_FDS_TRACE_LEVEL = ON&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Environment variables required for the non-Oracle system&lt;br /&gt;#&lt;br /&gt;#set &lt;envvar&gt;=&lt;value&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Need to add the non-Oracle data source to the listener.ora&lt;br /&gt;&lt;br /&gt;SID_LIST_LISTENER =&lt;br /&gt;(SID_LIST =&lt;br /&gt;(SID_DESC =&lt;br /&gt;(SID_NAME = PLSExtProc)&lt;br /&gt;(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)&lt;br /&gt;(PROGRAM = extproc)&lt;br /&gt;)&lt;br /&gt;(SID_DESC =&lt;br /&gt;(SID_NAME = orcl)&lt;br /&gt;(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)&lt;br /&gt;)&lt;br /&gt;(SID_DESC=&lt;br /&gt;(SID_NAME=mysql)&lt;br /&gt;(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)&lt;br /&gt;(PROGRAM=hsodbc)&lt;br /&gt;(ENVS=LD_LIBRARY_PATH = C:\oracle\product\10.2.0\db_1\lib32)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Reload the listener and check that we have a service for the non-Oracle data source.&lt;br /&gt;&lt;br /&gt;C:\Oracle\product\10.2.0\db_1\BIN&gt; lsnrctl reload&lt;br /&gt;&lt;br /&gt;LSNRCTL for 32-bit Windows: Version 10.2.0.4.0 - Production on 10-AUG-2008 19:14:21&lt;br /&gt;&lt;br /&gt;Copyright (c) 1991, 2007, Oracle. All rights reserved.&lt;br /&gt;&lt;br /&gt;Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))&lt;br /&gt;The command completed successfully&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Check the listener services to make sure the mysql shows&lt;br /&gt;&lt;br /&gt;C:\Oracle\product\10.2.0\db_1\BIN&gt; lsnrctl services&lt;br /&gt;&lt;br /&gt;LSNRCTL for 32-bit Windows: Version 10.2.0.4.0 - Production on 10-AUG-2008 19:14:33&lt;br /&gt;&lt;br /&gt;Copyright (c) 1991, 2007, Oracle. All rights reserved.&lt;br /&gt;&lt;br /&gt;Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))&lt;br /&gt;Services Summary...&lt;br /&gt;Service "ORCLXDB" has 1 instance(s).&lt;br /&gt;Instance "orcl", status READY, has 1 handler(s) for this service...&lt;br /&gt;Handler(s):&lt;br /&gt;"D000" established:0 refused:0 current:0 max:1002 state:ready&lt;br /&gt;DISPATCHER &lt;machine:&gt;&lt;br /&gt;(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxxxxx)(PORT=2323))&lt;br /&gt;Service "ORCL_XPT" has 1 instance(s).&lt;br /&gt;Instance "orcl", status READY, has 1 handler(s) for this service...&lt;br /&gt;Handler(s):&lt;br /&gt;"DEDICATED" established:0 refused:0 state:ready&lt;br /&gt;LOCAL SERVER&lt;br /&gt;Service "PLSExtProc" has 1 instance(s).&lt;br /&gt;Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...&lt;br /&gt;Handler(s):&lt;br /&gt;"DEDICATED" established:0 refused:0&lt;br /&gt;LOCAL SERVER&lt;br /&gt;Service "mysql" has 1 instance(s).&lt;br /&gt;Instance "mysql", status UNKNOWN, has 1 handler(s) for this service...&lt;br /&gt;Handler(s):&lt;br /&gt;"DEDICATED" established:0 refused:0&lt;br /&gt;LOCAL SERVER&lt;br /&gt;Service "orcl" has 2 instance(s).&lt;br /&gt;Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...&lt;br /&gt;Handler(s):&lt;br /&gt;"DEDICATED" established:0 refused:0&lt;br /&gt;LOCAL SERVER&lt;br /&gt;Instance "orcl", status READY, has 1 handler(s) for this service...&lt;br /&gt;Handler(s):&lt;br /&gt;"DEDICATED" established:0 refused:0 state:ready&lt;br /&gt;LOCAL SERVER&lt;br /&gt;The command completed successfully&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Need to now add the non-Oracle data source to the tnsnames.ora&lt;br /&gt;&lt;br /&gt;mysql =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxxxx)(PORT = 1521))&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SID = MYSQL)&lt;br /&gt;)&lt;br /&gt;(HS=OK)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. Check that the non-Oracle data source is reachable via a tnsping.&lt;br /&gt;&lt;br /&gt;C:\Oracle\product\10.2.0\db_1\BIN&gt;tnsping mysql&lt;br /&gt;&lt;br /&gt;TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 14-DEC-2008 18:12:46&lt;br /&gt;Copyright (c) 1997, 2007, Oracle. All rights reserved.&lt;br /&gt;&lt;br /&gt;Used parameter files:C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora&lt;br /&gt;&lt;br /&gt;Used TNSNAMES adapter to resolve the aliasAttempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxxxx)(PORT = 1521)) (CONNECT_DATA = (SID = MYSQL)) (HS=OK))OK (30 msec)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. Create a public database link and check that it works.&lt;br /&gt;&lt;br /&gt;C:\Oracle\product\10.2.0\db_1\BIN&gt;sqlplus /@orcl&lt;br /&gt;&lt;br /&gt;SQL*Plus: Release 10.2.0.4.0 - Production on Sun Aug 10 20:10:00 2008&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2007, Oracle. All Rights Reserved.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Connected to:&lt;br /&gt;Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production&lt;br /&gt;With the Partitioning, OLAP, Data Mining and Real Application Testing options&lt;br /&gt;&lt;br /&gt;SQL&gt; create public database link mysql connect to "root" identified by "xxxxxxxxxx"&lt;br /&gt;using 'mysql' ;&lt;br /&gt;&lt;br /&gt;Database link created.&lt;br /&gt;&lt;br /&gt;SQL&gt; select count(*) from alfresco.alf_node@mysql ;&lt;br /&gt;&lt;br /&gt;COUNT(*)&lt;br /&gt;----------&lt;br /&gt;1469&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-3980923068477147154?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/3980923068477147154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=3980923068477147154' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3980923068477147154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3980923068477147154'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/12/oracle-heterogenenous-connectivity-to.html' title='Oracle Heterogenenous Connectivity to MySQL with Database Link 10g'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-4301883391973100704</id><published>2008-09-12T10:53:00.001-04:00</published><updated>2008-09-12T10:57:10.228-04:00</updated><title type='text'>RMAN Tracing</title><content type='html'>RMAN Tracing allows us the capability to get wom insight into what RMAN is doing behind the scenes so to speak.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Trace an RMAN Session&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Trace an RMAN session to a trace file using the trace=&lt;location&gt;/tracefilename.trc as part of the rman execution.  Then in the RMAN execute set the debug on.&lt;br /&gt; &lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;rman target username/password@target catalog &lt;a href="mailto:username/password@catalog"&gt;username/password@catalog&lt;/a&gt; trace=/tmp/rman_test.trc&lt;br /&gt; &lt;br /&gt;RMAN&gt; run&lt;br /&gt;               {debug on;&lt;br /&gt;                 report obsolete;&lt;br /&gt;                debug off;&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Trace via the RMAN Channel&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another way to trace RMAN activity would be to configure the trace when configuring the RMAN channel.&lt;br /&gt;&lt;br /&gt;1. Make sure timed_statistics = true for all performance testing.&lt;br /&gt;&lt;br /&gt;2. set the NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS'.   &lt;br /&gt;&lt;br /&gt;3. Configure the Channel with Trace/Debug options&lt;br /&gt;&lt;br /&gt;trace 1 - general trace info for skg and sbt   &lt;br /&gt;trace 5 - verbose channel tracing of skg and sbt calls   &lt;br /&gt;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE&lt;br /&gt;DISK DEBUG=5 TRACE 1;   &lt;br /&gt;&lt;br /&gt;or   &lt;br /&gt;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE SBT PARMS "ENV=(....) DEBUG=5 TRACE 5; &lt;br /&gt;&lt;br /&gt;Note:  (Trace is only useful for tape backup and restore tracing)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-4301883391973100704?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/4301883391973100704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=4301883391973100704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4301883391973100704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4301883391973100704'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/09/rman-tracing.html' title='RMAN Tracing'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-84694844359044644</id><published>2008-09-11T12:00:00.001-04:00</published><updated>2008-09-11T12:04:52.347-04:00</updated><title type='text'>Oracle 11g SecureFiles</title><content type='html'>&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Oracle Secure Files also known as Fast Files is Oracle’s improvement to storage of large object types (LOBs).  Secure Files gives comparable performance to a file system for LOBs and LOBs can store many types from data from images, large amounts of text, word documents, excel spreadsheets, XML, HTML, etc. as well as DICOM formatted medical images. &lt;br /&gt;&lt;br /&gt;This is a step forward in helping manage unstructured data with the Oracle database by boosting performance, but also by improving security.  Secure Files extends Transparent Data Encryption to LOBs, this not only makes storing and managing unstructured content easier, but improves the security of the unstructured content.&lt;br /&gt;&lt;br /&gt;If that was not enough Secure Files also gives advanced file system features such as compression and data de-duplication.  Data De-duplication is where duplicate objects in LOBs tied to many records within the database is only stored once rather then a copy for each record.  This not only improves storage space, but can also offer performance improvements.  Compression like it indicates compresses LOB data transparently offering storage savings and a performance boost, but Oracle takes it a step further and automatically determines if the data is able to be compressed and if so are the space savings from the compression of benefit.&lt;br /&gt;&lt;br /&gt;By default normal LOB storage is used, called BASIC file.  To use SecureFile for LOB storage the SECUREFILE lob Storage keyword must be used.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The default behavior for securefile usage can be changed via the db_securefile initialization parameter.&lt;br /&gt;&lt;br /&gt;db_securefile={ALWAYS  FORCE  PERMITTED  NEVER  IGNORE}&lt;br /&gt;&lt;br /&gt;ALWAYS – Always attempts to create all LOBs as SECUREFILE LOBs&lt;br /&gt;FORCE - all LOBs created in the system will be created as SECUREFILE LOBs.&lt;br /&gt;PERMITTED – Allows LOBs that use SecureFiles.&lt;br /&gt;NEVER – Never Allows LOBs that use SecureFiles, they will always be BASICFILE LOBs&lt;br /&gt;IGNORE – Ignore errors that otherwise would be raised by forcing LOBs as SECUREFILE LOBs&lt;br /&gt;&lt;br /&gt;Can be set dynamically via an ALTER SYSTEM:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SQL&gt; ALTER SYSTEM SET db_securefile = 'ALWAYS' ;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Securefiles offer a lot of benefits over the old LOB storage method, such as deduplication capability, compression and encryption.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Compression&lt;/em&gt;&lt;/strong&gt; has 2 forms medium which is the default and high.  Keep in mind the high level of compression the larger resource impact on the database you should expect.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;CREATE TABLE t1 ( a CLOB)    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  LOB(a) STORE AS SECUREFILE &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(COMPRESS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         CACHE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         NOLOGGING    );&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; CREATE TABLE t1 ( a CLOB)    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LOB(a) STORE AS SECUREFILE &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(         COMPRESS HIGH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         CACHE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         NOLOGGING    );&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Encryption&lt;/em&gt;&lt;/strong&gt; for SecureFiles is implemented via the Transparent Data Encryption (TDE) and SecureFiles extends that TDE for LOB data types.  Encryption is performed at the block level and uses the following valid encryption levels 2DES168, AES128, AES192 (default) and AES256.  Keep in mind for SecureFiles the NO SALT option is not supported.&lt;br /&gt;&lt;br /&gt;CREATE TABLE t1 ( a CLOB ENCRYPT USING 'AES128')  &lt;br /&gt; LOB(a) STORE AS SECUREFILE&lt;br /&gt;(         CACHE    );&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;DeDuplication&lt;/em&gt;&lt;/strong&gt; can be a powerful feature that can reduce the amount of storage space for LOBs as all duplicated LOBs are only stored once.  With the desire to reduce database disk space the compress and DeDuplication can provide significant cost savings for storage.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;CREATE TABLE t1 ( REGION VARCHAR2(20), ID NUMBER, a BLOB)     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LOB(a) STORE AS SECUREFILE &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(           DEDUPLICATE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;           CACHE)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;CREATE TABLE t1 ( a CLOB)    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LOB(a) STORE AS SECUREFILE &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(        COMPRESS HIGH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         DEDUPLICATE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        CACHE    ) ;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;Oracle Secure Files utilizes &lt;strong&gt;&lt;em&gt;Shared IO Pool&lt;/em&gt;&lt;/strong&gt;.  The shared IO pool is used from the SGA and allocations are always for a specific session and therefore the data is specific to the session.  We can look at the Shared IO Pool via the v$sga_dynamic_componets and v$sgainfo V$ views.  If we examine the memory structures of the SGA we can see what the Shared IO Pool max size is in relationship to the other memory structures of the database.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; select name, bytes from v$sgainfo ;&lt;br /&gt;&lt;br /&gt;NAME                                  BYTES&lt;br /&gt;-------------------------------- ----------&lt;br /&gt;Fixed SGA Size                      1334380&lt;br /&gt;Redo Buffers                        5844992&lt;br /&gt;Buffer Cache Size                 268435456&lt;br /&gt;Shared Pool Size                  239075328&lt;br /&gt;Large Pool Size                     4194304&lt;br /&gt;Java Pool Size                     12582912&lt;br /&gt;Streams Pool Size                   4194304&lt;br /&gt;Shared IO Pool Size                       0&lt;br /&gt;Granule Size                        4194304&lt;br /&gt;Maximum SGA Size                  535662592&lt;br /&gt;Startup overhead in Shared Pool    46137344&lt;br /&gt;Free SGA Memory Available                 0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; select * from v$sga_dynamic_components where component='Shared IO Pool' ;&lt;br /&gt;&lt;br /&gt;COMPONENT                                                        CURRENT_SIZE&lt;br /&gt;---------------------------------------------------------------- ------------&lt;br /&gt;  MIN_SIZE   MAX_SIZE USER_SPECIFIED_SIZE OPER_COUNT LAST_OPER_TYP LAST_OPER&lt;br /&gt;---------- ---------- ------------------- ---------- ------------- ---------&lt;br /&gt;LAST_OPER GRANULE_SIZE&lt;br /&gt;--------- ------------&lt;br /&gt;Shared IO Pool                                                              0&lt;br /&gt;         0          0                   0          0 STATIC&lt;br /&gt;               4194304&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When a session is unable to find free memory in the Shared IO Pool, PGA memory would be used.  To see PGA memory allocations you can use the V$SECUREFILE_TIMER view which gets an entry each time memory is allocated out of the PGA.  &lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; select * from v$securefile_timer where name like '%PGA%';&lt;br /&gt;&lt;br /&gt;NAME                      LAYER_ID   OWNTIME MAXTIME MINTIME INVOCATIONS LAYER_NAME&lt;br /&gt;------------------------- ---------- ------- ------- ------- ----------- --------------------------------------------------&lt;br /&gt;kdlw kcbi PGA alloc timer  2          0      0       0       0&lt;br /&gt;Write gather cache&lt;br /&gt;kdlw kcbi PGA free timer   2          0      0       0       0&lt;br /&gt;Write gather cache&lt;br /&gt;kdlw kcb PGA borrow timer  2          0      0       0       0&lt;br /&gt;Write gather cache&lt;br /&gt;kdlw kcb PGA free timer    2          0      0       0       0&lt;br /&gt;Write gather cache&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-84694844359044644?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/84694844359044644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=84694844359044644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/84694844359044644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/84694844359044644'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/09/oracle-11g-securefiles.html' title='Oracle 11g SecureFiles'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-699333613601095716</id><published>2008-09-11T11:42:00.001-04:00</published><updated>2008-09-11T11:59:04.576-04:00</updated><title type='text'>Oracle 11g Results Cache</title><content type='html'>&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Oracle 11g has many new features one of particular interest in the idea of a results cache.  Results cache allows a query’s result to be cached allowing for large performance improvements for queries that are executed multiple times.  The results cache works best for tables with mostly static data and has particular queries that return the same results over and over.&lt;br /&gt;&lt;br /&gt;One particular point of interest for the result cache is that fact that the result cache does not work when logged in as sysdba.&lt;br /&gt;&lt;br /&gt;We can see in the explain plan of a query when the RESULT CACHE is being used as shown below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-size:78%;"&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt; Id   Operation                  Name                        Rows   Bytes TempSpc Cost (%CPU) Time    &lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;   0  SELECT STATEMENT                                       85120   1745K          660   (1) 00:00:08&lt;br /&gt;   1   RESULT CACHE              5g4sqrbmnk7tw4ct7s8ak9vdgd                                           &lt;br /&gt;   2    SORT ORDER BY                                        85120   1745K  6696K   660   (1) 00:00:08&lt;br /&gt;   3     PARTITION REFERENCE ALL                             85120   1745K          107   (1) 00:00:02&lt;br /&gt;   4      TABLE ACCESS FULL      ORDER_ITEMS                 85120   1745K          107   (1) 00:00:02&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;&lt;strong&gt;Test Results&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; set linesize 150&lt;br /&gt;SQL&gt; set timing on&lt;br /&gt;SQL&gt; set echo on&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; drop table results_cache_test ;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.10&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run create a table for our testing&lt;br /&gt;SQL&gt; -- so not to skew results&lt;br /&gt;SQL&gt; create table results_cache_test&lt;br /&gt;  2  as&lt;br /&gt;  3  select *&lt;br /&gt;  4  from dba_tables ;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.56&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; create unique index results_cache_test_pk&lt;br /&gt;  2  on results_cache_test (owner, table_name) ;&lt;br /&gt;&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.04&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; execute dbms_stats.gather_table_stats ('MRMESSIN', 'RESULTS_CACHE_TEST') ;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.95&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- set autotrace on for first round with index&lt;br /&gt;SQL&gt; set autotrace on ;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run to see the results&lt;br /&gt;SQL&gt; select table_name, cache, read_only&lt;br /&gt;  2  from results_cache_test&lt;br /&gt;  3  where owner = 'MRMESSIN' ;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;DEPT                               N NO                                                                                                              &lt;br /&gt;EMP                                N NO                                                                                                              &lt;br /&gt;DEMO_USERS                         N NO                                                                                                              &lt;br /&gt;DEMO_CUSTOMERS                     N NO                                                                                                              &lt;br /&gt;DEMO_ORDERS                        N NO                                                                                                              &lt;br /&gt;DEMO_ORDER_ITEMS                   N NO                                                                                                              &lt;br /&gt;DEMO_PRODUCT_INFO                  N NO                                                                                                              &lt;br /&gt;DEMO_STATES                        N NO                                                                                                              &lt;br /&gt;DEMO_PAGE_HIERARCHY                N NO                                                                                                              &lt;br /&gt;EAGLE                              N NO                                                                                                              &lt;br /&gt;HELP_TABLE                         N NO                                                                                                              &lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;BIG_EMP                            N NO                                                                                                              &lt;br /&gt;DEMO_IMAGES                        N NO                                                                                                              &lt;br /&gt;BIG_EMP2                           N YES                                                                                                             &lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.01&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;Plan hash value: 2738702378                                                                                                                          &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;----------------------------------------------------------------------------------------                                                             &lt;br /&gt; Id   Operation          Name                Rows   Bytes  Cost (%CPU) Time                                                                  &lt;br /&gt;----------------------------------------------------------------------------------------                                                             &lt;br /&gt;   0  SELECT STATEMENT                          95   3515     25   (0) 00:00:01                                                              &lt;br /&gt;*  1   TABLE ACCESS FULL RESULTS_CACHE_TEST     95   3515     25   (0) 00:00:01                                                              &lt;br /&gt;----------------------------------------------------------------------------------------                                                             &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Predicate Information (identified by operation id):                                                                                                  &lt;br /&gt;---------------------------------------------------                                                                                                  &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;   1 - filter("OWNER"='MRMESSIN')                                                                                                                    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;          1  recursive calls                                                                                                                         &lt;br /&gt;          0  db block gets                                                                                                                           &lt;br /&gt;         85  consistent gets                                                                                                                         &lt;br /&gt;          0  physical reads                                                                                                                          &lt;br /&gt;          0  redo size                                                                                                                               &lt;br /&gt;        800  bytes sent via SQL*Net to client                                                                                                        &lt;br /&gt;        416  bytes received via SQL*Net from client                                                                                                  &lt;br /&gt;          2  SQL*Net roundtrips to/from client                                                                                                       &lt;br /&gt;          0  sorts (memory)                                                                                                                          &lt;br /&gt;          0  sorts (disk)                                                                                                                            &lt;br /&gt;         14  rows processed                                                                                                                          &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run a second time to cache the results&lt;br /&gt;SQL&gt; select /*+ result_cache */ table_name, cache, read_only&lt;br /&gt;  2  from results_cache_test&lt;br /&gt;  3  where owner = 'MRMESSIN' ;&lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;DEPT                               N NO                                                                                                              &lt;br /&gt;EMP                                N NO                                                                                                              &lt;br /&gt;DEMO_USERS                         N NO                                                                                                              &lt;br /&gt;DEMO_CUSTOMERS                     N NO                                                                                                              &lt;br /&gt;DEMO_ORDERS                        N NO                                                                                                              &lt;br /&gt;DEMO_ORDER_ITEMS                   N NO                                                                                                              &lt;br /&gt;DEMO_PRODUCT_INFO                  N NO                                                                                                              &lt;br /&gt;DEMO_STATES                        N NO                                                                                                              &lt;br /&gt;DEMO_PAGE_HIERARCHY                N NO                                                                                                              &lt;br /&gt;EAGLE                              N NO                                                                                                              &lt;br /&gt;HELP_TABLE                         N NO                                                                                                              &lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;BIG_EMP                            N NO                                                                                                              &lt;br /&gt;DEMO_IMAGES                        N NO                                                                                                              &lt;br /&gt;BIG_EMP2                           N YES                                                                                                             &lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.04&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;Plan hash value: 2738702378                                                                                                                          &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt; Id   Operation           Name                        Rows   Bytes  Cost (%CPU) Time                                                         &lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt;   0  SELECT STATEMENT                                   95   3515     25   (0) 00:00:01                                                     &lt;br /&gt;   1   RESULT CACHE       6qrad2hzvx6xm6rwrx23ncuwwg                                                                                         &lt;br /&gt;*  2    TABLE ACCESS FULL RESULTS_CACHE_TEST             95   3515     25   (0) 00:00:01                                                     &lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Predicate Information (identified by operation id):                                                                                                  &lt;br /&gt;---------------------------------------------------                                                                                                  &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;   2 - filter("OWNER"='MRMESSIN')                                                                                                                    &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Result Cache Information (identified by operation id):                                                                                               &lt;br /&gt;------------------------------------------------------                                                                                               &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;   1 - column-count=3; dependencies=(MRMESSIN.RESULTS_CACHE_TEST); parameters=(nls); name="select /*+ result_cache */ table_name, cache, read_only   &lt;br /&gt;from results_cache_test                                                                                                                              &lt;br /&gt;where owner = 'MRMESSIN' "                                                                                                                           &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;          1  recursive calls                                                                                                                         &lt;br /&gt;          0  db block gets                                                                                                                           &lt;br /&gt;         85  consistent gets                                                                                                                         &lt;br /&gt;          0  physical reads                                                                                                                          &lt;br /&gt;          0  redo size                                                                                                                               &lt;br /&gt;        800  bytes sent via SQL*Net to client                                                                                                        &lt;br /&gt;        416  bytes received via SQL*Net from client                                                                                                  &lt;br /&gt;          2  SQL*Net roundtrips to/from client                                                                                                       &lt;br /&gt;          0  sorts (memory)                                                                                                                          &lt;br /&gt;          0  sorts (disk)                                                                                                                            &lt;br /&gt;         14  rows processed                                                                                                                          &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run the third time to see query with results cache in place&lt;br /&gt;SQL&gt; select /*+ result_cache */ table_name, cache, read_only&lt;br /&gt;  2  from results_cache_test&lt;br /&gt;  3  where owner = 'MRMESSIN' ;&lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;DEPT                               N NO                                                                                                              &lt;br /&gt;EMP                                N NO                                                                                                              &lt;br /&gt;DEMO_USERS                         N NO                                                                                                              &lt;br /&gt;DEMO_CUSTOMERS                     N NO                                                                                                              &lt;br /&gt;DEMO_ORDERS                        N NO                                                                                                              &lt;br /&gt;DEMO_ORDER_ITEMS                   N NO                                                                                                              &lt;br /&gt;DEMO_PRODUCT_INFO                  N NO                                                                                                              &lt;br /&gt;DEMO_STATES                        N NO                                                                                                              &lt;br /&gt;DEMO_PAGE_HIERARCHY                N NO                                                                                                              &lt;br /&gt;EAGLE                              N NO                                                                                                              &lt;br /&gt;HELP_TABLE                         N NO                                                                                                              &lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;BIG_EMP                            N NO                                                                                                              &lt;br /&gt;DEMO_IMAGES                        N NO                                                                                                              &lt;br /&gt;BIG_EMP2                           N YES                                                                                                             &lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.04&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;Plan hash value: 2738702378                                                                                                                          &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt; Id   Operation           Name                        Rows   Bytes  Cost (%CPU) Time                                                         &lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt;   0  SELECT STATEMENT                                   95   3515     25   (0) 00:00:01                                                     &lt;br /&gt;   1   RESULT CACHE       6qrad2hzvx6xm6rwrx23ncuwwg                                                                                         &lt;br /&gt;*  2    TABLE ACCESS FULL RESULTS_CACHE_TEST             95   3515     25   (0) 00:00:01                                                     &lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Predicate Information (identified by operation id):                                                                                                  &lt;br /&gt;---------------------------------------------------                                                                                                  &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;   2 - filter("OWNER"='MRMESSIN')                                                                                                                    &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Result Cache Information (identified by operation id):                                                                                               &lt;br /&gt;------------------------------------------------------                                                                                               &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;   1 - column-count=3; dependencies=(MRMESSIN.RESULTS_CACHE_TEST); parameters=(nls); name="select /*+ result_cache */ table_name, cache, read_only   &lt;br /&gt;from results_cache_test                                                                                                                              &lt;br /&gt;where owner = 'MRMESSIN' "                                                                                                                           &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;          0  recursive calls                                                                                                                         &lt;br /&gt;          0  db block gets                                                                                                                           &lt;br /&gt;          0  consistent gets                                                                                                                         &lt;br /&gt;          0  physical reads                                                                                                                          &lt;br /&gt;          0  redo size                                                                                                                               &lt;br /&gt;        800  bytes sent via SQL*Net to client                                                                                                        &lt;br /&gt;        416  bytes received via SQL*Net from client                                                                                                  &lt;br /&gt;          2  SQL*Net roundtrips to/from client                                                                                                       &lt;br /&gt;          0  sorts (memory)                                                                                                                          &lt;br /&gt;          0  sorts (disk)                                                                                                                            &lt;br /&gt;         14  rows processed                                                                                                                          &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; set autotrace off&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- drop the index to start second round without index&lt;br /&gt;SQL&gt; drop index results_cache_test_pk ;&lt;br /&gt;&lt;br /&gt;Index dropped.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.01&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; set autotrace on ;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run to see the results&lt;br /&gt;SQL&gt; select table_name, cache, read_only&lt;br /&gt;  2  from results_cache_test&lt;br /&gt;  3  where owner = 'MRMESSIN' ;&lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;DEPT                               N NO                                                                                                              &lt;br /&gt;EMP                                N NO                                                                                                              &lt;br /&gt;DEMO_USERS                         N NO                                                                                                              &lt;br /&gt;DEMO_CUSTOMERS                     N NO                                                                                                              &lt;br /&gt;DEMO_ORDERS                        N NO                                                                                                              &lt;br /&gt;DEMO_ORDER_ITEMS                   N NO                                                                                                              &lt;br /&gt;DEMO_PRODUCT_INFO                  N NO                                                                                                              &lt;br /&gt;DEMO_STATES                        N NO                                                                                                              &lt;br /&gt;DEMO_PAGE_HIERARCHY                N NO                                                                                                              &lt;br /&gt;EAGLE                              N NO                                                                                                              &lt;br /&gt;HELP_TABLE                         N NO                                                                                                              &lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;BIG_EMP                            N NO                                                                                                              &lt;br /&gt;DEMO_IMAGES                        N NO                                                                                                              &lt;br /&gt;BIG_EMP2                           N YES                                                                                                             &lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.03&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;Plan hash value: 2738702378                                                                                                                          &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;----------------------------------------------------------------------------------------                                                             &lt;br /&gt; Id   Operation          Name                Rows   Bytes  Cost (%CPU) Time                                                                  &lt;br /&gt;----------------------------------------------------------------------------------------                                                             &lt;br /&gt;   0  SELECT STATEMENT                          95   3515     25   (0) 00:00:01                                                              &lt;br /&gt;*  1   TABLE ACCESS FULL RESULTS_CACHE_TEST     95   3515     25   (0) 00:00:01                                                              &lt;br /&gt;----------------------------------------------------------------------------------------                                                             &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Predicate Information (identified by operation id):                                                                                                  &lt;br /&gt;---------------------------------------------------                                                                                                  &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;   1 - filter("OWNER"='MRMESSIN')                                                                                                                    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------                                                                                           &lt;br /&gt;        234  recursive calls                                                                                                                         &lt;br /&gt;          0  db block gets                                                                                                                           &lt;br /&gt;        116  consistent gets                                                                                                                         &lt;br /&gt;          0  physical reads                                                                                                                          &lt;br /&gt;          0  redo size                                                                                                                               &lt;br /&gt;        800  bytes sent via SQL*Net to client                                                                                                        &lt;br /&gt;        416  bytes received via SQL*Net from client                                                                                                  &lt;br /&gt;          2  SQL*Net roundtrips to/from client                                                                                                       &lt;br /&gt;          5  sorts (memory)                                                                                                                          &lt;br /&gt;          0  sorts (disk)                                                                                                                            &lt;br /&gt;         14  rows processed                                                                                                                          &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run a second time to cache the results&lt;br /&gt;SQL&gt; select /*+ result_cache */ table_name, cache, read_only&lt;br /&gt;  2  from results_cache_test&lt;br /&gt;  3  where owner = 'MRMESSIN' ;&lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA                                                                                                             &lt;br /&gt;------------------------------ ----- ---                                                                                                             &lt;br /&gt;DEPT                               N NO                                                                                                              &lt;br /&gt;EMP                                N NO                                                                                                              &lt;br /&gt;DEMO_USERS                         N NO                                                                                                              &lt;br /&gt;DEMO_CUSTOMERS                     N NO                                                                                                              &lt;br /&gt;DEMO_ORDERS                        N NO                                                                                                              &lt;br /&gt;DEMO_ORDER_ITEMS                   N NO                                                                                                              &lt;br /&gt;DEMO_PRODUCT_INFO                  N NO                                                                                                              &lt;br /&gt;DEMO_STATES                        N NO                                                                                                              &lt;br /&gt;DEMO_PAGE_HIERARCHY                N NO                                                                                                              &lt;br /&gt;EAGLE                              N NO                                                                                                              &lt;br /&gt;HELP_TABLE                         N NO                                                                                                              &lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;------------------------------ ----- ---&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;BIG_EMP                            N NO &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;DEMO_IMAGES                        N NO         &lt;br /&gt;BIG_EMP2                           N YES                                  &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.04&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-size:78%;"&gt;Plan hash value: 2738702378                                  &lt;br /&gt;                                                                             &lt;br /&gt;-------------------------------------------------------------------------------------------------        &lt;br /&gt; Id   Operation           Name                        Rows   Bytes  Cost (%CPU) Time       &lt;br /&gt;-------------------------------------------------------------------------------------------------  &lt;br /&gt;   0  SELECT STATEMENT                                   95   3515     25   (0) 00:00:01    &lt;br /&gt;   1   RESULT CACHE       6qrad2hzvx6xm6rwrx23ncuwwg                                       &lt;br /&gt;*  2    TABLE ACCESS FULL RESULTS_CACHE_TEST             95   3515     25   (0) 00:00:01 &lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Predicate Information (identified by operation id):                             &lt;br /&gt;---------------------------------------------------     &lt;br /&gt;   2 - filter("OWNER"='MRMESSIN')                                      &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Result Cache Information (identified by operation id):            &lt;br /&gt;------------------------------------------------------                                                                                                                                                                                           &lt;br /&gt;   1 - column-count=3; dependencies=(MRMESSIN.RESULTS_CACHE_TEST); parameters=(nls); name="select /*+ result_cache */ table_name, cache, read_only&lt;br /&gt;from results_cache_test &lt;br /&gt;where owner = 'MRMESSIN' "             &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------             &lt;br /&gt;          1  recursive calls&lt;br /&gt;          0  db block gets         &lt;br /&gt;         85  consistent gets                 &lt;br /&gt;          0  physical reads   &lt;br /&gt;          0  redo size               &lt;br /&gt;        800  bytes sent via SQL*Net to client &lt;br /&gt;        416  bytes received via SQL*Net from client&lt;br /&gt;          2  SQL*Net roundtrips to/from client&lt;br /&gt;          0  sorts (memory)                          &lt;br /&gt;          0  sorts (disk)                   &lt;br /&gt;         14  rows processed                     &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- run the third time to see query with results cache in place&lt;br /&gt;SQL&gt; select /*+ result_cache */ table_name, cache, read_only&lt;br /&gt;  2  from results_cache_test&lt;br /&gt;  3  where owner = 'MRMESSIN' ;&lt;br /&gt;&lt;br /&gt;TABLE_NAME                     CACHE REA &lt;br /&gt;------------------------------ ----- ---                                           &lt;br /&gt;DEPT                               N NO                           &lt;br /&gt;EMP                                N NO&lt;br /&gt;DEMO_USERS                         N NO&lt;br /&gt;DEMO_CUSTOMERS                     N NO    &lt;br /&gt;DEMO_ORDERS                        N NO&lt;br /&gt;DEMO_ORDER_ITEMS                   N NO         &lt;br /&gt;DEMO_PRODUCT_INFO                  N NO &lt;br /&gt;DEMO_STATES                        N NO&lt;br /&gt;DEMO_PAGE_HIERARCHY                N NO&lt;br /&gt;EAGLE                              N NO&lt;br /&gt;HELP_TABLE                         N NO&lt;br /&gt;BIG_EMP                            N NO&lt;br /&gt;DEMO_IMAGES                        N NO&lt;br /&gt;BIG_EMP2                           N YES &lt;br /&gt;&lt;br /&gt;14 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.04&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Execution Plan&lt;br /&gt;--------------------------------------------------------                                                                             &lt;br /&gt;Plan hash value: 2738702378                                                                                                                          &lt;br /&gt;                                   &lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt; Id   Operation           Name                        Rows   Bytes  Cost (%CPU) Time     &lt;br /&gt;-------------------------------------------------------------------------------------------------  &lt;br /&gt;   0  SELECT STATEMENT                                   95   3515     25   (0) 00:00:01&lt;br /&gt;   1   RESULT CACHE       6qrad2hzvx6xm6rwrx23ncuwwg                                    &lt;br /&gt;*  2    TABLE ACCESS FULL RESULTS_CACHE_TEST             95   3515     25   (0) 00:00:01&lt;br /&gt;-------------------------------------------------------------------------------------------------                                                    &lt;br /&gt;&lt;/span&gt;  Predicate Information (identified by operation id):&lt;br /&gt;-----------------------------------------------------                                                                                                   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;2 - filter("OWNER"='MRMESSIN')                                                                                                                    &lt;br /&gt;                                                                                                                                                     &lt;br /&gt;Result Cache Information (identified by operation id):&lt;br /&gt;------------------------------------------------------&lt;br /&gt;&lt;br /&gt;   1 - column-count=3; dependencies=(MRMESSIN.RESULTS_CACHE_TEST); parameters=(nls); name="select /*+ result_cache */ table_name, cache, read_only   &lt;br /&gt;from results_cache_test&lt;br /&gt;where owner = 'MRMESSIN'"                                      &lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;---------------------------------------------------------- &lt;br /&gt;          0  recursive calls            &lt;br /&gt;          0  db block gets   &lt;br /&gt;          0  consistent gets                                   &lt;br /&gt;          0  physical reads&lt;br /&gt;          0  redo size     &lt;br /&gt;        800  bytes sent via SQL*Net to client&lt;br /&gt;        416  bytes received via SQL*Net from client &lt;br /&gt;          2  SQL*Net roundtrips to/from client                      &lt;br /&gt;          0  sorts (memory)      &lt;br /&gt;          0  sorts (disk)                                &lt;br /&gt;         14  rows processed     &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; spool off&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-699333613601095716?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/699333613601095716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=699333613601095716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/699333613601095716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/699333613601095716'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/09/oracle-11g-results-cache.html' title='Oracle 11g Results Cache'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-5062032372929947143</id><published>2008-09-11T11:38:00.000-04:00</published><updated>2008-09-11T11:40:32.890-04:00</updated><title type='text'>Oracle 11g Invisible Indexes</title><content type='html'>&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Oracle has now provided in what is my opinion a huge step forward in query tuning.  It will now allow us to hide indexes from the optimizer without have to drop them.  If you have every tuned queries of very large tables and had to drop and recreate indexes in your query tuning testing then you will realize right away how useful this is.&lt;br /&gt;&lt;br /&gt;Another huge advantage and use of this feature is for batch process tuning.  Ever had a situation where you needed an index that would really help your batch process but hurt OLTP transaction query performance.  Well now we can hide the index from OLTP, but allow our batch processes to see it.&lt;br /&gt;&lt;br /&gt;To use an invisible index you can set the parameter optimizer_use_invisible_indexes to true.  The default of this parameter is false and can be set via an alter session or alter system command.  Otherwise invisible indexes are completely ignore by the optimizer including through hints.&lt;br /&gt;&lt;br /&gt;A special thing to note about invisible indexes is that they can not get optimizer statistics gathered on them while in an invisible state.  Therefore to maintain statistics that index will have to be made visible by altering the index or setting the optimizer_use_invisible_indexes to true.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Create a table for use in our example:&lt;br /&gt;&lt;br /&gt;SQL&gt; create table my_table as select * from scott.emp ;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Create an index on our table and make it invisible.&lt;br /&gt;&lt;br /&gt;SQL&gt; create index my_index on my_table (ename) invisible ;&lt;br /&gt;&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Check that the index is invisible using the new VISIBILITY column of the user_indexes, all_indexes or dba_indexes views.&lt;br /&gt;&lt;br /&gt;SQL&gt; select index_name, visibility from user_indexes where index_name = 'MY_INDEX';&lt;br /&gt;&lt;br /&gt;INDEX_NAME                     VISIBILIT&lt;br /&gt;------------------------------ ---------&lt;br /&gt;MY_INDEX                       INVISIBLE&lt;br /&gt;&lt;br /&gt;1 row selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Attempt to gather statistics on our new and cascading to indexes.  Not since the index is invisible this fails.&lt;br /&gt;&lt;br /&gt;SQL&gt; execute dbms_stats.gather_table_stats ('MRMESSIN', 'MY_TABLE') ;&lt;br /&gt;BEGIN dbms_stats.gather_table_stats ('MRMESSIN', 'MY_TABLE') ; END;&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-00904: : invalid identifier&lt;br /&gt;ORA-06512: at "SYS.DBMS_STATS", line 17806&lt;br /&gt;ORA-06512: at "SYS.DBMS_STATS", line 17827&lt;br /&gt;ORA-06512: at line 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Make the invisible indexes visible.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter session set optimizer_use_invisible_indexes = true ;&lt;br /&gt;&lt;br /&gt;Session altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Now gather our statistics&lt;br /&gt;&lt;br /&gt;SQL&gt; execute dbms_stats.gather_table_stats ('MRMESSIN', 'MY_TABLE') ;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Set the optimizer_use_invisible_indexes back to false for the start of our testing.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter session set optimizer_use_invisible_indexes = true ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Set autotrace so we can see our explain plan and data.&lt;br /&gt;&lt;br /&gt;SQL&gt; set autotrace traceonly&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Select from the table using the indexed column in our where clause which under normal circumstances that optimizer would choose to use the index.  Note however we are not using the index because it is invisible.&lt;br /&gt;&lt;br /&gt;SQL&gt; select empno, ename from my_table where ename = 'BLAKE';&lt;br /&gt;&lt;br /&gt;1 row selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3804444429&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt; Id   Operation          Name      Rows  Bytes  Cost (%CPU) Time   &lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;   0  SELECT STATEMENT                1     10      3   (0) 00:00:01&lt;br /&gt;*  1   TABLE ACCESS FULL MY_TABLE     1     10      3   (0) 00:00:01&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;   1 - filter("ENAME"='BLAKE')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;          1  recursive calls&lt;br /&gt;          0  db block gets&lt;br /&gt;          4  consistent gets&lt;br /&gt;          0  physical reads&lt;br /&gt;          0  redo size&lt;br /&gt;        477  bytes sent via SQL*Net to client&lt;br /&gt;        416  bytes received via SQL*Net from client&lt;br /&gt;          2  SQL*Net roundtrips to/from client&lt;br /&gt;          0  sorts (memory)&lt;br /&gt;          0  sorts (disk)&lt;br /&gt;          1  rows processed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. Now lets query seeing if we can use the index Hint to use the index.  Not the index is not used.&lt;br /&gt;&lt;br /&gt;SQL&gt; select /*+ INDEX(my_table my_index) */ empno, ename from my_table where ename = 'BLAKE’ ;&lt;br /&gt;&lt;br /&gt;1 row selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3804444429&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt; Id   Operation          Name      Rows  Bytes  Cost (%CPU) Time   &lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;   0  SELECT STATEMENT                1     10      3   (0) 00:00:01&lt;br /&gt;*  1   TABLE ACCESS FULL MY_TABLE     1     10      3   (0) 00:00:01&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;   1 - filter("ENAME"='BLAKE')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;          1  recursive calls&lt;br /&gt;          0  db block gets&lt;br /&gt;          4  consistent gets&lt;br /&gt;          0  physical reads&lt;br /&gt;          0  redo size&lt;br /&gt;        477  bytes sent via SQL*Net to client&lt;br /&gt;        416  bytes received via SQL*Net from client&lt;br /&gt;          2  SQL*Net roundtrips to/from client&lt;br /&gt;          0  sorts (memory)&lt;br /&gt;          0  sorts (disk)&lt;br /&gt;          1  rows processed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. Now let see if the index is used if we set the parameter optimizer_use_invisible_indexes to true. &lt;br /&gt;&lt;br /&gt;SQL&gt; alter session set optimizer_use_invisible_indexes = true ;&lt;br /&gt;&lt;br /&gt;Session altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;11. Note that index is now seen and is being used.&lt;br /&gt;&lt;br /&gt;SQL&gt; select empno, ename from my_table where ename = 'BLAKE';&lt;br /&gt;&lt;br /&gt;1 row selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 332163487&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;Id  Operation                   Name    RowsBytesCost %CPU) Time    &lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt; 0  SELECT STATEMENT                       1   10    2  (0) 00:00:01&lt;br /&gt; 1   TABLE ACCESS BY INDEX ROWIDMY_TABLE   1   10    2  (0) 00:00:01&lt;br /&gt;*2    INDEX RANGE SCAN          MY_INDEX   1         1  (0) 00:00:01&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;   2 - access("ENAME"='BLAKE')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;          1  recursive calls&lt;br /&gt;          0  db block gets&lt;br /&gt;          3  consistent gets&lt;br /&gt;          0  physical reads&lt;br /&gt;          0  redo size&lt;br /&gt;        477  bytes sent via SQL*Net to client&lt;br /&gt;        416  bytes received via SQL*Net from client&lt;br /&gt;          2  SQL*Net roundtrips to/from client&lt;br /&gt;          0  sorts (memory)&lt;br /&gt;          0  sorts (disk)&lt;br /&gt;          1  rows processed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-5062032372929947143?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/5062032372929947143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=5062032372929947143' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5062032372929947143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5062032372929947143'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/09/oracle-11g-invisible-indexes.html' title='Oracle 11g Invisible Indexes'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-7844950214783296165</id><published>2008-06-10T16:03:00.000-04:00</published><updated>2008-07-27T08:06:08.059-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Stored Outlines'/><title type='text'>Oracle Stored Outlines</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Stored outlines, also known as plan stability, can be through o as a representation of a SQL statement execution plan that gives the ability to change a SQL Statements execution behavior without having to change the SQL statement in the application code. This allows the tuning of SQL statements for vendor systems where access to the code is usually restricted or inaccessible. It also provides a better way for tuning SQL allowing for better testing of upgrades. Oracle constantly improves the cost based optimizer with every release and when SQL statements are changed in the application code by adding hints undoing the tuning work can be difficult and time consuming. Stored Outlines can be removed to allow upgrades to be tested to see if Oracle makes better decisions in the newer version therefore allowing Oracle to make the decisions without the use of outlines. If the outlines are still needed then they can be put back in and/or tuned for the new Oracle version.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;strong&gt;Requirements for Stored Outlines&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Database Parameters&lt;br /&gt;&lt;/em&gt;To utilized stored outlines certain database parameters &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;must be set in the init.ora&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt; or spfile.ora&lt;br /&gt;&lt;br /&gt;query_rewrite_enabled&lt;br /&gt;star_transformation_enabled&lt;br /&gt;optimizer_features_enabled&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;em&gt;System Level Parameter Setting&lt;/em&gt;&lt;br /&gt;Also a system level parameter must be set to allow the &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;use of the stored &lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;outlines. &lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;This can not be set in the &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;init.ora or spfile.ora therefore a database &lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;startup trigger &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;is a great way to ensure this is set each time the database &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;is &lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;started.&lt;br /&gt;&lt;br /&gt;ALTER SYSTEM SET USE_STORED_OUTLINES = true&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE TRIGGER enable_outline&lt;br /&gt;AFTER STARTUP ON DATABASE&lt;br /&gt;BEGIN&lt;br /&gt;execute immediate 'alter system set use_stored_outlines = true';&lt;br /&gt;END ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implementing a Stored Outline&lt;br /&gt;&lt;/strong&gt;1. Create the stored outline for the SQL Statement the needs&lt;br /&gt;improvement as shown via v$sql.&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE OUTLINE SCHEDULING_QUERY on&lt;br /&gt;select :"SYS_B_00" ,sit_code ,sit_division ,sh_serial ,sh_schstat ,sh_estlen,&lt;br /&gt;TO_CHAR(sh_date,:"SYS_B_01")...&lt;br /&gt;/&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;em&gt;Or utilize a SQL statement already in the shared pool.  Keep in mind this will generate the name for you.  Therefore will need to find out what name the system gave it to manipulate later&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;-- Identify the SQL statement in the V$SQL view.&lt;br /&gt;SELECT hash_value, child_number, sql_text&lt;br /&gt;FROM v$sql&lt;br /&gt;WHERE sql_text LIKE 'select :"SYS_B_00" ,sit_code ,sit_division%';&lt;br /&gt;&lt;br /&gt;HASH_VALUE CHILD_NUMBER&lt;br /&gt;---------- ------------&lt;br /&gt;SQL_TEXT&lt;br /&gt;----------------------------------------------------------------------------------------------------&lt;br /&gt;1119283366            0&lt;br /&gt;select :"SYS_B_00" ,sit_code ,sit_division ,sh_serial ,sh_schstat ,sh_estlen,  TO_CHAR(sh_date,:"SYS_B_01")...&lt;br /&gt;&lt;br /&gt;1 row selected.&lt;br /&gt;&lt;br /&gt;-- Create an outline for the statement.&lt;br /&gt;BEGIN&lt;br /&gt;  DBMS_OUTLN.create_outline(&lt;br /&gt;    hash_value    =&gt; 1119283366,&lt;br /&gt;    child_number  =&gt; 0,&lt;br /&gt;    category      =&gt; 'MY_OUTLINES');&lt;br /&gt;END;&lt;br /&gt;/&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;2. Develop a tuned SQL Statement&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Create the stored outline for the tuned SQL statement&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE OUTLINE SCHEDULING_QUERY_HINTED on&lt;br /&gt;select /*+ leading(INTSTAMP) */&lt;br /&gt;:"SYS_B_00" ,sit_code ,sit_division ,sh_serial ,sh_schstat ,sh_estlen ,&lt;br /&gt;TO_CHAR(sh_date,:"SYS_B_01") ...;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Update OUTLN.OL$HINTS and put the plan for the tuned SQL&lt;br /&gt;Statement into the untuned stored outline.&lt;br /&gt;&lt;br /&gt;UPDATE OUTLN.OL$HINTS&lt;br /&gt;SET OL_NAME = DECODE(OL_NAME, 'SCHEDULING_QUERY_HINTED', 'SCHEDULING_QUERY',&lt;br /&gt;'SCHEDULING_QUERY', 'SCHEDULING_QUERY_HINTED'&lt;br /&gt;WHERE OL_NAME IN ('SCHEDULING_QUERY','SCHEDULING_QUERY_HINTED');&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Execute an explain plan for the original query to recognized&lt;br /&gt;the stored outline. This will update the Outline to used if&lt;br /&gt;Oracle sees the outline and is using it.&lt;br /&gt;&lt;br /&gt;EXPLAIN PLAN FOR&lt;br /&gt;select :"SYS_B_00" ,sit_code ,sit_division ,sh_serial&lt;br /&gt;,sh_schstat ,sh_estlen ,TO_CHAR(sh_date,:"SYS_B_01")...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Check to see that the stored outline is now used.&lt;br /&gt;&lt;br /&gt;select name, category, used from dba_outlines;&lt;br /&gt;&lt;br /&gt;NAME CATEGORY USED&lt;br /&gt;---------------- -------- ---------&lt;br /&gt;SCHEDULING_QUERY DEFAULT USED&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-7844950214783296165?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/7844950214783296165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=7844950214783296165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7844950214783296165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7844950214783296165'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/06/oracle-stored-outlines.html' title='Oracle Stored Outlines'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-4399842132221252640</id><published>2008-05-20T17:35:00.000-04:00</published><updated>2008-05-20T17:40:18.064-04:00</updated><title type='text'>Oracle Flashback Drop</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;Summary &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Oracle 10g introduced a flashback drop feature that will allow you to bring back a dropped table without having to execute any type of recovery operation.  This is due to the recyclebin which is what makes the flashback drop feature work. This feature is very useful for those times when a developer comes in who just dropped a table by mistake.  Before flashback drop you either had to have an export of the table or recover the database using an auxiliary instance to get the table back and then move the table from the auxiliary instance back into database where the table was dropped.  You can however drop a table and bypass the recycle bin as well by using the PURGE option to the drop table.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Some important things to note about the flashback drop feature&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Think of each schema getting its own Recycle Bin&lt;br /&gt;2. The recycle bin is a logical collection of previously DROPPED objects&lt;br /&gt;3. In Oracle 10g the default action of a DROP TABLE command is to RENAME the table essentially placing the table in the RECYCLE BIN.&lt;br /&gt;4. Objects in the RECYCLE BIN are NOT automatically purged and must be explicitly purged explicitly by a User or DBA action.&lt;br /&gt;5. When a table is dropped the segments that table consumed in the tablespace are still present.  Therefore when a table is dropped space is not freed as the table segments are still there.&lt;br /&gt;6. If an object is dropped and recreated multiple times all dropped versions will be kept in the recycle bin, subject to space.&lt;br /&gt;7. Where multiple versions are present, it's best to reference the tables via the table name shown in the RECYCLEBIN -&gt; RECYCLEBIN_NAME.&lt;br /&gt;8. For any references to the ORIGINAL_NAME, it is assumed the most recent object is drop version in the referenced question.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Showing the contents of the RECYCLEBIN&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Show the current schemas recyclebin&lt;/em&gt;&lt;br /&gt;show recyclebin&lt;br /&gt;select * from recyclebin ;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;em&gt;Show the DBA Recyclebin which will show all schema recyclebins&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;select * from dba_recyclebin ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Purging the RECYCLEBIN&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Purge current schema RECYCLEBIN&lt;br /&gt;&lt;/em&gt;PURGE RECYCLEBIN ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Purge All RECYCLEBINs&lt;br /&gt;&lt;/em&gt;PURGE DBA_RECYCLEBIN ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Purge Objects from RECYCLEBIN&lt;br /&gt;&lt;/em&gt;PURGE TABLE tablename ;&lt;br /&gt;PURGE INDEX indexname ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Purge Objects from RECYCLEBIN for a tablespace&lt;/em&gt;&lt;br /&gt;PURGE TABLESPACE ts_name ;    &lt;br /&gt;PURGE TABLESPACE ts_name USER username ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Dropping the table and bypass the RECYCLEBIN&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;DROP TABLE tablename PURGE ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Recovering a Table from the RECYCLEBIN&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Recover last dropped version of the table&lt;/em&gt;&lt;br /&gt;FLASHBACK TABLE tablename TO BEFORE DROP;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Recover the table, but give it a new name&lt;br /&gt;&lt;/em&gt;FLASHBACK TABLE tablename TO BEFORE DROP RENAME TO newtablename ;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Recover the table from a prior dropped version of the table&lt;/em&gt;&lt;br /&gt;FLASHBACK TABLE “recyclebin name” TO BEFORE DROP ;&lt;br /&gt;FLASHBACK TABLE “recyclebin name” TO BEFORE DROP RENAME TO newtablename ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Examples Using Flashback Drop&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;1. Create a table for our testing&lt;br /&gt;SQL&gt; CREATE TABLE flashback_drop_test ( id  NUMBER(10) );&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Insert a record so that we have data&lt;br /&gt;SQL&gt; INSERT INTO flashback_drop_test (id) VALUES (1);&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; COMMIT;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Drop the table&lt;br /&gt;SQL&gt; DROP TABLE flashback_drop_test;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Show the RECYCLEBIN&lt;br /&gt;SQL&gt; SHOW RECYCLEBIN&lt;br /&gt;ORIGINAL NAME       RECYCLEBIN NAME                OBJECT TYPE  DROP TIME&lt;br /&gt;------------------- ------------------------------ ------------ -------------------&lt;br /&gt;FLASHBACK_DROP_TEST BIN$qLfTuNLERa6PzKkR4l1luA==$0 TABLE        2008-05-20:16:03:36&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Show that we can no longer select from the table.&lt;br /&gt;SQL&gt; select * from flashback_drop_test;&lt;br /&gt;select * from flashback_drop_test&lt;br /&gt;              *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-00942: table or view does not exist&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Bring back the last dropped version of the table&lt;br /&gt;SQL&gt; FLASHBACK TABLE flashback_drop_test TO BEFORE DROP;&lt;br /&gt;&lt;br /&gt;Flashback complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Show that the table is back and we can select from it&lt;br /&gt;SQL&gt; select * from flashback_drop_test;&lt;br /&gt;&lt;br /&gt;        ID&lt;br /&gt;----------&lt;br /&gt;         1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Show that the RECYCLEBIN is now empty&lt;br /&gt;SQL&gt; show recyclebin&lt;br /&gt;SQL&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. Drop the table again using the purge option.&lt;br /&gt;SQL&gt; drop table flashback_drop_test PURGE ;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;10. Show that the recyclebin is empty as we used the PURGE option.&lt;br /&gt;SQL&gt; show recyclebin&lt;br /&gt;SQL&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;11. Recreate the table for our further testing.&lt;br /&gt;SQL&gt; CREATE TABLE flashback_drop_test ( id  NUMBER(10) );&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;12. Drop the table again using the purge option.&lt;br /&gt;SQL&gt; drop table flashback_drop_test ;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;13. recreate the table to have multiple versions of the table.&lt;br /&gt;SQL&gt; CREATE TABLE flashback_drop_test ( id  NUMBER(10) );&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;14. Insert a record so that we have data so we will have 2 versions of the table one with a record and one empty.&lt;br /&gt;SQL&gt; INSERT INTO flashback_drop_test (id) VALUES (1);&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; COMMIT;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;15. Show that we have the table in the RECYCLEBIN again.&lt;br /&gt;SQL&gt; show recyclebin&lt;br /&gt;ORIGINAL NAME       RECYCLEBIN NAME                OBJECT TYPE  DROP TIME&lt;br /&gt;------------------- ------------------------------ ------------ -------------------&lt;br /&gt;FLASHBACK_DROP_TEST BIN$4/+GRpvFSl6cIWL21YkgPA==$0 TABLE        2008-05-20:16:03:39&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;16. Show that the we can select directly from the table in the RECYCLEBIN using the RECYCLEBIN name and show that the table in the RECYCLEBIN has no rows.&lt;br /&gt;SQL&gt; select * from "BIN$XzZkNWkNQBiwl9WSVWk49w==$0" ;&lt;br /&gt;&lt;br /&gt;no rows selected&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;17. Show that the current table still exists and has rows&lt;br /&gt;SQL&gt; select * from flashback_drop_test ;&lt;br /&gt;&lt;br /&gt;        ID&lt;br /&gt;----------&lt;br /&gt;         1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;18. Drop the table&lt;br /&gt;SQL&gt; drop table flashback_drop_test ;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;19. Show that we now have 2 versions of the table in the recyclebin.&lt;br /&gt;SQL&gt; show recyclebin&lt;br /&gt;ORIGINAL NAME       RECYCLEBIN NAME                OBJECT TYPE  DROP TIME&lt;br /&gt;------------------- ------------------------------ ------------ -------------------&lt;br /&gt;FLASHBACK_DROP_TEST BIN$3FoAb84NSMmiVnhYco2e5w==$0 TABLE        2008-05-20:16:50:25&lt;br /&gt;FLASHBACK_DROP_TEST BIN$XzZkNWkNQBiwl9WSVWk49w==$0 TABLE        2008-05-20:16:46:32&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;20. Bring back the latest version of the table but with another table name.&lt;br /&gt;SQL&gt; FLASHBACK TABLE flashback_drop_test TO BEFORE DROP RENAME TO flashback_drop_test_old;&lt;br /&gt;&lt;br /&gt;Flashback complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;21. Show that we can select from the new table name.&lt;br /&gt;SQL&gt; select * from flashback_drop_test_old;&lt;br /&gt;&lt;br /&gt;        ID&lt;br /&gt;----------&lt;br /&gt;         1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;22. Show that we still do not see the original table.&lt;br /&gt;SQL&gt; select * from flashback_drop_test;&lt;br /&gt;select * from flashback_drop_test&lt;br /&gt;              *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-00942: table or view does not exist&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;23. Show that we still have a version of the table in the RECYCLEBIN&lt;br /&gt;SQL&gt; show recyclebin&lt;br /&gt;ORIGINAL NAME       RECYCLEBIN NAME                OBJECT TYPE  DROP TIME&lt;br /&gt;------------------- ------------------------------ ------------ -------------------&lt;br /&gt;FLASHBACK_DROP_TEST BIN$XzZkNWkNQBiwl9WSVWk49w==$0 TABLE        2008-05-20:16:46:32&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;24. Create a new version of the table.&lt;br /&gt;SQL&gt; CREATE TABLE flashback_drop_test ( id  NUMBER(10) );&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;25. Insert a row so this version has a record.&lt;br /&gt;SQL&gt; INSERT INTO flashback_drop_test (id) VALUES (1);&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; COMMIT;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;26. Drop the table&lt;br /&gt;SQL&gt; drop table flashback_drop_test ;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;27. Show that the 2 versions are in the RECYCLEBIN&lt;br /&gt;SQL&gt; show recyclebin&lt;br /&gt;ORIGINAL NAME       RECYCLEBIN NAME                OBJECT TYPE  DROP TIME&lt;br /&gt;------------------- ------------------------------ ------------ -------------------&lt;br /&gt;FLASHBACK_DROP_TEST BIN$MMV1E9cRRZCvUkC8HM3WhQ==$0 TABLE        2008-05-20:16:58:45&lt;br /&gt;FLASHBACK_DROP_TEST BIN$XzZkNWkNQBiwl9WSVWk49w==$0 TABLE        2008-05-20:16:46:32&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;28. Restore the older version of the table from the RECYCLEBIN, this one does not have a record in it.&lt;br /&gt;SQL&gt; FLASHBACK TABLE "BIN$XzZkNWkNQBiwl9WSVWk49w==$0" TO BEFORE DROP ;&lt;br /&gt;&lt;br /&gt;Flashback complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;29. Show that the table is the correct version as it will have no record in it.&lt;br /&gt;SQL&gt; select * from flashback_drop_test ;&lt;br /&gt;&lt;br /&gt;no rows selected&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-4399842132221252640?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/4399842132221252640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=4399842132221252640' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4399842132221252640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/4399842132221252640'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/05/oracle-flashback-drop.html' title='Oracle Flashback Drop'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-7139054997954594650</id><published>2008-05-08T19:57:00.000-04:00</published><updated>2008-05-13T13:45:24.155-04:00</updated><title type='text'>Oracle Transparent Data Encryption</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Oracle has provided a way to automatically encrypt data in a column of a table and at the same time decrypt it automatically therefore allowing an application to function as if the column was not encrypted. Transparent data encryption will protect the data in a column in a table with the use of a wallet. Transparent data encryption by default uses the algorithm AES with 192-bit key for data encryption. The following is a short test showing the use of Transparent Data Encryption.&lt;br /&gt;&lt;br /&gt;There is overhead to transparent data encryption that can not be ignored as the encryption during inserts and updates, and decryption operations during select operations consume CPU cycles. While this overhead is fairly low it is safer to selectively apply encryption to where it is truly needed on a column basis. Therefore proper load tests should be performed incrementally as column encryption is rolled out so that full impact to system can be measured.&lt;br /&gt;&lt;br /&gt;There are three significant things to mention about encryption one being that streams does not support the use of encrypted columns the other two have to do with the use of indexes.  One you can not index columns that are encrypted with salt therefore columns encrypted that require an index as the column will be used in searches will need to be encrypted without salt.  By default transparent data encryption is done with salt and to encrypt a column without salt the “no salt” option must be specified.  Second indexes for encrypted columns behave different in a single respect but can have a large impact.  Take table emp for example, add column ssn and encrypt it and build an index on it.  We will use 2 query examples:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;select ename from emp where ssn = ‘123-45-6789’ ;&lt;br /&gt;&lt;br /&gt;This query will use the index and will not matter if the column is encrypted or not.&lt;br /&gt;&lt;br /&gt;select ename from emp where ssn like ‘123-45-%’ ;&lt;br /&gt;&lt;br /&gt;This query however will depend on if the column is encrypted or not to whether the index is used. If the column is encrypted the index will be ignored, however if the column is not encrypted the index would indeed be used. The reason the index is not used it due to the index now the column has an encrypted value and the ability to substring for an encrypted value is not possible. We will show that the index is indeed not used in the test below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;10g (10.2.0.3 Windows) and 11g (11.1.0.6) Test&lt;/strong&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;1. Set the Wallet location for encryption in the sqlnet.ora file.&lt;br /&gt;&lt;br /&gt;10g&lt;br /&gt;&lt;br /&gt;ENCRYPTION_WALLET_LOCATION =&lt;br /&gt;(SOURCE=&lt;br /&gt;(METHOD=file)&lt;br /&gt;(METHOD_DATA=&lt;br /&gt;(DIRECTORY=c:\oracle\product\10.2.0\db_1\network\admin\ENCRYPT)))&lt;br /&gt;&lt;br /&gt;11g&lt;br /&gt;&lt;br /&gt;ENCRYPTION_WALLET_LOCATION =&lt;br /&gt;(SOURCE=&lt;br /&gt;(METHOD=file)&lt;br /&gt;(METHOD_DATA=&lt;br /&gt;(DIRECTORY=c:\oracle\product\10.2.0\db_1\network\admin\ENCRYPT)))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Create the wallet, initial creation of the wallet will automatically open it.&lt;br /&gt;alter system set encryption key authenticated by "xxxxxxxxx" ;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption key authenticated by "xxxxxxxxx" ;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Each time you need to use the wallet it will need to be explicitly opened. The wallet will allow the automatic decryption of data as it is read, otherwise the data of encrypted columns will remain encrypted and not able to be viewed. All other columns that are not encrypted work as normal even when the wallet is not open. In this case since it was just created the wallet is already open.&lt;br /&gt;&lt;br /&gt;alter system set encryption wallet open authenticated by "kim11ball" ;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet open authenticated by "xxxxxxxxx" ;&lt;br /&gt;alter system set encryption wallet open authenticated by "xxxxxxxxx"&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-28354: wallet already open&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Note: Can close the wallet explicitly with the following alter system set encryption wallet close ;&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet close ;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;4. Lets open the wallet so we can proceed with the test&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet open authenticated by "xxxxxxxxx" ;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. To test our transparent data encryption by using the emp table, first add an ssn column.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table emp add ssn varchar2(11) ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; update emp set ssn = ‘222-22-2222’ ;&lt;br /&gt;&lt;br /&gt;51 rows updated.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Encrypt the ssn column&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table emp modify (ssn encrypt) ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Note: Can turn the column encryption off with the following&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;SQL&gt; alter table emp modify (ssn decrypt) ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Check the emp table structure as we can see the SSN column show encrypt.&lt;br /&gt;&lt;br /&gt;SQL&gt; desc emp&lt;br /&gt;Name Null? Type&lt;br /&gt;----------- -------- ---------------------------&lt;br /&gt;EMPNO NOT NULL NUMBER(4)&lt;br /&gt;ENAME VARCHAR2(10)&lt;br /&gt;JOB VARCHAR2(9)&lt;br /&gt;MGR NUMBER(4)&lt;br /&gt;HIREDATE DATE&lt;br /&gt;SAL NUMBER(7,2)&lt;br /&gt;COMM NUMBER(7,2)&lt;br /&gt;DEPTNO NUMBER(2)&lt;br /&gt;SSN VARCHAR2(11) ENCRYPT&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Let verify the wallet is indeed closed.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet close;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet open authenticated by "nsfjsnfjksfa" ;&lt;br /&gt;alter system set encryption wallet open authenticated by "nsfjsnfjksfa"&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-28353: failed to open wallet&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet close;&lt;br /&gt;alter system set encryption wallet close&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-28365: wallet is not open&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. As we can see we are going to do the query with a user called temp the only permissions on this user is select on the emp table and create session.&lt;br /&gt;&lt;br /&gt;SQL&gt; select user from dual ;&lt;br /&gt;&lt;br /&gt;USER&lt;br /&gt;------------------------------&lt;br /&gt;TEMP&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. If we look at the SSN column we see that the column queries unencrypted, 10g is restricting the access to the column with the wallet closed as expected&lt;br /&gt;&lt;br /&gt;SQL&gt; select ssn from emp ;&lt;br /&gt;select ssn from emp&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-28365: wallet is not open&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;11. Not open the wallet for some more testing&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system set encryption wallet open authenticated by "xxxxxxxxx" ;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;12. See if an index can be built, as the summary indicates an index can not be built on an encrypted column with salt.&lt;br /&gt;&lt;br /&gt;SQL&gt; create index emp_ssn on emp (ssn) ;&lt;br /&gt;create index emp_ssn on emp (ssn)&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-28338: cannot encrypt indexed column(s) with salt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;13. Turn off the salt using the alter table statement so that the index can be built.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table emp modify ssn encrypt no salt ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;14. Now build the index&lt;br /&gt;&lt;br /&gt;SQL&gt; create index emp_ssn on emp (ssn) ;&lt;br /&gt;&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;15. Now check the affect the encryption has on the index usage.&lt;br /&gt;&lt;br /&gt;A: Check using the column in the where clause with an =&lt;br /&gt;&lt;br /&gt;SQL&gt; explain plan for select ename from emp where ssn = '123-45-6789' ;&lt;br /&gt;&lt;br /&gt;Explained.&lt;br /&gt;&lt;br /&gt;SQL&gt; @plan&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Plan hash value: 1582005447&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;Id Operation Name RowsBytesCost(%CPU)Time&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT 1 38 2 (0) 00:00:01&lt;br /&gt;1 TABLE ACCESS BY INDEX ROWIDEMP 1 38 2 (0) 00:00:01&lt;br /&gt;* 2 INDEX RANGE SCAN EMP_SSN 1 1 (0) 00:00:01&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;B: Check the index use with the LIKE, as we can see by the explain plan the index is suppressed.&lt;br /&gt;&lt;br /&gt;SQL&gt; explain plan for select ename from emp where ssn like '123-45-%' ;&lt;br /&gt;&lt;br /&gt;Explained.&lt;br /&gt;&lt;br /&gt;SQL&gt; @plan&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Plan hash value: 3956160932&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;Id Operation NameRowsBytesCost(%CPU)Time&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT 2 76 3 (0)00:00:01&lt;br /&gt;* 1 TABLE ACCESS FULL EMP 2 76 3 (0)00:00:01&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;16. No remove the encryption from the ssn column and see if the like uses the index as expected and indeed the index is used.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table emp modify (ssn decrypt) ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; explain plan for select ename from emp where ssn like '123-45-%' ;&lt;br /&gt;&lt;br /&gt;Explained.&lt;br /&gt;&lt;br /&gt;SQL&gt; @plan&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Plan hash value: 1582005447&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;Id Operation Name RowsBytesCost(%CPU) Time&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT 2 28 2 (0) 00:00:01&lt;br /&gt;1 TABLE ACCESS BY INDEX ROWIDEMP 2 28 2 (0) 00:00:01&lt;br /&gt;* 2 INDEX RANGE SCAN EMP_SSN 1 1 (0) 00:00:01&lt;br /&gt;---------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-7139054997954594650?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/7139054997954594650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=7139054997954594650' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7139054997954594650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7139054997954594650'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/05/oracle-transparent-data-encryption.html' title='Oracle Transparent Data Encryption'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-1953709642380697748</id><published>2008-05-08T15:23:00.000-04:00</published><updated>2008-05-08T15:26:33.764-04:00</updated><title type='text'>Oracle 11g Read-Only Tables</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;Prior to 11g you could make an entire tablespace read-only which meant that you had to group all your tables that you wanted to be read-only into a common tablespace or set of tablespaces, or you had to create a trigger that would cause an error.  11G now allows a single table to be made read-only without affecting the other tables in the tablespace.  This can help save the overhead of having to move tables to read-only tablespaces when you are read to make the table read-only.  Not only can we place the table read-only but can change it back to read-write to allow insert and updates when needed.&lt;br /&gt;&lt;br /&gt;The read-only designation for a table will stop all DML (truncate/insert/update/delete/etc) operations and certain DDL operations as well like ALTER TABLE to add/modify/rename/drop columns,  ALTER TABLE drop/truncate/exchange (SUB)PARTITION, ALTER TABLE upgrade.  Though keep in mind that some DDL can still be done against a table designated read-only like DROP TABLE,  ALTER TABLE add/coalesce/merge/modify/move/rename/split (SUB)PARTITION, ALTER TABLE rename/move/add supplemental log/drop supplemental log/deallocate ununsed.&lt;br /&gt;To identify if a table is read-only a new column has been added to dba_tables, user_tables and all_tables called READ_ONLY.  This column will contain YES if the table is read-only and NO when the table is not read-only.&lt;br /&gt;&lt;br /&gt;Unfortunately at this time Oracle does not allow the ability to just take a partition of a table and make it read-only, to make a partition of a table read-only the partition must be moved to a tablespace that can be marked read-only.  One can only hope Oracle will help us out and provide that ability in future releases saving the overhead of move partitions or having to place partitions in separate tablespaces to get the partitions to be read-only.&lt;br /&gt;&lt;br /&gt;Putting table into read-only:&lt;br /&gt;&lt;br /&gt;alter table big_emp2 read only ;&lt;br /&gt;&lt;br /&gt;Taking table out of read-only&lt;br /&gt;&lt;br /&gt;alter table big_emp2 read write ;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;strong&gt;11g (11.1.0.6 Windows) Test&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;em&gt;Create the table for the test and load with dummy data.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;SQL&gt; -- create the table for the test&lt;br /&gt;SQL&gt; CREATE TABLE big_emp2&lt;br /&gt;  2    (EMPNO       NUMBER(4)       CONSTRAINT big_emp2_pk primary key disable,&lt;br /&gt;  3     ENAME       VARCHAR2(10),&lt;br /&gt;  4     JOB         VARCHAR2(9),&lt;br /&gt;  5     MGR         NUMBER(4),&lt;br /&gt;  6     HIREDATE    DATE,&lt;br /&gt;  7     SAL         NUMBER(7,2),&lt;br /&gt;  8     COMM        NUMBER(7,2),&lt;br /&gt;  9     DEPTNO      NUMBER(2)&lt;br /&gt; 10  )&lt;br /&gt; 11  PARTITION BY RANGE (HIREDATE)&lt;br /&gt; 12        (PARTITION  y1980   VALUES LESS THAN ( TO_DATE('01-JAN-1981','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 13         PARTITION  y1981   VALUES LESS THAN ( TO_DATE('01-JAN-1982','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 14         PARTITION  y1982   VALUES LESS THAN ( TO_DATE('01-JAN-1983','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 15         PARTITION  y1983   VALUES LESS THAN ( TO_DATE('01-JAN-1984','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 16         PARTITION  y1984   VALUES LESS THAN ( TO_DATE('01-JAN-1985','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 17         PARTITION  y1985   VALUES LESS THAN ( TO_DATE('01-JAN-1986','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 18         PARTITION  y1986   VALUES LESS THAN ( TO_DATE('01-JAN-1987','DD-MON-YYYY') ) TABLESPACE USERS,&lt;br /&gt; 19         PARTITION  y1987   VALUES LESS THAN ( MAXVALUE ) TABLESPACE USERS&lt;br /&gt; 20        )&lt;br /&gt; 21  /&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- create the unique index for the primary key&lt;br /&gt;SQL&gt; create unique index beig_emp2_pk on big_emp2 (empno) ;&lt;br /&gt;&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- enable the primary key using the unique index&lt;br /&gt;SQL&gt; alter table big_emp2 enable primary key using index ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; -- load data&lt;br /&gt;SQL&gt; insert into big_emp2 select * from big_emp ;&lt;br /&gt;&lt;br /&gt;9254 rows created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Make the Table Read Only&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table big_emp2 read only ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;em&gt;Check that the table shows read-only&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;SQL&gt; select table_name, read_only from user_tables where table_name = 'BIG_EMP2';&lt;br /&gt;&lt;br /&gt;TABLE_NAME                     REA&lt;br /&gt;------------------------------ ---&lt;br /&gt;BIG_EMP2                       YES&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Attempt to do DML operations against the table&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; update big_emp2 set salary = salary + 200 ;&lt;br /&gt;update big_emp2 set salary = salary + 200&lt;br /&gt;       *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-12081: update operation not allowed on table "MRMESSIN"."BIG_EMP2"&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into big_emp2 values (0,'My Name','MGR','1000','01-JAN-08',5000,1000,10) ;&lt;br /&gt;insert into big_emp2 values (0,'My Name','MGR','1000','01-JAN-08',5000,1000,10)&lt;br /&gt;            *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-12081: update operation not allowed on table "MRMESSIN"."BIG_EMP2"&lt;br /&gt;&lt;br /&gt;SQL&gt; delete from big_emp2 ;&lt;br /&gt;delete from big_emp2&lt;br /&gt;            *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-12081: update operation not allowed on table "MRMESSIN"."BIG_EMP2"&lt;br /&gt;&lt;br /&gt;SQL&gt; truncate table big_emp2 ;&lt;br /&gt;truncate table big_emp2&lt;br /&gt;               *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-12081: update operation not allowed on table "MRMESSIN"."BIG_EMP2"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Attempt to do DDL operations against the table&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table big_emp2 add ssn varchar2(11) ;&lt;br /&gt;alter table big_emp2 add ssn varchar2(11)&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-12081: update operation not allowed on table "MRMESSIN"."BIG_EMP2"&lt;br /&gt;&lt;br /&gt;SQL&gt; ALTER TABLE big_emp2 drop partition y1980 ;&lt;br /&gt;ALTER TABLE big_emp2 drop partition y1980&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-12081: update operation not allowed on table "MRMESSIN"."BIG_EMP2"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-1953709642380697748?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/1953709642380697748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=1953709642380697748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1953709642380697748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1953709642380697748'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/05/oracle-11g-read-only-tables.html' title='Oracle 11g Read-Only Tables'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-1088939165459772914</id><published>2008-05-05T20:41:00.000-04:00</published><updated>2008-05-05T20:43:33.993-04:00</updated><title type='text'>Moving Cost Based Optimizer Statistics</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;We have found that over time test databases do not match production databases is data or even in data volume unless we refresh them frequently.  The problem is getting the development and test staff to allow the downtime necessary to do a database refresh from production especially for larger databases.  So how do we make sure out execution plans in our test environment match what the production execution plans would be.  The answer is to take the cost based optimizer statistics and put them in the production database.&lt;br /&gt;&lt;br /&gt;1. To move the cost based optimizer statistics we first create a stats table and put the CBO stats in that stats table.  In our example we will use the SYSTEM schema for the stats table.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;-- Setup our stats table and export our stats for the passed schema&lt;br /&gt;-- into the stats table&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;DECLARE&lt;br /&gt;   v_tbl_cnt   NUMBER ;&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;   -- enable DBMS_OUTPUT&lt;br /&gt;   dbms_output.enable (1000000) ;&lt;br /&gt;&lt;br /&gt;   -- Check if our stats table exists&lt;br /&gt;   SELECT count(*)&lt;br /&gt;   INTO v_tbl_cnt&lt;br /&gt;   FROM dba_tables&lt;br /&gt;   WHERE owner = 'SYSTEM'&lt;br /&gt;     AND table_name = 'CBO_STATS' ;&lt;br /&gt;&lt;br /&gt;   -- If stats table exists then we must get rid of it to ensure&lt;br /&gt;   -- that we always recreate it to ensure structure is correct&lt;br /&gt;   IF v_tbl_cnt &gt; 0 THEN&lt;br /&gt;      dbms_output.put_line('Having to Remove SYSTEM.CBO_STATS as it already Exists.');&lt;br /&gt;     &lt;br /&gt;      -- Remove our stats table now that we have exported it&lt;br /&gt;      DBMS_STATS.drop_stat_table('SYSTEM','CBO_STATS') ;&lt;br /&gt;   END IF ;&lt;br /&gt;&lt;br /&gt;   -- Create our stats table&lt;br /&gt;   dbms_output.put_line ('Creating SYSTEM.CBO_STATS Table to Store CBO Stats for Schema &amp;amp;1.') ;&lt;br /&gt;   dbms_stats.create_stat_table(ownname =&gt; 'SYSTEM', stattab =&gt; 'CBO_STATS', tblspace =&gt; 'USERS') ;&lt;br /&gt;&lt;br /&gt;   -- put our schema stats into out created stats table&lt;br /&gt;   dbms_output.put_line ('Exporting Schema Stats for &amp;amp;1 into SYSTEM.CBO_STATS table.') ;&lt;br /&gt;   dbms_stats.export_schema_stats (ownname =&gt; '&amp;amp;1', stattab =&gt; 'CBO_STATS', statown =&gt; 'SYSTEM') ;&lt;br /&gt;END ;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Next we will need to export the stats table we just put the cost based optimizer statistics into&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;-- export our stats table so it can be imported to another database&lt;br /&gt;-- We will use the DBMS_DATAPUMP Package to do our export to simplify&lt;br /&gt;-- the process&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;DECLARE&lt;br /&gt;  v_handle     NUMBER ;&lt;br /&gt;  ind          NUMBER ;        -- Loop index&lt;br /&gt;  spos         NUMBER ;        -- String starting position&lt;br /&gt;  slen         NUMBER ;        -- String length for output&lt;br /&gt;  percent_done NUMBER ;        -- Percentage of job complete&lt;br /&gt;  job_state    VARCHAR2(30) ;  -- To keep track of job state&lt;br /&gt;  le           ku$_LogEntry ;  -- For WIP and error messages&lt;br /&gt;  js           ku$_JobStatus ; -- The job status from get_status&lt;br /&gt;  jd           ku$_JobDesc ;   -- The job description from get_status&lt;br /&gt;  sts          ku$_Status ;    -- The status object returned by get_status&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;   dbms_output.enable (1000000) ;&lt;br /&gt;&lt;br /&gt;   -- create our datapump export job&lt;br /&gt;   dbms_output.put_line ('Opening Export Job') ;&lt;br /&gt;   v_handle := DBMS_DATAPUMP.OPEN (operation =&gt; 'EXPORT',&lt;br /&gt;                                   job_mode =&gt; 'TABLE',&lt;br /&gt;                                   job_name =&gt; 'EXPORT_CBO_STATS_JOB',&lt;br /&gt;                                   version =&gt; 'COMPATIBLE');&lt;br /&gt;&lt;br /&gt;   -- set our logfile&lt;br /&gt;   dbms_output.put_line ('Setting Log file for Export Job') ;&lt;br /&gt;   DBMS_DATAPUMP.ADD_FILE (handle =&gt; v_handle,&lt;br /&gt;                           filename =&gt; 'expdp_export_cbo_stats.log',&lt;br /&gt;                           directory =&gt; 'DMPDIR',&lt;br /&gt;                           filetype =&gt; 3) ;&lt;br /&gt;  &lt;br /&gt;   -- set our dump file&lt;br /&gt;   dbms_output.put_line ('Setting Dump file for Export Job') ;&lt;br /&gt;   DBMS_DATAPUMP.ADD_FILE (handle =&gt; v_handle,&lt;br /&gt;                           filename =&gt; 'expdp_export_cbo_stats.dmp',&lt;br /&gt;                           directory =&gt; 'DMPDIR',&lt;br /&gt;                           filetype =&gt; 1) ;&lt;br /&gt;&lt;br /&gt;   -- Add the schema filter&lt;br /&gt;   DBMS_DATAPUMP.METADATA_FILTER(v_handle,'SCHEMA_EXPR','IN (''SYSTEM'')');&lt;br /&gt;&lt;br /&gt;   -- set the filter for datapump to be the schema we want to export.&lt;br /&gt;   dbms_output.put_line ('Adding filter to only get SYSTEM.CBO_STATS') ;&lt;br /&gt;   DBMS_DATAPUMP.METADATA_FILTER (handle =&gt; v_handle,&lt;br /&gt;                                  name =&gt; 'NAME_EXPR',&lt;br /&gt;                                  value =&gt; '= ''CBO_STATS''',&lt;br /&gt;                                  object_type =&gt; 'TABLE') ;&lt;br /&gt;&lt;br /&gt;   -- Start the datapump export job&lt;br /&gt;   dbms_output.put_line ('Starting Datapump Export Job to dump SYSTEM.CBO_STATS table.') ;&lt;br /&gt;   DBMS_DATAPUMP.START_JOB (v_handle) ;&lt;br /&gt;&lt;br /&gt;   -- May have to use WAIT_FOR_JOB&lt;br /&gt;&lt;br /&gt;   -- initialize percent_done and job_state values&lt;br /&gt;   percent_done := 0 ;&lt;br /&gt;   job_state := 'UNDEFINED' ;&lt;br /&gt;&lt;br /&gt;   -- Loop while the job_state is not completed or stopped&lt;br /&gt;   while (job_state != 'COMPLETED') and (job_state != 'STOPPED') loop&lt;br /&gt;      dbms_datapump.get_status(v_handle,&lt;br /&gt;           dbms_datapump.ku$_status_job_error +&lt;br /&gt;           dbms_datapump.ku$_status_job_status +&lt;br /&gt;           dbms_datapump.ku$_status_wip,-1,job_state,sts) ;&lt;br /&gt;&lt;br /&gt;      js := sts.job_status ;&lt;br /&gt;&lt;br /&gt;      -- If the percentage done changed, display the new value.&lt;br /&gt;      if js.percent_done != percent_done then&lt;br /&gt;         dbms_output.put_line('*** Job percent done = '  to_char(js.percent_done)) ;&lt;br /&gt;    &lt;br /&gt;         percent_done := js.percent_done ;&lt;br /&gt;      end if ;&lt;br /&gt;&lt;br /&gt;      -- If any work-in-progress (WIP) or Error messages were received for the job,&lt;br /&gt;      -- display them.&lt;br /&gt;      if (bitand(sts.mask,dbms_datapump.ku$_status_wip) != 0) then&lt;br /&gt;         le := sts.wip ;&lt;br /&gt;      else&lt;br /&gt;         if (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0) then&lt;br /&gt;            le := sts.error ;&lt;br /&gt;         else&lt;br /&gt;            le := null ;&lt;br /&gt;         end if ;&lt;br /&gt;      end if ;&lt;br /&gt;&lt;br /&gt;      if le is not null then&lt;br /&gt;         ind := le.FIRST ;&lt;br /&gt;&lt;br /&gt;         -- loop while loop indicator is not null&lt;br /&gt;         while ind is not null loop&lt;br /&gt;            dbms_output.put_line(le(ind).LogText);&lt;br /&gt;            ind := le.NEXT(ind);&lt;br /&gt;         end loop;&lt;br /&gt;      end if;&lt;br /&gt;   end loop;&lt;br /&gt;&lt;br /&gt;   -- Indicate that the job finished and gracefully detach from it.&lt;br /&gt;   dbms_output.put_line('Data Pump Import Job has completed') ;&lt;br /&gt;   dbms_output.put_line('Final job state = '  job_state) ;&lt;br /&gt;   dbms_datapump.detach(v_handle) ;&lt;br /&gt;&lt;br /&gt;-- Handle exceptions from our export&lt;br /&gt;EXCEPTION&lt;br /&gt;    WHEN OTHERS THEN&lt;br /&gt;      dbms_output.put_line('Exception in Data Pump job') ;&lt;br /&gt;      dbms_datapump.get_status(v_handle,dbms_datapump.ku$_status_job_error, 0, job_state, sts) ;&lt;br /&gt;&lt;br /&gt;      IF (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0) THEN&lt;br /&gt;        le := sts.error;&lt;br /&gt;       &lt;br /&gt;        if le is not null then&lt;br /&gt;          ind := le.FIRST ;&lt;br /&gt;&lt;br /&gt;          while ind is not null loop&lt;br /&gt;            spos := 1;&lt;br /&gt;            slen := length(le(ind).LogText) ;&lt;br /&gt;&lt;br /&gt;            if slen &gt; 255 then&lt;br /&gt;              slen := 255;&lt;br /&gt;            end if;&lt;br /&gt;&lt;br /&gt;            while slen &gt; 0 loop&lt;br /&gt;              dbms_output.put_line(substr(le(ind).LogText, spos, slen));&lt;br /&gt;              spos := spos + 255;&lt;br /&gt;              slen := length(le(ind).LogText) + 1 - spos;&lt;br /&gt;            end loop;&lt;br /&gt;&lt;br /&gt;            ind := le.NEXT(ind);&lt;br /&gt;          end loop;&lt;br /&gt;        end if;&lt;br /&gt;      END IF ;&lt;br /&gt;END ;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. If we use a database link (TARGET) to the database we are moving the stats to and it is on a different host then we can transfer the file across the database link with a DMPDIR defined on the other side.  Otherwise we can copy the file through OS FTP, SCP or copy commands.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;-- Transfer the file via DBMS_FILE_TRANSFER over network link&lt;br /&gt;-- Can change process to just do import over network link&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;EXEC DBMS_FILE_TRANSFER.PUT_FILE ('DMPDIR', 'expdp_export_cbo_stats.dmp', 'DMPDIR', 'expdp_export_cbo_stats.dmp', 'TARGET') ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Now the stats table can be removed now that we have exported the table and transferred the dump file to the destination.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;-- Clean up by Removing our stats table now that we have exported it&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;EXEC DBMS_STATS.drop_stat_table('SYSTEM','CBO_STATS') ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Connect to the destination database so that we can import the stats table.&lt;br /&gt;&lt;br /&gt;-- Our example here the 2 databases are on the same host so our directory is still ok&lt;br /&gt;-- Import our stats table into the other database for stats import use&lt;br /&gt;DECLARE&lt;br /&gt;  ind          NUMBER ;               -- Loop index&lt;br /&gt;  spos         NUMBER ;               -- String starting position&lt;br /&gt;  slen         NUMBER ;               -- String length for output&lt;br /&gt;  v_handle     NUMBER ;               -- Data Pump job handle&lt;br /&gt;  percent_done NUMBER ;               -- Percentage of job complete&lt;br /&gt;  job_state    VARCHAR2(30) ;         -- To keep track of job state&lt;br /&gt;  le           ku$_LogEntry ;         -- For WIP and error messages&lt;br /&gt;  js           ku$_JobStatus ;        -- The job status from get_status&lt;br /&gt;  jd           ku$_JobDesc ;          -- The job description from get_status&lt;br /&gt;  sts          ku$_Status ;           -- The status object returned by get_status&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;   dbms_output.enable (1000000) ;&lt;br /&gt;  &lt;br /&gt;   -- Create a Data Pump job to do a "full" import as only our stats table is there&lt;br /&gt;   -- create our datapump export job&lt;br /&gt;   v_handle := DBMS_DATAPUMP.OPEN (operation =&gt; 'IMPORT',&lt;br /&gt;                                   job_mode =&gt; 'FULL',&lt;br /&gt;                                   job_name =&gt; 'IMPORT_CBO_STATS_JOB',&lt;br /&gt;                                   version =&gt; 'COMPATIBLE');&lt;br /&gt;&lt;br /&gt;   -- set our logfile for import&lt;br /&gt;   DBMS_DATAPUMP.ADD_FILE (handle =&gt; v_handle,&lt;br /&gt;                           filename =&gt; 'expdp_import_cbo_stats.log',&lt;br /&gt;                           directory =&gt; 'DMPDIR',&lt;br /&gt;                           filetype =&gt; 3) ;&lt;br /&gt;&lt;br /&gt;   -- set our dump file&lt;br /&gt;   DBMS_DATAPUMP.ADD_FILE (handle =&gt; v_handle,&lt;br /&gt;                           filename =&gt; 'expdp_export_cbo_stats.dmp',&lt;br /&gt;                           directory =&gt; 'DMPDIR',&lt;br /&gt;                           filetype =&gt; 1) ;&lt;br /&gt;&lt;br /&gt;   -- If a table already exists in the destination schema, replace it before loading&lt;br /&gt;   -- to ensure the structure is proper as the data prior to is not important here.&lt;br /&gt;   DBMS_DATAPUMP.SET_PARAMETER(v_handle,'TABLE_EXISTS_ACTION','REPLACE');&lt;br /&gt;&lt;br /&gt;   -- Start the job. An exception is returned if something is not set up properly.&lt;br /&gt;   DBMS_DATAPUMP.START_JOB(v_handle);&lt;br /&gt;&lt;br /&gt;   -- The import job should now be running. In the following loop, the job is&lt;br /&gt;   -- monitored until it completes. In the meantime, progress information is&lt;br /&gt;   -- displayed. Note: this is identical to the export example.&lt;br /&gt;&lt;br /&gt;   -- initialize percent_done and job_state values&lt;br /&gt;   percent_done := 0 ;&lt;br /&gt;   job_state := 'UNDEFINED' ;&lt;br /&gt;   &lt;br /&gt;   -- Loop while the job_state is not completed or stopped&lt;br /&gt;   while (job_state != 'COMPLETED') and (job_state != 'STOPPED') loop&lt;br /&gt;      dbms_datapump.get_status(v_handle,&lt;br /&gt;          dbms_datapump.ku$_status_job_error +&lt;br /&gt;          dbms_datapump.ku$_status_job_status +&lt;br /&gt;          dbms_datapump.ku$_status_wip,-1,job_state,sts) ;&lt;br /&gt;&lt;br /&gt;      js := sts.job_status ;&lt;br /&gt;&lt;br /&gt;      -- If the percentage done changed, display the new value.&lt;br /&gt;      if js.percent_done != percent_done then&lt;br /&gt;         dbms_output.put_line('*** Job percent done = '  to_char(js.percent_done)) ;&lt;br /&gt;    &lt;br /&gt;         percent_done := js.percent_done ;&lt;br /&gt;      end if ;&lt;br /&gt;&lt;br /&gt;      -- If any work-in-progress (WIP) or Error messages were received for the job,&lt;br /&gt;      -- display them.&lt;br /&gt;      if (bitand(sts.mask,dbms_datapump.ku$_status_wip) != 0) then&lt;br /&gt;         le := sts.wip ;&lt;br /&gt;      else&lt;br /&gt;         if (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0) then&lt;br /&gt;            le := sts.error ;&lt;br /&gt;         else&lt;br /&gt;            le := null ;&lt;br /&gt;         end if ;&lt;br /&gt;      end if ;&lt;br /&gt;&lt;br /&gt;      if le is not null then&lt;br /&gt;         ind := le.FIRST ;&lt;br /&gt;&lt;br /&gt;         -- loop while loop indicator is not null&lt;br /&gt;         while ind is not null loop&lt;br /&gt;            dbms_output.put_line(le(ind).LogText);&lt;br /&gt;            ind := le.NEXT(ind);&lt;br /&gt;         end loop;&lt;br /&gt;      end if;&lt;br /&gt;   end loop;&lt;br /&gt;&lt;br /&gt;   -- Indicate that the job finished and gracefully detach from it.&lt;br /&gt;   dbms_output.put_line('Data Pump Import Job has completed') ;&lt;br /&gt;   dbms_output.put_line('Final job state = '  job_state) ;&lt;br /&gt;   dbms_datapump.detach(v_handle) ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Handle exceptions from our import&lt;br /&gt;EXCEPTION&lt;br /&gt;    WHEN OTHERS THEN&lt;br /&gt;      dbms_output.put_line('Exception in Data Pump job') ;&lt;br /&gt;      dbms_datapump.get_status(v_handle,dbms_datapump.ku$_status_job_error, 0, job_state, sts) ;&lt;br /&gt;&lt;br /&gt;      IF (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0) THEN&lt;br /&gt;        le := sts.error;&lt;br /&gt;       &lt;br /&gt;        if le is not null then&lt;br /&gt;          ind := le.FIRST ;&lt;br /&gt;&lt;br /&gt;          while ind is not null loop&lt;br /&gt;            spos := 1;&lt;br /&gt;            slen := length(le(ind).LogText);&lt;br /&gt;&lt;br /&gt;            if slen &gt; 255 then&lt;br /&gt;              slen := 255;&lt;br /&gt;            end if;&lt;br /&gt;&lt;br /&gt;            while slen &gt; 0 loop&lt;br /&gt;              dbms_output.put_line(substr(le(ind).LogText, spos, slen));&lt;br /&gt;              spos := spos + 255;&lt;br /&gt;              slen := length(le(ind).LogText) + 1 - spos;&lt;br /&gt;            end loop;&lt;br /&gt;&lt;br /&gt;            ind := le.NEXT(ind);&lt;br /&gt;          end loop;&lt;br /&gt;        end if;&lt;br /&gt;      END IF ;&lt;br /&gt;END ;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;6. If bringing the stats table from a prior version of Oracle into a newer version of Oracle you will need to upgrade the stats table.&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;-- If moving stats from a previous version of database need to upgrade stats table&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;exec dbms_stats.upgrade_stat_table ('SYSTEM', 'CBO_STATS') ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Lastly import the statistics into the schema.&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;-- Import the schema stats exported from the other database&lt;br /&gt;------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;EXEC DBMS_STATS.import_schema_stats('&amp;amp;1','CBO_STATS',NULL,'SYSTEM');&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-1088939165459772914?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/1088939165459772914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=1088939165459772914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1088939165459772914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/1088939165459772914'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/05/moving-cost-based-optimizer-statistics.html' title='Moving Cost Based Optimizer Statistics'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-5875178548519138834</id><published>2008-03-31T15:46:00.000-04:00</published><updated>2010-02-20T15:41:12.457-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rename Target in OEM Grid Control Without Removing Target'/><title type='text'>Rename Target in OEM Grid Control Without Removing Target</title><content type='html'>&lt;div&gt;1. Go to the target machine when you can change the target name&lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;2. Go to agent ORACLE_HOME/sysman/emd directory&lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;3. Find the targets.xml file&lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;4. make a backup of copy of the targets.xml to something like targets.xml.bak &lt;/div&gt;&lt;br /&gt;&lt;div&gt;Edit the file and search for the target name you want to change and then change the name to the new name you want the target to have.&lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;6. Go to agent ORACLE_HOME/bin directory and run the following&lt;/div&gt;&lt;br /&gt;&lt;div&gt;emctl stop agent&lt;/div&gt;&lt;br /&gt;&lt;div&gt;emctl clearstate agent&lt;/div&gt;&lt;br /&gt;&lt;div&gt;emctl start agent&lt;/div&gt;&lt;br /&gt;&lt;div&gt;emctl reload agent&lt;/div&gt;&lt;br /&gt;&lt;div&gt;emctl upload agent&lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;After a few minutes go into the OEM Grid Control GUI and you should see the new target name&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-5875178548519138834?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/5875178548519138834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=5875178548519138834' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5875178548519138834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/5875178548519138834'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/03/rename-target-in-oem-grid-control.html' title='Rename Target in OEM Grid Control Without Removing Target'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8186082894475871757</id><published>2008-03-31T15:41:00.000-04:00</published><updated>2008-05-08T20:24:02.512-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Move OEM Grid Agent to another OMS'/><title type='text'>Move OEM Grid Agent to another OMS</title><content type='html'>1. Stop the agent: emctl stop agent&lt;br /&gt;&lt;br /&gt;2. edit the emd.properties file REPOSITORY_URL parameter to reflect the new OMS information&lt;br /&gt;&lt;br /&gt;3. Clean up the agent files&lt;br /&gt;&lt;br /&gt;rm -r $ORACLE_HOME/sysman/emd/state/*&lt;br /&gt;rm -r $ORACLE_HOME/sysman/emd/collection/*&lt;br /&gt;rm -r $ORACLE_HOME/sysman/emd/upload/*&lt;br /&gt;rm $ORACLE_HOME/sysman/emd/lastupld.xml&lt;br /&gt;rm $ORACLE_HOME/sysman/emd/agntstmp.txt&lt;br /&gt;rm $ORACLE_HOME/sysman/emd/blackouts.xml&lt;br /&gt;rm $ORACLE_HOME/sysman/emd/protocol.ini&lt;br /&gt;&lt;br /&gt;4. emctl clearstate&lt;br /&gt;&lt;br /&gt;5. emctl start agent&lt;br /&gt;&lt;br /&gt;6. emctl upload&lt;br /&gt;&lt;br /&gt;7. emctl status agent&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8186082894475871757?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8186082894475871757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8186082894475871757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8186082894475871757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8186082894475871757'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/03/move-oem-grid-agent-to-another-oms.html' title='Move OEM Grid Agent to another OMS'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-281399419049251052</id><published>2008-03-31T15:34:00.000-04:00</published><updated>2008-05-05T20:58:31.872-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rebuild targets.xml for Oracle Enterprise Manager Grid Control Agent'/><title type='text'>Rebuild targets.xml for Oracle Enterprise Manager Grid Control Agent</title><content type='html'>&lt;span style="font-size:85%;"&gt;1. Agents installations before 10.2.0.3 have a bug in the 'agentca' command that prevents the targets.xml file from getting populated with the initial parameters (AGENT_TOKEN, ORACLE_EMD, and/or HOST) when the file does not already exist. To work around this we will need to manually create a targets.xml file if it does not exist. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Windows&lt;br /&gt;create the new file in the Agent %ORACLE_HOME%\sysman\emd\ directory. (Where %ORACLE_HOME% is the agent’s home)&lt;br /&gt;Unix$&lt;br /&gt;&lt;br /&gt;$ cd $ORACLE_HOME/sysman/emd (where $ORACLE_HOME is the Agent's home)&lt;br /&gt;$ touch targets.xml.&lt;br /&gt;&lt;br /&gt;2. Once you have created the targets.xml file, view the Agent's $ORACLE_HOME/sysman/config/emd.properties file. Copy the values for:&lt;br /&gt;agentSeed=12345EMD_URL=http://hostname.oracle.com:9876/emd/main&lt;br /&gt;&lt;br /&gt;3. Manually update the new targets.xml and add the following entries to the file following the syntax exactly:&lt;br /&gt;&lt;br /&gt;&lt;targets agent_seed="agentseed from emd.properties"&gt;&lt;target name="hostname and port from emd.properrties EMD_URL" type="oracle_emd"&gt;&lt;target name="hostname as it appears in the emd_url" type="host"&gt;&lt;/targets&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;targets agent_seed="agentseed from emd.properties"&gt;               &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;target type="oracle_emd" name="hostname and port from emd.properties EMD_URL"&gt;              &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;target type="host" name="hostname as it appears in the emd_url"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/targets&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;For example:&lt;br /&gt;&lt;targets agent_seed="12345"&gt;            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;target type="oracle_emd" name="hostname.domain.com:port"&gt;            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;target type="host" name="hostname.domain.com"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/targets&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;targets agent_seed="12345"&gt;&lt;target name="hostname.domain.com:port" type="oracle_emd"&gt;&lt;target name="hostname.domain.com" type="host"&gt;&lt;/targets&gt;&lt;span style="font-size:85%;"&gt;4. Force target re-discovery:&lt;br /&gt;a. Verify that the environment variables are setup for the Management Agent:&lt;br /&gt;$ORACLE_HOME set$ORACLE_HOME/bin in $PATH&lt;br /&gt;&lt;br /&gt;b. The agentca utility is expecting the oraInst.loc to be located in the root of the Agent's $ORACLE_HOME&lt;br /&gt;&lt;br /&gt;NOTE: Solaris puts the oraInst.loc in /var/opt/oracle. Agentca will not fine the oraInst.loc on a Solaris platform. For Solaris platforms you need to create a soft link:&lt;br /&gt;$ORACLE_HOME/oraInst.loc to /var/opt/oracle/oraInst.loc&lt;br /&gt;c. Run agentca -d to force a new discovery of the targets on the host&lt;br /&gt;&lt;br /&gt;agentca -d &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-281399419049251052?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/281399419049251052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=281399419049251052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/281399419049251052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/281399419049251052'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/03/rebuild-targetsxml-for-oracle.html' title='Rebuild targets.xml for Oracle Enterprise Manager Grid Control Agent'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-3617723361165440707</id><published>2008-02-21T20:07:00.000-05:00</published><updated>2008-02-21T20:09:29.392-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 11g Interval Partitioning'/><title type='text'>Oracle 11g Interval Partitioning</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;New in 11g is Interval Partitioning.  This extends the functionality of range partitioning to where you define equal partitions using and interval definition.  When using Interval partitioning Oracle will automatically create new partitions as they are needed.  Oracle creates the new partition at the time of the first record insert for the new partition.  This greatly helps the manageability of partitioned tables by saving the DBA from having to manually create new partitions.&lt;br /&gt;&lt;br /&gt;The new interval partitioning valid combinations are Interval, Interval-List, Interval-Hash and Interval-Range.&lt;br /&gt;&lt;br /&gt;This will work well for range partitioning where partitioning was done based on date ranges.&lt;br /&gt;&lt;br /&gt;Original Range Partitioning Example:&lt;br /&gt;&lt;br /&gt;CREATE TABLE mrmessin.emp&lt;br /&gt;(&lt;br /&gt; EMPNO                                              NUMBER(4),&lt;br /&gt; ENAME                                              VARCHAR2(30),                &lt;br /&gt; JOB                                                VARCHAR2(20),&lt;br /&gt; MGR                                                NUMBER(4),&lt;br /&gt; HIREDATE                                           DATE,&lt;br /&gt; SAL                                                NUMBER(7,2),&lt;br /&gt; COMM                                               NUMBER(7,2),&lt;br /&gt; DEPTNO                                             NUMBER(2)&lt;br /&gt;)&lt;br /&gt;PARTITION BY RANGE (hiredate)&lt;br /&gt;(  PARTITION part_1999 values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY'))&lt;br /&gt;   PARTITION part_2000 values LESS THAN (TO_DATE('01-JAN-2001','DD-MON-YYYY'))&lt;br /&gt;   PARTITION part_2001 values LESS THAN (TO_DATE('01-JAN-2002','DD-MON-YYYY'))&lt;br /&gt;   PARTITION part_2002 values LESS THAN (TO_DATE('01-JAN-2003','DD-MON-YYYY'))&lt;br /&gt;   PARTITION part_2003 values LESS THAN (TO_DATE('01-JAN-2004','DD-MON-YYYY'))&lt;br /&gt;) ;&lt;br /&gt;&lt;br /&gt;The new interval partitioning can simplify the creation of the table and then partitions created automatically as data is added that would go into the new partitions.&lt;br /&gt;&lt;br /&gt;New Interval Ranger Partitioning Example:&lt;br /&gt;&lt;br /&gt;CREATE TABLE mrmessin.emp&lt;br /&gt;(&lt;br /&gt; EMPNO                                              NUMBER(4),&lt;br /&gt; ENAME                                              VARCHAR2(30),&lt;br /&gt; JOB                                                VARCHAR2(20),&lt;br /&gt; MGR                                                NUMBER(4),&lt;br /&gt; HIREDATE                                           DATE,&lt;br /&gt; SAL                                                NUMBER(7,2),&lt;br /&gt; COMM                                               NUMBER(7,2),&lt;br /&gt; DEPTNO                                             NUMBER(2)&lt;br /&gt;)&lt;br /&gt;PARTITION BY RANGE (hiredate)&lt;br /&gt;INTERVAL (NUMTOYMINTERVAL(1,'YEAR'))&lt;br /&gt;(  PARTITION part_1999 values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY'))&lt;br /&gt;) ;&lt;br /&gt;&lt;br /&gt;Now lets go through an example to see if the partitions are created as the data is inserted.  This will allow us to see how the partitions are created and how oracle names them.  We will also see if we can rename the new partitions to better names after the fact.&lt;br /&gt;&lt;br /&gt;SQL&gt; -- drop the table if it already exists&lt;br /&gt;SQL&gt; drop table mrmessin.emp ;&lt;br /&gt;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- create a interval partition table.&lt;br /&gt;SQL&gt; -- we will use the definition of the scott.emp table&lt;br /&gt;SQL&gt; CREATE TABLE mrmessin.emp&lt;br /&gt;  2  (&lt;br /&gt;  3   EMPNO                                     NUMBER(4),&lt;br /&gt;  4   ENAME                                     VARCHAR2(30),&lt;br /&gt;  5   JOB                                       VARCHAR2(20),&lt;br /&gt;  6   MGR                                       NUMBER(4),&lt;br /&gt;  7   HIREDATE                                         DATE,&lt;br /&gt;  8   SAL                                       NUMBER(7,2),&lt;br /&gt;  9   COMM                                      NUMBER(7,2),&lt;br /&gt; 10   DEPTNO                                    NUMBER(2)&lt;br /&gt; 11  )&lt;br /&gt; 12  PARTITION BY RANGE (hiredate)&lt;br /&gt; 13  INTERVAL (NUMTOYMINTERVAL(1,'YEAR'))&lt;br /&gt; 14  (&lt;br /&gt; 15    PARTITION part_1999 values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY'))&lt;br /&gt; 16  ) ;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- add a primary key to the partitioned table&lt;br /&gt;SQL&gt; alter table mrmessin.emp add constraint emp_empno_pk primary key (empno) disable ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- create the unique index for our primary key&lt;br /&gt;SQL&gt; create unique index mrmessin.emp_empno_pk on mrmessin.emp (empno) tablespace users ;&lt;br /&gt;&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- enable our primary key&lt;br /&gt;SQL&gt; alter table mrmessin.emp enable primary key using index ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- gather stats&lt;br /&gt;SQL&gt; EXEC DBMS_STATS.gather_table_stats('MRMESSIN','EMP') ;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- take a look at the partitions of the table&lt;br /&gt;SQL&gt; select table_owner, table_name, partition_name, tablespace_name, num_rows&lt;br /&gt;  2  from dba_tab_partitions&lt;br /&gt;  3  where table_name = 'EMP' ;&lt;br /&gt;&lt;br /&gt;TABLE_OWNER                    TABLE_NAME                                      &lt;br /&gt;------------------------------ ------------------------------                  &lt;br /&gt;PARTITION_NAME                 TABLESPACE_NAME                  NUM_ROWS       &lt;br /&gt;------------------------------ ------------------------------ ----------       &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;PART_1999                      USERS                                   0       &lt;br /&gt;                                                                               &lt;br /&gt;&lt;br /&gt;SQL&gt; -- let insert some data for a partition.&lt;br /&gt;SQL&gt; insert into mrmessin.emp values (1, 'Mike Messina', 'CEO', 1, to_date('15-NOV-1999', 'DD-MON-YYYY'), 10000, 1000, 1) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into mrmessin.emp values (2, 'Joe Messina', 'COO', 1, to_date('10-JAN-2000', 'DD-MON-YYYY'), 10000, 1000, 1) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- gather stats again&lt;br /&gt;SQL&gt; EXEC DBMS_STATS.gather_table_stats('MRMESSIN','EMP') ;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- take a look at the partitions of the table&lt;br /&gt;SQL&gt; select table_owner, table_name, partition_name, tablespace_name, num_rows&lt;br /&gt;  2  from dba_tab_partitions&lt;br /&gt;  3  where table_name = 'EMP' ;&lt;br /&gt;&lt;br /&gt;TABLE_OWNER                    TABLE_NAME                                      &lt;br /&gt;------------------------------ ------------------------------                  &lt;br /&gt;PARTITION_NAME                 TABLESPACE_NAME                  NUM_ROWS       &lt;br /&gt;------------------------------ ------------------------------ ----------       &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;SYS_P46                        USERS                                   1       &lt;br /&gt;                                                                               &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;PART_1999                      USERS                                   1       &lt;br /&gt;                                                                               &lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- insert some more data that should cause more partitions to be created&lt;br /&gt;SQL&gt; insert into mrmessin.emp values (3, 'Frank Messina', 'CIO', 1, to_date('12-DEC-2001', 'DD-MON-YYYY'), 10000, 1000, 1) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into mrmessin.emp values (4, 'Joe Joe Shamo', 'Bouncer', 1, to_date('14-FEB-2002', 'DD-MON-YYYY'), 1000, 100, 1) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into mrmessin.emp values (5, 'Mixer Man', 'Bar Tender', 1, to_date('04-APR-2003', 'DD-MON-YYYY'), 1000, 100, 1) ;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit ;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- gather stats again&lt;br /&gt;SQL&gt; EXEC DBMS_STATS.gather_table_stats('MRMESSIN','EMP') ;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; -- take a look at the partitions of the table&lt;br /&gt;SQL&gt; select table_owner, table_name, partition_name, tablespace_name, num_rows&lt;br /&gt;  2  from dba_tab_partitions&lt;br /&gt;  3  where table_name = 'EMP' ;&lt;br /&gt;&lt;br /&gt;TABLE_OWNER                    TABLE_NAME                                      &lt;br /&gt;------------------------------ ------------------------------                  &lt;br /&gt;PARTITION_NAME                 TABLESPACE_NAME                  NUM_ROWS       &lt;br /&gt;------------------------------ ------------------------------ ----------       &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;SYS_P46                        USERS                                   1       &lt;br /&gt;                                                                               &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;SYS_P47                        USERS                                   1       &lt;br /&gt;                                                                               &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;SYS_P48                        USERS                                   1       &lt;br /&gt;                                                                               &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;SYS_P49                        USERS                                   1       &lt;br /&gt;                                                                               &lt;br /&gt;MRMESSIN                       EMP                                             &lt;br /&gt;PART_1999                      USERS                                   1                                                                                    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table mrmessin.emp rename partition sys_p46 to part_2000 ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table mrmessin.emp rename partition sys_p47 to part_2001 ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table mrmessin.emp rename partition sys_p48 to part_2002 ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter table mrmessin.emp rename partition sys_p49 to part_2003 ;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; select table_owner, table_name, partition_name, tablespace_name, num_rows&lt;br /&gt;  2  from dba_tab_partitions&lt;br /&gt;  3  where table_name = 'EMP' ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TABLE_OWNER                    TABLE_NAME&lt;br /&gt;------------------------------ ------------------------------&lt;br /&gt;PARTITION_NAME                 TABLESPACE_NAME                  NUM_ROWS&lt;br /&gt;------------------------------ ------------------------------ ---------&lt;br /&gt;MRMESSIN                       EMP&lt;br /&gt;PART_2000                      USERS                                   1&lt;br /&gt;&lt;br /&gt;MRMESSIN                       EMP&lt;br /&gt;PART_2001                      USERS                                   1&lt;br /&gt;&lt;br /&gt;MRMESSIN                       EMP&lt;br /&gt;PART_2002                      USERS                                   1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MRMESSIN                       EMP&lt;br /&gt;PART_2003                      USERS                                   1&lt;br /&gt;&lt;br /&gt;MRMESSIN                       EMP&lt;br /&gt;PART_1999                      USERS                                   1&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Interval Partitioning provides a huge boost in partition management.  This makes implementing partitioning much more attractive to those DBAs that have very full plates making partition maintenance more automatic and reducing our DBA maintenance activities.  All other activity appears to match normal range partitioning keeping all the other benefits of range partitioning.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-3617723361165440707?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/3617723361165440707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=3617723361165440707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3617723361165440707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3617723361165440707'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/oracle-11g-interval-partitioning.html' title='Oracle 11g Interval Partitioning'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-7031853663567121661</id><published>2008-02-21T19:25:00.000-05:00</published><updated>2008-02-21T19:46:22.905-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 11g REF Partitioning'/><title type='text'>Oracle 11g REF Partitioning</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;Oracle REF partitioning is a new partitioning feature with the 11g version of the Oracle database.  REF Partitioning is the ability to partition a table based on the foreign key parent-child relationship.  In REF partitioning the partitioning key of the child table is inherited from the parent table.  REF partitioning also has all partition maintenance operations that change the logical shape of the parent table into the child table.  REF Partitioning also improves performance for joins between the parent and child table by enabling partition-wise joins.&lt;br /&gt;&lt;br /&gt;Ref partitioning can not be used when the parent table is partitioned using range interval partitioning or virtual column partitioning.  The following message will happen upon attempt to create the partitioned table with ref partitioning.&lt;br /&gt;&lt;br /&gt;CREATE TABLE order_items&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-14659: Partitioning method of the parent table is not supported&lt;br /&gt;&lt;br /&gt;Another oddity found in this test was that if I created a partitioned index on the parent table with parallel I could not create the child table with ref partitioning as it got an ORA-0600, however if I created the index without parallel the child table with ref partitioning created ok.  To get around this issue I created the partitioned index on the parent table after creating the child table with the ref partitioning.&lt;br /&gt;&lt;br /&gt;For the basis as an example lets use the OE.ORDERS and OE.ORDER_ITEMS so create our own versions of the tables insert records where the rows in both sets are exactly the same.  This will allow the comparison of a query that could be used against both sets of tables for a comparison.  The original tables from OE schema will remain unchanged.  For the copies for the partitioning testing we will use a range interval partition for the orders table and a ref partition for the order_items table.&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;Create the tables and indexes&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;CREATE TABLE orders&lt;br /&gt;( order_id     NUMBER(12)   CONSTRAINT orders_order_id_nn    NOT NULL,&lt;br /&gt;  order_date   DATE         CONSTRAINT orders_order_date_nn  NOT NULL,&lt;br /&gt;  order_mode   VARCHAR2(8),&lt;br /&gt;  customer_id  NUMBER(6)    CONSTRAINT orders_customer_id_nn NOT NULL,&lt;br /&gt;  order_status VARCHAR2(2),&lt;br /&gt;  order_total  NUMBER(8,2),&lt;br /&gt;  sales_rep_id NUMBER(6),&lt;br /&gt;  promotion_id NUMBER(6),&lt;br /&gt; CONSTRAINT orders_order_id_pk PRIMARY KEY (order_id)&lt;br /&gt;)&lt;br /&gt;PARTITION BY RANGE (order_date)&lt;br /&gt;--INTERVAL (NUMTOYMINTERVAL(1,'month'))&lt;br /&gt;( PARTITION p_pre_1999 VALUES LESS THAN (TO_DATE('01-JAN-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_JAN_1999 VALUES LESS THAN (TO_DATE('01-FEB-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_FEB_1999 VALUES LESS THAN (TO_DATE('01-MAR-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_MAR_1999 VALUES LESS THAN (TO_DATE('01-APR-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_APR_1999 VALUES LESS THAN (TO_DATE('01-MAY-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_MAY_1999 VALUES LESS THAN (TO_DATE('01-JUN-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_JUN_1999 VALUES LESS THAN (TO_DATE('01-JUL-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_JUL_1999 VALUES LESS THAN (TO_DATE('01-AUG-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_AUG_1999 VALUES LESS THAN (TO_DATE('01-SEP-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_SEP_1999 VALUES LESS THAN (TO_DATE('01-OCT-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_OCT_1999 VALUES LESS THAN (TO_DATE('01-NOV-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_NOV_1999 VALUES LESS THAN (TO_DATE('01-DEC-1999','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_DEC_1999 VALUES LESS THAN (TO_DATE('01-JAN-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_JAN_2000 VALUES LESS THAN (TO_DATE('01-FEB-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_FEB_2000 VALUES LESS THAN (TO_DATE('01-MAR-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_MAR_2000 VALUES LESS THAN (TO_DATE('01-APR-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_APR_2000 VALUES LESS THAN (TO_DATE('01-MAY-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_MAY_2000 VALUES LESS THAN (TO_DATE('01-JUN-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_JUN_2000 VALUES LESS THAN (TO_DATE('01-JUL-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_JUL_2000 VALUES LESS THAN (TO_DATE('01-AUG-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_AUG_2000 VALUES LESS THAN (TO_DATE('01-SEP-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_SEP_2000 VALUES LESS THAN (TO_DATE('01-OCT-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_OCT_2000 VALUES LESS THAN (TO_DATE('01-NOV-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_NOV_2000 VALUES LESS THAN (TO_DATE('01-DEC-2000','dd-MON-yyyy')),&lt;br /&gt;  PARTITION p_DEC_2000 VALUES LESS THAN (TO_DATE('01-JAN-2001','dd-MON-yyyy'))&lt;br /&gt;)&lt;br /&gt;PARALLEL ;&lt;br /&gt;&lt;br /&gt;CREATE TABLE order_items&lt;br /&gt;( order_id     NUMBER(12)   CONSTRAINT oitems_order_id_nn     NOT NULL,&lt;br /&gt;  line_item_id NUMBER(3)    CONSTRAINT oitems_line_item_id_nn NOT NULL,&lt;br /&gt;  product_id   NUMBER(6)    CONSTRAINT oitems_product_id_nn   NOT NULL,&lt;br /&gt;  unit_price   NUMBER(8)    CONSTRAINT oitems_unit_price_nn   NOT NULL,&lt;br /&gt;  quantity     NUMBER(8,2)  CONSTRAINT oitems_quantity_nn     NOT NULL,&lt;br /&gt;  sales_amount NUMBER(12,2) CONSTRAINT oitems_sales_amount_nn NOT NULL,&lt;br /&gt;  CONSTRAINT order_items_orders_fk&lt;br /&gt;  FOREIGN KEY (order_id) REFERENCES orders(order_id)&lt;br /&gt;)&lt;br /&gt;PARTITION BY REFERENCE (order_items_orders_fk)&lt;br /&gt;PARALLEL ;&lt;br /&gt;&lt;br /&gt;CREATE UNIQUE INDEX ORDER_ITEMS_PK&lt;br /&gt; ON ORDER_ITEMS (ORDER_ID, LINE_ITEM_ID)&lt;br /&gt;PARALLEL ;&lt;br /&gt;&lt;br /&gt;-- have to create this index with parallel after the ref partition&lt;br /&gt;-- table is created to avoid ORA-0600.&lt;br /&gt;CREATE INDEX ORDERS_ORDER_DATE_NU&lt;br /&gt; ON ORDERS (ORDER_DATE, ORDER_ID)&lt;br /&gt;LOCAL&lt;br /&gt;( PARTITION p_pre_1999,&lt;br /&gt;  PARTITION p_JAN_1999,&lt;br /&gt;  PARTITION p_FEB_1999,&lt;br /&gt;  PARTITION p_MAR_1999,&lt;br /&gt;  PARTITION p_APR_1999,&lt;br /&gt;  PARTITION p_MAY_1999,&lt;br /&gt;  PARTITION p_JUN_1999,&lt;br /&gt;  PARTITION p_JUL_1999,&lt;br /&gt;  PARTITION p_AUG_1999,&lt;br /&gt;  PARTITION p_SEP_1999,&lt;br /&gt;  PARTITION p_OCT_1999,&lt;br /&gt;  PARTITION p_NOV_1999,&lt;br /&gt;  PARTITION p_DEC_1999,&lt;br /&gt;  PARTITION p_JAN_2000,&lt;br /&gt;  PARTITION p_FEB_2000,&lt;br /&gt;  PARTITION p_MAR_2000,&lt;br /&gt;  PARTITION p_APR_2000,&lt;br /&gt;  PARTITION p_MAY_2000,&lt;br /&gt;  PARTITION p_JUN_2000,&lt;br /&gt;  PARTITION p_JUL_2000,&lt;br /&gt;  PARTITION p_AUG_2000,&lt;br /&gt;  PARTITION p_SEP_2000,&lt;br /&gt;  PARTITION p_OCT_2000,&lt;br /&gt;  PARTITION p_NOV_2000,&lt;br /&gt;  PARTITION p_DEC_2000&lt;br /&gt;)&lt;br /&gt;PARALLEL ;&lt;br /&gt;-- Populate the new partitioned tables with the same data&lt;br /&gt;-- from the original tables&lt;br /&gt;insert into orders select * from oe.orders ;&lt;br /&gt;commit ;&lt;br /&gt;&lt;br /&gt;insert into order_items&lt;br /&gt;select order_id, line_item_id, product_id, unit_price, quantity, (unit_price*quantity) sales_amount&lt;br /&gt;from oe.order_items ;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;execute dbms_stats.gather_table_stats ('MRMESSIN','ORDERS') ;&lt;br /&gt;execute dbms_stats.gather_table_stats ('MRMESSIN','ORDER_ITEMS') ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Test the Outcome&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Execution One&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; set autotrace on&lt;br /&gt;SQL&gt; SELECT TO_DATE(to_char(o.order_date, 'DD-MON-YYYY'), 'DD-MON-YYYY') order_date, sum(oi.sales_amount) sum_sales&lt;br /&gt;  2  FROM oe.orders o,&lt;br /&gt;  3    oe.order_items oi&lt;br /&gt;  4  WHERE o.order_id = oi.order_id&lt;br /&gt;  5    AND o.order_date BETWEEN TO_DATE('01-JAN-1999','DD-MON-YYYY')&lt;br /&gt;  6                 AND TO_DATE('01-MAY-1999','DD-MON-YYYY')&lt;br /&gt;  7  GROUP BY order_date&lt;br /&gt;  8  ORDER BY order_date ;&lt;br /&gt;&lt;br /&gt;ORDER_DAT  SUM_SALES                                                      &lt;br /&gt;--------- ----------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;26-FEB-99  3322700.8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;27-FEB-99   526310.4                                   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;11-MAR-99  1688284.8 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;12-MAR-99    2330752                                   &lt;br /&gt;13-MAR-99     952000 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;20-MAR-99    61651.2 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;20-MAR-99    1010368&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;29-MAR-99   345427.2 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;29-MAR-99      12288                    &lt;br /&gt;11-APR-99      52352 &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;10 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.01&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;Plan hash value: 795276733     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;------------------------------------------------------------------------------------------------------                                                                                                 &lt;br /&gt; Id   Operation                         Name               Rows   Bytes  Cost (%CPU) Time                                                                                                      &lt;br /&gt;------------------------------------------------------------------------------------------------------                                                                                                 &lt;br /&gt;   0  SELECT STATEMENT                                         1     24      6  (17) 00:00:01                                                                                                  &lt;br /&gt;   1   SORT ORDER BY                                           1     24      6  (17) 00:00:01                                                                                                  &lt;br /&gt;   2    SORT GROUP BY NOSORT                                   1     24      6  (17) 00:00:01                                                                                                  &lt;br /&gt;*  3     FILTER                                                                                                                                                                                &lt;br /&gt;   4      NESTED LOOPS                                                                                                                                                                         &lt;br /&gt;   5       NESTED LOOPS                                        2     48      5   (0) 00:00:01                                                                                                  &lt;br /&gt;   6        TABLE ACCESS BY INDEX ROWID ORDERS                 1     15      2   (0) 00:00:01                                                                                                  &lt;br /&gt;*  7         INDEX RANGE SCAN           ORD_ORDER_DATE_IX      1             1   (0) 00:00:01                                                                                                  &lt;br /&gt;*  8        INDEX RANGE SCAN            ITEM_ORDER_IX          6             1   (0) 00:00:01                                                                                                  &lt;br /&gt;   9       TABLE ACCESS BY INDEX ROWID  ORDER_ITEMS            6     54      3   (0) 00:00:01                                                                                                  &lt;br /&gt;------------------------------------------------------------------------------------------------------                                                                                                                                                                                                                                                                                                        &lt;br /&gt;Predicate Information (identified by operation id): &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;---------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;   3 - filter(TIMESTAMP' 1999-01-01 00:00:00'&lt;=TIMESTAMP' 1999-05-01 00:00:00')                                                                                        &lt;br /&gt;   7 - access("O"."ORDER_DATE"&gt;=TIMESTAMP' 1999-01-01 00:00:00' AND "O"."ORDER_DATE"&lt;=TIMESTAMP' 1999-05-01 00:00:00') &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;   8 - access("O"."ORDER_ID"="OI"."ORDER_ID")&lt;br /&gt; &lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          0  recursive calls &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          0  db block gets                            &lt;br /&gt;        875  consistent gets &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          0  physical reads &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          0  redo size                                                            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        667  bytes sent via SQL*Net to client &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        396  bytes received via SQL*Net from client &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          2  SQL*Net roundtrips to/from client &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          1  sorts (memory)      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          0  sorts (disk)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;         10  rows processed                                            &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;em&gt;Execution Two&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;SQL&gt; SELECT o.order_date, sum(oi.sales_amount) sum_sales&lt;br /&gt;  2  FROM orders o,&lt;br /&gt;  3    order_items oi&lt;br /&gt;  4  WHERE o.order_date BETWEEN TO_DATE('01-JAN-1999','DD-MON-YYYY')&lt;br /&gt;  5                   AND TO_DATE('01-MAY-1999','DD-MON-YYYY')&lt;br /&gt;  6    AND o.order_id = oi.order_id&lt;br /&gt;  7  GROUP BY order_date&lt;br /&gt;  8  ORDER BY order_date ;&lt;br /&gt;&lt;br /&gt;ORDER_DAT SUM_SALES                                                                    &lt;br /&gt;--------- ----------            &lt;br /&gt;26-FEB-99  3322700.8 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;27-FEB-99   526310.4 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;11-MAR-99  1688284.8 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;12-MAR-99    2330752 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;13-MAR-99     952000 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;20-MAR-99    61651.2 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;20-MAR-99    1010368 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;29-MAR-99   345427.2 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;29-MAR-99      12288                               &lt;br /&gt;11-APR-99      52352 &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;10 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.07&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;Plan hash value: 1413427856&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;----------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt; Id   Operation                             Name                  Rows   Bytes  Cost (%CPU) Time      Pstart Pstop     TQ  IN-OUT PQ Distrib                                              &lt;br /&gt;----------------------------------------------------------------------------------------------------------------------------------------------------------                                             &lt;br /&gt;   0  SELECT STATEMENT                                                5    105     14  (15) 00:00:01                                                                                      &lt;br /&gt;   1   PX COORDINATOR                                                                                                                                                                     &lt;br /&gt;   2    PX SEND QC (ORDER)                  :TQ10002                  5    105     14  (15) 00:00:01                 Q1,02  P-&gt;S  QC (ORDER)                                              &lt;br /&gt;   3     SORT GROUP BY                                                5    105     14  (15) 00:00:01                 Q1,02  PCWP                                                          &lt;br /&gt;   4      PX RECEIVE                                                  5    105     14  (15) 00:00:01                 Q1,02  PCWP                                                          &lt;br /&gt;   5       PX SEND RANGE                    :TQ10001                  5    105     14  (15) 00:00:01                 Q1,01  P-&gt;P  RANGE                                                   &lt;br /&gt;   6        SORT GROUP BY                                             5    105     14  (15) 00:00:01                 Q1,01  PCWP                                                          &lt;br /&gt;*  7         HASH JOIN                                             1115  23415     13   (8) 00:00:01                 Q1,01  PCWP                                                          &lt;br /&gt;   8          PX RECEIVE                                            176   2112      1   (0) 00:00:01                 Q1,01  PCWP                                                          &lt;br /&gt;   9           PX SEND BROADCAST            :TQ10000                176   2112      1   (0) 00:00:01                 Q1,00  P-&gt;P  BROADCAST                                               &lt;br /&gt;  10            PX PARTITION RANGE ITERATOR                         176   2112      1   (0) 00:00:01      2      6   Q1,00  PCWC                                                          &lt;br /&gt;* 11             INDEX RANGE SCAN           ORDERS_ORDER_DATE_NU    176   2112      1   (0) 00:00:01      2      6   Q1,00  PCWP                                                          &lt;br /&gt;  12          PX BLOCK ITERATOR                                   21280    187K    11   (0) 00:00:01      1     25   Q1,01  PCWC                                                          &lt;br /&gt;  13           TABLE ACCESS FULL            ORDER_ITEMS           21280    187K    11   (0) 00:00:01      1     25   Q1,01  PCWP                                                          &lt;br /&gt;----------------------------------------------------------------------------------------------------------------------------------------------------------                                             &lt;br /&gt;                                                                                                                                                                                                       &lt;br /&gt;Predicate Information (identified by operation id): &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;---------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;   7 - access("O"."ORDER_ID"="OI"."ORDER_ID")                 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;  11 - access("O"."ORDER_DATE"&gt;=TO_DATE(' 1999-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "O"."ORDER_DATE"&lt;=TO_DATE(' 1999-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;         45  reursive calls                       &lt;br /&gt;          3  db block gets &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        357  consistent gets &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          0  physical reads                      &lt;br /&gt;        664  redo size&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        683  bytes sent via SQL*Net to client            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        396  bytes received via SQL*Net from client  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;          2  SQL*Net roundtrips to/from client &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;         34  sorts (memory)   &lt;br /&gt;          0  sorts (disk) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;         10  rows processed                        &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;em&gt;Execution Three&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;SQL&gt; set linesize 200&lt;br /&gt;SQL&gt; set timing on&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; spool ref_partitioning_test.out&lt;br /&gt;SQL&gt;&lt;br /&gt;SQL&gt; set autotrace on&lt;br /&gt;SQL&gt; SELECT TO_DATE(to_char(o.order_date, 'DD-MON-YYYY'), 'DD-MON-YYYY') order_date, sum(oi.sales_am&lt;br /&gt;  2  FROM oe.orders o,&lt;br /&gt;  3       oe.order_items oi&lt;br /&gt;  4  WHERE o.order_id = oi.order_id&lt;br /&gt;  5    AND o.order_date BETWEEN TO_DATE('01-JAN-1999','DD-MON-YYYY')&lt;br /&gt;  6                       AND TO_DATE('01-MAY-1999','DD-MON-YYYY')&lt;br /&gt;  7  GROUP BY order_date&lt;br /&gt;  8  ORDER BY order_date ;&lt;br /&gt;&lt;br /&gt;ORDER_DAT  SUM_SALES&lt;br /&gt;--------- ----------&lt;br /&gt;26-FEB-99  6645401.6&lt;br /&gt;27-FEB-99  1052620.8&lt;br /&gt;11-MAR-99  3376569.6&lt;br /&gt;12-MAR-99    4661504&lt;br /&gt;13-MAR-99    1904000&lt;br /&gt;20-MAR-99   123302.4&lt;br /&gt;20-MAR-99    2020736&lt;br /&gt;29-MAR-99   690854.4&lt;br /&gt;29-MAR-99      24576&lt;br /&gt;11-APR-99     104704&lt;br /&gt;&lt;br /&gt;10 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.04&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 795276733&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt; Id   Operation                         Name               Rows   Bytes  Cost (%CPU) Time    &lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;   0  SELECT STATEMENT                                         1     24      6  (17) 00:00:01&lt;br /&gt;   1   SORT ORDER BY                                           1     24      6  (17) 00:00:01&lt;br /&gt;   2    SORT GROUP BY NOSORT                                   1     24      6  (17) 00:00:01&lt;br /&gt;*  3     FILTER                                                                              &lt;br /&gt;   4      NESTED LOOPS                                                                       &lt;br /&gt;   5       NESTED LOOPS                                        2     48      5   (0) 00:00:01&lt;br /&gt;   6        TABLE ACCESS BY INDEX ROWID ORDERS                 1     15      2   (0) 00:00:01&lt;br /&gt;*  7         INDEX RANGE SCAN           ORD_ORDER_DATE_IX      1             1   (0) 00:00:01&lt;br /&gt;*  8        INDEX RANGE SCAN            ITEM_ORDER_IX          6             1   (0) 00:00:01&lt;br /&gt;   9       TABLE ACCESS BY INDEX ROWID  ORDER_ITEMS            6     54      3   (0) 00:00:01&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;   3 - filter(TIMESTAMP' 1999-01-01 00:00:00'&lt;=TIMESTAMP' 1999-05-01 00:00:00')&lt;br /&gt;   7 - access("O"."ORDER_DATE"&gt;=TIMESTAMP' 1999-01-01 00:00:00' AND&lt;br /&gt;              "O"."ORDER_DATE"&lt;=TIMESTAMP' 1999-05-01 00:00:00')&lt;br /&gt;   8 - access("O"."ORDER_ID"="OI"."ORDER_ID")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;          0  recursive calls&lt;br /&gt;          0  db block gets&lt;br /&gt;       1724  consistent gets&lt;br /&gt;          0  physical reads&lt;br /&gt;        116  redo size&lt;br /&gt;        669  bytes sent via SQL*Net to client&lt;br /&gt;        396  bytes received via SQL*Net from client&lt;br /&gt;          2  SQL*Net roundtrips to/from client&lt;br /&gt;          1  sorts (memory)&lt;br /&gt;          0  sorts (disk)&lt;br /&gt;         10  rows processed&lt;br /&gt;&lt;br /&gt;SQL&gt; SELECT o.order_date, sum(oi.sales_amount) sum_sales&lt;br /&gt;  2  FROM orders o,&lt;br /&gt;  3       order_items oi&lt;br /&gt;  4  WHERE o.order_date BETWEEN TO_DATE('01-JAN-1999','DD-MON-YYYY')&lt;br /&gt;  5                         AND TO_DATE('01-MAY-1999','DD-MON-YYYY')&lt;br /&gt;  6    AND o.order_id = oi.order_id&lt;br /&gt;  7  GROUP BY order_date&lt;br /&gt;  8  ORDER BY order_date ;&lt;br /&gt;&lt;br /&gt;ORDER_DAT  SUM_SALES&lt;br /&gt;--------- ----------&lt;br /&gt;26-FEB-99  6645401.6&lt;br /&gt;27-FEB-99  1052620.8&lt;br /&gt;11-MAR-99  3376569.6&lt;br /&gt;12-MAR-99    4661504&lt;br /&gt;13-MAR-99    1904000&lt;br /&gt;20-MAR-99   123302.4&lt;br /&gt;20-MAR-99    2020736&lt;br /&gt;29-MAR-99   690854.4&lt;br /&gt;29-MAR-99      24576&lt;br /&gt;11-APR-99     104704&lt;br /&gt;&lt;br /&gt;10 rows selected.&lt;br /&gt;&lt;br /&gt;Elapsed: 00:00:00.07&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 1413427856&lt;br /&gt;------------------------------------------------------------------------------------ Id   Operation                             Name                  Rows   Bytes  Cost (%CPU) Time      Pstart Pstop   &lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;   0  SELECT STATEMENT                                                5    105     21  (10) 00:00:01                 &lt;br /&gt;   1   PX COORDINATOR                                                                                                &lt;br /&gt;   2    PX SEND QC (ORDER)                  :TQ10002                  5    105     21  (10) 00:00:01               &lt;br /&gt;   3     SORT GROUP BY                                                5    105     21  (10) 00:00:01               &lt;br /&gt;   4      PX RECEIVE                                                  5    105     21  (10) 00:00:01               &lt;br /&gt;   5       PX SEND RANGE                    :TQ10001                  5    105     21  (10) 00:00:01               &lt;br /&gt;   6        SORT GROUP BY                                             5    105     21  (10) 00:00:01               &lt;br /&gt;*  7         HASH JOIN                                             2231  46851     20   (5) 00:00:01               &lt;br /&gt;   8          PX RECEIVE                                            352   4224      1   (0) 00:00:01               &lt;br /&gt;   9           PX SEND BROADCAST            :TQ10000                352   4224      1   (0) 00:00:01               &lt;br /&gt;  10            PX PARTITION RANGE ITERATOR                         352   4224      1   (0) 00:00:01      2      6 &lt;br /&gt;* 11             INDEX RANGE SCAN           ORDERS_ORDER_DATE_NU    352   4224      1   (0) 00:00:01      2&lt;br /&gt;  12          PX BLOCK ITERATOR                                   42560    374K    18   (0) 00:00:01      1     25 &lt;br /&gt;  13           TABLE ACCESS FULL            ORDER_ITEMS           42560    374K    18   (0) 00:00:01      1     25&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;   7 - access("O"."ORDER_ID"="OI"."ORDER_ID")&lt;br /&gt;  11 - access("O"."ORDER_DATE"&gt;=TO_DATE(' 1999-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "O"."O&lt;br /&gt;              'syyyy-mm-dd hh24:mi:ss'))&lt;br /&gt; &lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;         45  recursive calls&lt;br /&gt;          3  db block gets&lt;br /&gt;        481  consistent gets&lt;br /&gt;          0  physical reads&lt;br /&gt;        664  redo size&lt;br /&gt;        685  bytes sent via SQL*Net to client&lt;br /&gt;        396  bytes received via SQL*Net from client&lt;br /&gt;          2  SQL*Net roundtrips to/from client&lt;br /&gt;         34  sorts (memory)&lt;br /&gt;          0  sorts (disk)&lt;br /&gt;         10  rows processed&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Initial tests were done without parallel and did not yield expected results, expected results did not really start to happen until parallel was used and the number of rows in the parent and child tables significantly increased.  Keep in mind that parallel operations increase CPU utilization and therefore a CPU bound system may not encounter the same results.&lt;br /&gt;&lt;br /&gt;Running many tests and increasing the number of rows proportionately in each table with each execution.  As the number of rows in orders and orders items increased the larger the gap in buffer gets to resolve the query.  On a very small table the non-partitioned table used far less resources, as the number of rows increased the closer the buffer gets got until the partitioned table was taking less resources.  Even as the difference in the buffer gets changed as the number of records increased the number of sorts in memory stayed consistent.  Another thing noticed in the testing is that the runtime performance stayed more consistent with the partitioned tables more so the run time increase was lower then with the non-partitioned tables as the number of rows increased.&lt;br /&gt;&lt;br /&gt;This is a nice new partitioning feature for parent-child relationships and initial testing shows this partitioning could have benefits for tables that are large.  Smaller tables did not show any advantages, but the advantages seem to gain as the table sizes/number of rows increases.&lt;br /&gt;&lt;br /&gt;Initial testing has shown that this new Oracle Partitioning Feature is worth the time to do further testing on very large data sets.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-7031853663567121661?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/7031853663567121661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=7031853663567121661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7031853663567121661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/7031853663567121661'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/oracle-11g-ref-partitioning.html' title='Oracle 11g REF Partitioning'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-3910067636016253295</id><published>2008-02-05T20:12:00.000-05:00</published><updated>2008-02-06T17:47:08.074-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Hidden (_) Parameter Values'/><title type='text'>Oracle Hidden (_) Parameter Values</title><content type='html'>&lt;span style="font-family:courier new;"&gt;To query the hidden (_) parameters for an oracle instance use the following, can limit the list using the name or partial of the name of the parameter you are looking for:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set pagesize 60&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set linesize 100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;select a.ksppinm NAME,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;a.ksppdesc DESCRIPTION,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;b.ksppstvl SESSION_VALUE,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;c.ksppstvl SYSTEM_VALUE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;from x$ksppi a,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;x$ksppcv b,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;x$ksppsv c&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;where a.indx = b.indx&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;and a.indx = c.indx&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;and (a.ksppinm like '__%') ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-3910067636016253295?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/3910067636016253295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=3910067636016253295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3910067636016253295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/3910067636016253295'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/oracle-hidden-parameter-values.html' title='Oracle Hidden (_) Parameter Values'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8219194217827851316</id><published>2008-02-05T19:51:00.000-05:00</published><updated>2008-02-06T17:42:46.991-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle see who has been granted SYSDBA'/><title type='text'>Oracle see who has been granted SYSDBA</title><content type='html'>&lt;span style="font-family:courier new;"&gt;In Oracle to query who has been granted SYSDBA is done by the v$pwfile_users&lt;br /&gt;&lt;br /&gt;SQL&gt; select * from v$pwfile_users;&lt;br /&gt;USERNAME SYSDB SYSOP SYSAS&lt;br /&gt;-------- ----- ----- -----&lt;br /&gt;SYS      TRUE  TRUE  FALSE&lt;br /&gt;MRMESSIN TRUE  FALSE FALSE&lt;br /&gt;SQL&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8219194217827851316?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8219194217827851316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8219194217827851316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8219194217827851316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8219194217827851316'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/oracle-see-who-has-been-granted-sysdba.html' title='Oracle see who has been granted SYSDBA'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-806279406279941826</id><published>2008-02-02T12:33:00.000-05:00</published><updated>2008-03-28T11:39:08.682-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RMAN Backup using a Wallet for Authentication'/><title type='text'>RMAN Backup using a Wallet for Authentication</title><content type='html'>&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;RMAN Backup using a Wallet for Authentication&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;Ever want to not have passwords in you RMAN backup scripts?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;Oracle Wallet will provide a way to connect to the RMAN repository without having to create a way to script in a password.&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;1. setup password files that allow and disallow logging in with SYSDBA (This is optional and only if you want to be able to control remote login as sysdba)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;a. cd $ORACLE_HOME/dbs&lt;br /&gt;b. export ORACLE_SID=rman&lt;dbname&gt;&lt;br /&gt;c. orapwd file=orapwdbname&lt;dbname&gt;.nosysdba password=&lt;sys&gt; nosysdba=y&lt;br /&gt;d. orapwd file=orapwdbname&lt;dbname&gt;.sysdba password=&lt;sys&gt; nosysdba=n&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Add processes to enable sysdba for backup and disable when backup is complete (optional only if you want to control when remote sysdba connections are allowed)&lt;br /&gt;a. enable sysdba logins&lt;br /&gt;cp –p orapwdbname&lt;dbname&gt;.sysdba orapwdbname&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;dbname&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;b. disable sysdba logins&lt;br /&gt;cp –p orapwdbname&lt;dbname&gt;.nosysdba orapwdbname&lt;dbname&gt;&lt;br /&gt;&lt;br /&gt;* For our example we will assume that we will have it on and it is left on, but this will give the option to allow and disallow sysdba connections as needed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Avoid having to pass username and password at the command line.&lt;br /&gt;a. add TNS Alias to tnsnames.ora file for RMANSYS connections&lt;br /&gt;&lt;br /&gt;RMANSYS =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = &lt;full&gt;)(PORT = 1521))&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SERVER = DEDICATED)&lt;br /&gt;(SERVICE_NAME = rman)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;b. Create Wallet&lt;br /&gt;cd $ORACLE_HOME/network/admin&lt;br /&gt;mkstore –wrl $ORACLE_HOME/network/admin –create&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;* Enter password for wallet (will have to be entered 2 times for confirmation)&lt;br /&gt;* Creates 2 files ewallet.p12 and cwallet.sso&lt;br /&gt;&lt;br /&gt;c. Create credential for Wallet&lt;br /&gt;mkstore -wrl $ORACLE_HOME/network/admin –createCredential rmansys rman &lt;rman&gt;&lt;br /&gt;&lt;br /&gt;* should see something like Create credential oracle.security.client.connect_string1&lt;br /&gt;&lt;br /&gt;d. Edit sqlnet.ora&lt;br /&gt;WALLET_LOCATION =&lt;br /&gt;(SOURCE =&lt;br /&gt;(METHOD = FILE)&lt;br /&gt;(METHOD_DATA =&lt;br /&gt;(DIRECTORY = &lt;$ORACLE_HOME*&gt;/network/admin)))&lt;br /&gt;&lt;br /&gt;SQLNET.WALLET_OVERRIDE = TRUE&lt;br /&gt;SSL_CLIENT_AUTHENTICATION = FALSE&lt;br /&gt;SSL_VERSION = 0&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;* Must put in path for $ORACLE_HOME&lt;br /&gt;&lt;br /&gt;e. Restart the database listener&lt;br /&gt;lsnrctl stop &lt;listener&gt;&lt;br /&gt;lsnrctl start &lt;listener&gt;&lt;br /&gt;&lt;br /&gt;4. Now you can use the wallet credentials to login as sys.&lt;br /&gt;sqlplus /@RMANSYS&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=trn01&lt;br /&gt;rman target=/ catalog=/@rmansys&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-806279406279941826?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/806279406279941826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=806279406279941826' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/806279406279941826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/806279406279941826'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/rman-backup-using-wallet-for.html' title='RMAN Backup using a Wallet for Authentication'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8585086604702645917</id><published>2008-02-02T12:23:00.000-05:00</published><updated>2008-02-21T20:39:16.593-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Fine Grained Auditing'/><title type='text'>Oracle Fine Grained Auditing</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;Regulations such as HIPPA have placed upon Oracle Database Administrators (DBAs) the need to audit DDL (database schema changes), DML (inserts/updates/deletes) as well as select access to what is considered “protected information”. Auditing changes has always had value and was typical auditing done in most critical databases. Auditing changes would allow information to be gathered to show when a change happened and who made the change. Another audit need has become more critical due to regulations and that is select or read access to “protected information”. Auditing is now required to gather information on when and who read or accessed certain information.&lt;br /&gt;&lt;br /&gt;Oracle auditing has existed in the Oracle database for quite some time and is used to gather information on changes and access to the data in the database. It has provided the ability to audit inserts, updates and deletes on table as well as the ability to audit object creations, modifications and removals as auditing in the database progressed later versions allowed the auditing of selects. Auditing is also able to audit log on and log off from the database and many other operations. However the auditing is always at a high level, what if the need was to only audit under more specific circumstances. To get this level of auditing might require a trigger that must be coded and there fore the code developed and maintained so that some level of criteria could be used to determine if an audit record should be written or not. Oracle Fine Grained Auditing provides the ability to add criteria based auditing to gather information (data) on what has changed or been accessed within the database without the need to write trigger code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Components for FGA&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Oracle FGA is setup and managed though the dbms_fga package and all audit information gathered is accessed via the dba_fga_audit_trail view, the actual sys table that the audit information goes into is fga_log$.&lt;br /&gt;&lt;br /&gt;Examine the definition of the dbms_fga package, the dba_fga_audit_trail view and the sys table fga_log$ as these are the objects that will be used in the management of FGA.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; desc dbms_fga&lt;br /&gt;PROCEDURE ADD_POLICY&lt;br /&gt;Argument Name Type In/Out Default?&lt;br /&gt;------------------------------ ----------------------- ------ --------&lt;br /&gt;OBJECT_SCHEMA VARCHAR2 IN DEFAULT&lt;br /&gt;OBJECT_NAME VARCHAR2 IN&lt;br /&gt;POLICY_NAME VARCHAR2 IN&lt;br /&gt;AUDIT_CONDITION VARCHAR2 IN DEFAULT&lt;br /&gt;AUDIT_COLUMN VARCHAR2 IN DEFAULT&lt;br /&gt;HANDLER_SCHEMA VARCHAR2 IN DEFAULT&lt;br /&gt;HANDLER_MODULE VARCHAR2 IN DEFAULT&lt;br /&gt;ENABLE BOOLEAN IN DEFAULT&lt;br /&gt;STATEMENT_TYPES VARCHAR2 IN DEFAULT&lt;br /&gt;AUDIT_TRAIL BINARY_INTEGER IN DEFAULT&lt;br /&gt;AUDIT_COLUMN_OPTS BINARY_INTEGER IN DEFAULT&lt;br /&gt;PROCEDURE DISABLE_POLICY&lt;br /&gt;Argument Name Type In/Out Default?&lt;br /&gt;------------------------------ ----------------------- ------ --------&lt;br /&gt;OBJECT_SCHEMA VARCHAR2 IN DEFAULT&lt;br /&gt;OBJECT_NAME VARCHAR2 IN&lt;br /&gt;POLICY_NAME VARCHAR2 IN&lt;br /&gt;PROCEDURE DROP_POLICY&lt;br /&gt;Argument Name Type In/Out Default?&lt;br /&gt;------------------------------ ----------------------- ------ --------&lt;br /&gt;OBJECT_SCHEMA VARCHAR2 IN DEFAULT&lt;br /&gt;OBJECT_NAME VARCHAR2 IN&lt;br /&gt;POLICY_NAME VARCHAR2 IN&lt;br /&gt;PROCEDURE ENABLE_POLICY&lt;br /&gt;Argument Name Type In/Out Default?&lt;br /&gt;------------------------------ ----------------------- ------ --------&lt;br /&gt;OBJECT_SCHEMA VARCHAR2 IN DEFAULT&lt;br /&gt;OBJECT_NAME VARCHAR2 IN&lt;br /&gt;POLICY_NAME VARCHAR2 IN&lt;br /&gt;ENABLE BOOLEAN IN DEFAULT&lt;br /&gt;&lt;br /&gt;SQL&gt; desc dba_fga_audit_trail&lt;br /&gt;Name Null? Type&lt;br /&gt;----------------------------------------- -------- ------------------&lt;br /&gt;SESSION_ID NOT NULL NUMBER&lt;br /&gt;TIMESTAMP DATE&lt;br /&gt;DB_USER VARCHAR2(30)&lt;br /&gt;OS_USER VARCHAR2(255)&lt;br /&gt;USERHOST VARCHAR2(128)&lt;br /&gt;CLIENT_ID VARCHAR2(64)&lt;br /&gt;ECONTEXT_ID VARCHAR2(64)&lt;br /&gt;EXT_NAME VARCHAR2(4000)&lt;br /&gt;OBJECT_SCHEMA VARCHAR2(30)&lt;br /&gt;OBJECT_NAME VARCHAR2(128)&lt;br /&gt;POLICY_NAME VARCHAR2(30)&lt;br /&gt;SCN NUMBER&lt;br /&gt;SQL_TEXT NVARCHAR2(2000)&lt;br /&gt;SQL_BIND NVARCHAR2(2000)&lt;br /&gt;COMMENT$TEXT VARCHAR2(4000)&lt;br /&gt;STATEMENT_TYPE VARCHAR2(7)&lt;br /&gt;EXTENDED_TIMESTAMP TIMESTAMP(6) WITH TIME ZONE&lt;br /&gt;PROXY_SESSIONID NUMBER&lt;br /&gt;GLOBAL_UID VARCHAR2(32)&lt;br /&gt;INSTANCE_NUMBER NUMBER&lt;br /&gt;OS_PROCESS VARCHAR2(16)&lt;br /&gt;TRANSACTIONID RAW(8)&lt;br /&gt;STATEMENTID NUMBER&lt;br /&gt;ENTRYID NUMBER&lt;br /&gt;OBJ_EDITION_NAME VARCHAR2(30) &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;SQL&gt; desc sys.fga_log$&lt;br /&gt;Name Null? Type&lt;br /&gt;----------------------------------------- -------- -------------------------&lt;br /&gt;SESSIONID NOT NULL NUMBER&lt;br /&gt;TIMESTAMP# DATE&lt;br /&gt;DBUID VARCHAR2(30)&lt;br /&gt;OSUID VARCHAR2(255)&lt;br /&gt;OSHST VARCHAR2(128)&lt;br /&gt;CLIENTID VARCHAR2(64)&lt;br /&gt;EXTID VARCHAR2(4000)&lt;br /&gt;OBJ$SCHEMA VARCHAR2(30)&lt;br /&gt;OBJ$NAME VARCHAR2(128)&lt;br /&gt;POLICYNAME VARCHAR2(30)&lt;br /&gt;SCN NUMBER&lt;br /&gt;SQLTEXT VARCHAR2(4000)&lt;br /&gt;LSQLTEXT CLOB&lt;br /&gt;SQLBIND VARCHAR2(4000)&lt;br /&gt;COMMENT$TEXT VARCHAR2(4000)&lt;br /&gt;PLHOL LONG&lt;br /&gt;STMT_TYPE NUMBER&lt;br /&gt;NTIMESTAMP# TIMESTAMP(6)&lt;br /&gt;PROXY$SID NUMBER&lt;br /&gt;USER$GUID VARCHAR2(32)&lt;br /&gt;INSTANCE# NUMBER&lt;br /&gt;PROCESS# VARCHAR2(16)&lt;br /&gt;XID RAW(8)&lt;br /&gt;AUDITID VARCHAR2(64)&lt;br /&gt;STATEMENT NUMBER&lt;br /&gt;ENTRYID NUMBER&lt;br /&gt;DBID NUMBER&lt;br /&gt;LSQLBIND CLOB&lt;br /&gt;OBJ$EDITION VARCHAR2(30)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Auditing Policies&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To implement Oracle FGA for a successful audit trail the audit rules and policies must be determined and documented. The organization must determine the compliance rules that the organization is subject to, such as HIPPA and SOX. Identify the auditing requirements to fulfill the compliance rules such as DDL auditing (create table, alter table/index, drop table/index, insert, update and delete on protected data as well as select/read access to protected data) The organization is also free to add additional auditing for its own internal use potentially for security purposes for use in forensic activities in cases of security breaches or activity monitoring.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Setup FGA&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To setup FGA policies that trigger audit records will need to be defined using policies. The policies will be created based on the audit rules and policies identified that the organization is subject to as well as auditing rule the business has determined itself wants to have possibly for better tracking for security purposes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- drop existing audit policy&lt;br /&gt;execute dbms_fga.drop_policy ('SCOTT','EMP','SALARY_INCREASES') ;&lt;br /&gt;&lt;br /&gt;-- Audit all Salary Changes to EMP&lt;br /&gt;begin&lt;br /&gt;dbms_fga.add_policy(&lt;br /&gt;object_schema =&gt; 'SCOTT',&lt;br /&gt;object_name =&gt; 'EMP',&lt;br /&gt;policy_name =&gt; 'SALARY_INCREASES',&lt;br /&gt;audit_column =&gt; 'SAL',&lt;br /&gt;enable =&gt; true, statement_types =&gt; 'UPDATE', audit_trail =&gt; DBMS_FGA.DB_EXTENDED, audit_column_opts =&gt; DBMS_FGA.ANY_COLUMNS&lt;br /&gt;);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- drop existing audit policy&lt;br /&gt;execute dbms_fga.drop_policy ('SCOTT','EMP','NEW_EMP_HIGH_SALARY') ;&lt;br /&gt;&lt;br /&gt;-- Audit all new employee creations with salary &gt; 2000&lt;br /&gt;begin&lt;br /&gt;dbms_fga.add_policy(&lt;br /&gt;object_schema =&gt; 'SCOTT',&lt;br /&gt;object_name =&gt; 'EMP',&lt;br /&gt;policy_name =&gt; 'NEW_EMP_HIGH_SALARY',&lt;br /&gt;audit_condition =&gt; 'SAL&gt;=2000',&lt;br /&gt;enable =&gt; true, statement_types =&gt; 'INSERT', audit_trail =&gt; DBMS_FGA.DB_EXTENDED, audit_column_opts =&gt; DBMS_FGA.ANY_COLUMNS&lt;br /&gt;);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- drop existing audit policy&lt;br /&gt;execute dbms_fga.drop_policy ('SCOTT','BONUS','BONUS_CHANGES') ;&lt;br /&gt;&lt;br /&gt;-- Audit all changes on BONUS&lt;br /&gt;begin&lt;br /&gt;dbms_fga.add_policy(&lt;br /&gt;object_schema =&gt; 'SCOTT',&lt;br /&gt;object_name =&gt; 'BONUS',&lt;br /&gt;policy_name =&gt; 'BONUS_CHANGES',&lt;br /&gt;enable =&gt; true, statement_types =&gt; 'INSERT,UPDATE,DELETE', audit_trail =&gt; DBMS_FGA.DB_EXTENDED, audit_column_opts =&gt; DBMS_FGA.ANY_COLUMNS&lt;br /&gt;);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;Show Audit Policies &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;set linesize 120&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;set pagesize 50&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;TTITLE 'FGA Policies'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL object_schema &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;FORMAT A10 HEADING 'Schema'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL object_name FORMAT A20 HEADING 'Object Name' WRAP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL policy_name FORMAT A16 HEADING 'Policy Name' WRAP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL policy_text FORMAT A24 HEADING 'Policy Text' WRAP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL policy_column FORMAT A16 HEADING 'Policy Column' WRAP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL enabled FORMAT A05 HEADING 'Enabled'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;COL siud FORMAT A04 HEADING 'SIUD'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;SELECT policy_name, policy_text, policy_column, enabled, object_schema, object_name, &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;DECODE(sel,'YES','Y','N')  DECODE(ins,'YES','Y','N') &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;DECODE(upd,'YES','Y','N')  DECODE(del,'YES','Y','N') siud &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;FROM dba_audit_policies ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;TTITLE OFF&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Show Audit Results&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Using Fine Grained Audit Trail: &lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;set linesize 120&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;set pagesize 50&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;TTITLE 'Fine-Grained Auditing (FGA) Audit Trail'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL auditdate FORMAT A20 HEADING 'Date/Time'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL policy_name FORMAT A16 HEADING 'Policy Name' WRAP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL object_schema FORMAT A10 HEADING 'Schema'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL object_name FORMAT A20 HEADING 'Object Name' WRAP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;COL db_user FORMAT A10 HEADING 'User'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;COL sql_text FORMAT A36 HEADING 'SQL Text' WRAP&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;S&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;ELECT TO_CHAR(timestamp,'mm/dd/yyyy hh24:mi:ss') auditdate,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;db_user,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;object_schema,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;object_name,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;policy_name,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;sql_text&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;FROM dba_fga_audit_trail&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;ORDER BY timestamp ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;TTITLE OFF&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;Could also use the combined audit trail as well to query the FGA Audit Trail this would allow the use of a single query/report for the entire audit trail:&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Combined Audit Trail:&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;SET linesize 120&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;SET pagesize 50&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;TTITLE 'Standard/FGA Audit Trail'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL audittype FORMAT A03 HEADING 'Audit Type'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL db_user FORMAT A10 HEADING 'User'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL object_schema FORMAT A06 HEADING 'Schema'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL object_name FORMAT A20 HEADING 'Object Name' WRAP&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL policy_name FORMAT A16 HEADING 'Policy Name' WRAP&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL auditdate FORMAT A20 HEADING 'Date/Time'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;COL sql_text FORMAT A32 HEADING 'SQL Text' WRAP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;SELECT DECODE(audit_type, 'Fine Grained Audit', 'FGA’, 'Standard Audit', 'STD', 'U')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;auditype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;db_user,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;object_schema,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;object_name,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;policy_name,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;TO_CHAR(extended_timestamp,'mm/dd/yyyy hh24:mi:ss') auditdate,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;sql_text &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;FROM dba_common_audit_trail &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;WHERE db_user NOT IN ('SYS','SYSTEM','DBSNMP','SYSMAN') &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;ORDER BY extended_timestamp, db_user, object_schema, object_name ;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;TTITLE OFF&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Testing Results&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;Wed Jan 30 page 1&lt;br /&gt;FGA Policies&lt;br /&gt;&lt;br /&gt;Policy Name          Policy Text Policy Column Enabl Schema Object Name SIUD&lt;br /&gt;-----------          ----------- ------------- ----- ------ ----------- ----&lt;br /&gt;BONUS_CHANGES                                  YES   SCOTT  BONUS       NYYY&lt;br /&gt;SALARY_INCREASES                 SAL           YES   SCOTT  EMP         NNYN&lt;br /&gt;NEW_EMP_HIGH_SALARY SAL&gt;=2000                  YES   SCOTT  EMP         NYNN&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;1 row updated.&lt;br /&gt;&lt;br /&gt;1 row deleted.&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Wed Jan 30 page 1&lt;br /&gt;Fine-Grained Auditing (FGA) Audit Trail&lt;br /&gt;&lt;br /&gt;Date User Schema Object Name Policy Name SQL Text&lt;br /&gt;---------- ---------- ---------- ----------------- ---------------- ------------------------------------&lt;br /&gt;01/30/2008 SYSTEM SCOTT BONUS BONUS_CHANGES delete from scott.bonus&lt;br /&gt;08:07:28&lt;br /&gt;01/30/2008 SYSTEM SCOTT BONUS BONUS_CHANGES insert into scott.bonus values ('BIG&lt;br /&gt;08:07:28   BOSSMAN', 'THEMAN', 10000, 50000)&lt;br /&gt;01/30/2008 SYSTEM SCOTT EMP SALARY_INCREASES update scott.emp set sal=4000 where&lt;br /&gt;08:07:28   empno=7844&lt;br /&gt;01/30/2008 SYSTEM SCOTT EMP NEW_EMP_HIGH_SAL insert into scott.emp values (8000,&lt;br /&gt;08:07:28   ARY 'THEMAN', 'BIGBOSSMAN', NULL, TO_DATE('01-JAN-2008','DD-MON-YYYY'), 10000, 50000, 10)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;strong&gt;Managing FGA&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;We have to manage this audit information being generated as if we do not the amount of audit information will continue to grow and potential lead to performance issues within the database. Therefore was must move audit information out of the system table to another table or even another database so that we can keep it in accordance with the business rules and regulations. After all the audit data is moved and the audit information verified that it has been properly moved we will need to purge the audit data from the system table.&lt;br /&gt;&lt;br /&gt;A simple way to manage the fine grained auditing audit trail would be to create a package and use that package to move the data in the audit trail for more long term storage and remove the audit records that have been moved. Simple development of a PL/SQL package that can be scheduled within the database to keep the system audit trail clean by placing in a staging area that can be used by Extraction Transformation Load (ETL) processes for longer term storage and reporting. &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;Example Package, not complete, but just to give an idea of how this might be approached:&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE manage_audit_trail&lt;br /&gt;IS&lt;br /&gt;PROCEDURE move_fga (p_msg OUT VARCHAR2) ;&lt;br /&gt;PROCEDURE remove_fga (p_days IN NUMBER, p_msg OUT VARCHAR2) ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;PROCEDURE remove_audit (p_days IN NUMBER, p_msg OUT VARCHAR2) ;&lt;br /&gt;END ;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE BODY manage_audit_trail&lt;br /&gt;IS&lt;br /&gt;-- Move Fine Grained Audit data to a staging table&lt;br /&gt;PROCEDURE move_fga (p_msg OUT VARCHAR2)&lt;br /&gt;IS&lt;br /&gt;BEGIN&lt;br /&gt;MERGE INTO AUDIT_STAGE a &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;USING dba_fga_audit_trail at &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;ON &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;(a.SESSION_ID = at.SESSION_ID&lt;br /&gt;a.TIMESTAMP = at.TIMESTAMP&lt;br /&gt;a.DB_USER = at.DB_USER&lt;br /&gt;a.ENTRYID = at.ENTRYID) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;WHEN NOT MATCHED THEN &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;INSERT (a.SESSION_ID, a.TIMESTAMP, a.DB_USER,&lt;br /&gt;a.OS_USER, a.USERHOST, a.CLIENT_ID,&lt;br /&gt;a.ECONTEXT_ID, a.EXT_NAME, a.OBJECT_SCHEMA,&lt;br /&gt;a.OBJECT_NAME, a.POLICY_NAME, a.SCN,&lt;br /&gt;a.SQL_TEXT, a.SQL_BIND, a.COMMENT$TEXT,&lt;br /&gt;a.STATEMENT_TYPE, a.EXTENDED_TIMESTAMP,&lt;br /&gt;a.PROXY_SESSIONID, a.GLOBAL_UID,&lt;br /&gt;a.INSTANCE_NUMBER, a.OS_PROCESS,&lt;br /&gt;a.TRANSACTIONID, a.STATEMENTID,&lt;br /&gt;a.ENTRYID, a.OBJ_EDITION_NAME) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;VALUES &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;(at.SESSION_ID, at.TIMESTAMP, at.DB_USER,&lt;br /&gt;at.OS_USER, at.USERHOST, at.CLIENT_ID,&lt;br /&gt;at.ECONTEXT_ID, at.EXT_NAME, at.OBJECT_SCHEMA,&lt;br /&gt;at.OBJECT_NAME, at.POLICY_NAME, at.SCN,&lt;br /&gt;at.SQL_TEXT, at.SQL_BIND, at.COMMENT$TEXT,&lt;br /&gt;at.STATEMENT_TYPE, at.EXTENDED_TIMESTAMP,&lt;br /&gt;at.PROXY_SESSIONID, at.GLOBAL_UID,&lt;br /&gt;at.INSTANCE_NUMBER, at.OS_PROCESS,&lt;br /&gt;at.TRANSACTIONID, at.STATEMENTID,&lt;br /&gt;at.ENTRYID, at.OBJ_EDITION_NAME) ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;EXCEPTION &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;WHEN OTHERS THEN &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_msg := SQLERRM ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;END move_fga ;&lt;br /&gt;&lt;br /&gt;-- Removes records from the fga audit trail (sys.fga_log$) &lt;= &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- sysdate – number of days passed. # of days defaults to 30 days &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;PROCEDURE remove_fga (p_days IN NUMBER, p_msg OUT VARCHAR2) &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;I&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;S &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;BEGIN &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- initialize &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;p_msg to null &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_msg := NULL ; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- Check number of days if not default to 30 days &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;IF p_days IS NULL then &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_days = 30 ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;END IF ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- remove the records from the fine grained audit trail &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;delete &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;from sys.fga_log$ &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;where timestamp# &lt;= SYSDATE – p_days ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;EXCEPTION &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;WHEN OTHERS THEN &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_msg := SQLERRM ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;END remove_fga ; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- Removes records from the audit trail (sys.aud$) &lt;= &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- sysdate – number of days passed. # of days defaults to 30 days &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;PROCEDURE remove_audit (p_days IN NUMBER, p_msg OUT VARCHAR2) &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;IS &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;BEGIN &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- initialize &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;p_msg to null ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_msg := NULL ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- Check number of days if not default to 30 days &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;IF p_days IS NULL then &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_days = 30 ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;END IF ; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-- remove the records from the audit trail &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;delete &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;from sys.aud$ &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;where timestamp# &lt;= SYSDATE – p_days ; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;EXCEPTION &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;WHEN OTHERS THEN &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;p_msg := SQLERRM ; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;END remove_audit ; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;END ; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Summary&lt;/strong&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;Oracle Fine Grained Auditing provides the Oracle DBAs a great way to gather the required audit information, define criteria for the gathering of the audit information and actually helps simplify managing the audit data by consolidating all audit data into a single audit trail making the movement and management of audit data for long term reporting simpler. The key to a complete successful audit trail is the ability to report the audit information to answer the questions coming from regulation agencies and internal business entities, like security and compliance offices.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8585086604702645917?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8585086604702645917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8585086604702645917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8585086604702645917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8585086604702645917'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/oracle-fine-grained-auditing.html' title='Oracle Fine Grained Auditing'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-8929905429352586749</id><published>2008-02-02T12:12:00.000-05:00</published><updated>2008-02-02T12:15:52.264-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Accessing Monitored Database Objects with OEM Grid Control Reports'/><title type='text'>Accessing Monitored Database Objects with OEM Grid Control Reports</title><content type='html'>&lt;strong&gt;Accessing Monitored Database Objects with OEM Grid Control Reports&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Ever want to create an Oracle Enterprise Manager Grid Control Report on using objects in the monitored database not from the gird control repository objects? There is a way&lt;br /&gt;&lt;br /&gt;We can create a user in the grid control repository database create a database link to the monitored database create view(s) of the across the database link to the object(s) that we want to be able to built the OEM Grid Control Report on then grant access to the view(s) to the MGMT_VIEW user in the grid control repository. Then you can use the view created in a OEM Grid Control Report.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;-- will set up a user in the grid control repository that will own&lt;br /&gt;-- the private database link and views here we will name the user same&lt;br /&gt;-- as the database&lt;br /&gt;create user prd identified by password &lt;password&gt;;&lt;br /&gt;alter user prd default tablespace users ;&lt;br /&gt;alter user prd temporary tablespace temp ;&lt;br /&gt;&lt;br /&gt;grant create session to prd ;&lt;br /&gt;grant create database link to prd ;&lt;br /&gt;grant create view to prd ;&lt;br /&gt;&lt;br /&gt;-- connect as our user so that we can create the database&lt;br /&gt;-- link and view as well as grant to the MGMT_VIEW user&lt;br /&gt;connect &lt;a href="mailto:prd/password@gridrepository"&gt;prd/password&lt;password&gt;&lt;password&gt;@gridrepository&lt;/a&gt;&lt;grid&gt;&lt;grid&gt;&lt;br /&gt;&lt;br /&gt;-- drop the database link if it already exists&lt;br /&gt;drop database link prd ;&lt;br /&gt;&lt;br /&gt;-- create the database link to the monitored database where the&lt;br /&gt;-- objects we want to use in our OEM Grid Control Reports exists&lt;br /&gt;create database link prd connect to dbsnmp identified by password &lt;password&gt;&lt;dbsnmp&gt;using 'PRD' ;&lt;br /&gt;&lt;br /&gt;-- Create our view&lt;br /&gt;create or replace view prd.DBA_HIST_SYSMETRIC_SUMMARY as select * from &lt;a href="mailto:DBA_HIST_SYSMETRIC_SUMMARY@prd"&gt;DBA_HIST_SYSMETRIC_SUMMARY@prd&lt;/a&gt; ;&lt;br /&gt;&lt;br /&gt;-- grant permissions to the MGMT_VIEW user&lt;br /&gt;grant select on prd.DBA_HIST_SYSMETRIC_SUMMARY to MGMT_VIEW ;&lt;br /&gt;&lt;br /&gt;-- Now ready to use the prd.DBA_HIST_SYSMETRIC_SUMMARY&lt;br /&gt;-- in our Grid Control Reports&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6964914631494495523-8929905429352586749?l=oramrmessin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oramrmessin.blogspot.com/feeds/8929905429352586749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6964914631494495523&amp;postID=8929905429352586749' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8929905429352586749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6964914631494495523/posts/default/8929905429352586749'/><link rel='alternate' type='text/html' href='http://oramrmessin.blogspot.com/2008/02/accessing-monitored-database-objects.html' title='Accessing Monitored Database Objects with OEM Grid Control Reports'/><author><name>Mike Messina</name><uri>http://www.blogger.com/profile/13386391715450815002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_M1FJlXCTa7M/SKCGIK7lg1I/AAAAAAAAAAg/2ZiNMcgr0A4/s1600-R/P1000129.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6964914631494495523.post-437647755046307828</id><published>2008-02-02T11:54:00.000-05:00</published><updated>2008-02-03T10:03:09.040-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 11g RMAN New Compression Type (ZLIB)'/><title type='text'>Oracle 11g RMAN New Compression Type (ZLIB)</title><content type='html'>Oracle 11g RMAN New Compression Type (ZLIB)&lt;br /&gt;&lt;br /&gt;RMAN had compression of backups in Oracle Database 10g to conserve network bandwidth. Third-party compression utilities provided faster alternatives to RMAN's own, but RMAN 10g compression provided some features that the third-party ones did not. For example, when RMAN 10g restored datafiles, it did not need to uncompress the files first. This approach offers significant bandwidth 
