<?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-1624281472776718399</id><updated>2011-10-09T21:20:31.168-07:00</updated><category term='DGMGRL'/><category term='Oracle'/><category term='Data gaurd'/><category term='database'/><title type='text'>Oracle Documents</title><subtitle type='html'>My own experiance are documented here like Installations,Performance Tuning,Backup Internals and lots more...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-6181358609137555120</id><published>2011-08-08T12:27:00.000-07:00</published><updated>2011-08-08T12:27:32.791-07:00</updated><title type='text'>MMAN Statistics</title><content type='html'>Some background on memory broker:&lt;br /&gt;&lt;br /&gt;The Automatic Shared Memory Management feature uses  background process named Memory Manager (MMAN).MMAN serves as the SGA Memory Broker and coordinates the sizing of the memory components. The SGA Memory Broker keeps track of the sizes of the components and pending resize operations.There is not so many document on this process but here is some help:&lt;br /&gt;&lt;br /&gt;Let’s see what is MMAN responsible for :&lt;br /&gt;SQL&gt; select substr(DEST,1,10) DEST, DESCRIPTION from x$messages where DEST=’MMAN’;&lt;br /&gt;&lt;br /&gt;DEST                           DESCRIPTION&lt;br /&gt;—————————— ——————————————————–&lt;br /&gt;MMAN                           lock memory at startup&lt;br /&gt;MMAN                           lock memory timeout action&lt;br /&gt;MMAN                           Memory Management&lt;br /&gt;MMAN                           Complete deferred initialization of components&lt;br /&gt;MMAN                           Handle sga_target resize&lt;br /&gt;MMAN                           Handle mem_target resize&lt;br /&gt;MMAN                           Handle sga_target deferred request delete&lt;br /&gt;MMAN                           Reset advisory pool when advisory turned ON&lt;br /&gt;&lt;br /&gt;The SGA Memory Broker keeps track of the sizes of the components and pending resize operations.&lt;br /&gt;&lt;br /&gt;We can dump memory broker statistics into trace file using&lt;br /&gt;&lt;br /&gt;oradebug dump DUMP_ADV_SNAPSHOTS  command e.g.&lt;br /&gt;SQL&gt; oradebug setmypid&lt;br /&gt;SQL&gt; oradebug dump DUMP_ADV_SNAPSHOTS 0&lt;br /&gt;&lt;br /&gt;Default value for memory broker statistis is 30 sec.It is controled by underscore parameter&lt;br /&gt;&lt;br /&gt;_memory_broker_stat_interval             30      memory broker statistics gathering interval for auto sga&lt;br /&gt;&lt;br /&gt;and can be changed with alter system command e.g.&lt;br /&gt;&lt;br /&gt;alter system set “_memory_broker_stat_interval”=60 scope=both sid=’demo1′; will change gathering interval to one minute.&lt;br /&gt;&lt;br /&gt;New snapshot will be generated  after _memory_broker_stat_interval expires.&lt;br /&gt;&lt;br /&gt;Trace file has various statistics for diffrent SGA components.Note snapshots numbers and timestamp.&lt;br /&gt;&lt;br /&gt;Processing Oradebug command ‘dump DUMP_ADV_SNAPSHOTS 0′&lt;br /&gt;Dumping memory broker statistics snapshots 5677&lt;br /&gt;0: ———————————————————–&lt;br /&gt;Stats Entry #5646 taken at timestamp 671200759&lt;br /&gt;Stat                      Value&lt;br /&gt;——————————-&lt;br /&gt;DB time                   355973&lt;br /&gt;DEFAULT cache read count  33608&lt;br /&gt;DEFAULT cache read time   227&lt;br /&gt;shared pool load count    24336&lt;br /&gt;shared pool load time     53486&lt;br /&gt;java pool load count      422&lt;br /&gt;java pool load time       11&lt;br /&gt;shared io pool wait time       0&lt;br /&gt;Component              Granules&lt;br /&gt;——————————-&lt;br /&gt;DEFAULT cache          70&lt;br /&gt;Shared Pool            33&lt;br /&gt;Large Pool             1&lt;br /&gt;Java Pool              2&lt;br /&gt;SGA Target             107&lt;br /&gt;PGA Target             72&lt;br /&gt;Default Cache Advice Version=12 Start Index of Version=9&lt;br /&gt;Default Cache Granules -&gt; Estimated Read Time&lt;br /&gt;———————————————–&lt;br /&gt;———————————————–&lt;br /&gt;7 -&gt; 364, 14 -&gt; 275, 21 -&gt; 235, 28 -&gt; 227, 35 -&gt; 227, 42 -&gt; 227, 49 -&gt; 227, 56 -&gt; 227, 63 -&gt; 227, 70 -&gt; 227, 77 -&gt; 227, 84 -&gt; 227, 91 -&gt; 227, 98&lt;br /&gt;-&gt; 227, 105 -&gt; 227, 112 -&gt; 227, 119 -&gt; 227, 126 -&gt; 227, 133 -&gt; 227, 140 -&gt; 227&lt;br /&gt;Shared Pool Advice Version=16 Start Index of Version=9&lt;br /&gt;Shared Pool Granules -&gt; Estimated Load Time&lt;br /&gt;———————————————–&lt;br /&gt;25 -&gt; 3590, 29 -&gt; 1856, 33 -&gt; 195, 37 -&gt; 1, 41 -&gt; 1, 45 -&gt; 1, 49 -&gt; 1, 53 -&gt; 1, 57 -&gt; 1, 61 -&gt; 1, 65 -&gt; 1, 69 -&gt; 1&lt;br /&gt;Java Pool Advice Version=2 Start Index of Version=20&lt;br /&gt;Java Pool Granules -&gt; Estimated Load Time&lt;br /&gt;———————————————–&lt;br /&gt;1 -&gt; 195, 2 -&gt; 195, 3 -&gt; 195, 4 -&gt; 195&lt;br /&gt;PGA Target Advice Version=1 Start Index of Version=0&lt;br /&gt;PGA Granules -&gt; Estimated PGA Processing Time&lt;br /&gt;———————————————–&lt;br /&gt;9 -&gt; 11962649, 18 -&gt; 11886641, 36 -&gt; 11886641, 54 -&gt; 11886641, 72 -&gt; 11886641, 86 -&gt; 11886641, 100 -&gt; 11886641, 115 -&gt; 11886641, 129 -&gt; 11886641,&lt;br /&gt; 144 -&gt; 11886641, 216 -&gt; 11886641, 288 -&gt; 11886641, 432 -&gt; 11886641, 576 -&gt; 11886641&lt;br /&gt;————————————————————-&lt;br /&gt;1: ———————————————————–&lt;br /&gt;Stats Entry #5677 taken at timestamp 671202561&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-6181358609137555120?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/6181358609137555120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/mman-statistics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/6181358609137555120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/6181358609137555120'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/mman-statistics.html' title='MMAN Statistics'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-5072341501292432016</id><published>2011-08-08T12:21:00.000-07:00</published><updated>2011-08-08T12:21:09.495-07:00</updated><title type='text'>Want to know how to get the SQLPLUS command history</title><content type='html'>If you are running sqlplus or RMAN on Windows than you can use upper arrow to get history.What about linux?&lt;br /&gt;&lt;br /&gt;First option:&lt;br /&gt;&lt;br /&gt;1) Install  readline wrapper:&lt;br /&gt;&lt;br /&gt; yum install rlwrap&lt;br /&gt;&lt;br /&gt;2) Change    &lt;b&gt;.bashrc&lt;/b&gt; and make alias :&lt;br /&gt;&lt;br /&gt;&lt;b&gt;alias sqlplus=’rlwrap sqlplus’ alias rman=’rlwrap rman’&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; The other option is to install  qqlplus which you can find on the link&lt;br /&gt;&lt;br /&gt;http://gqlplus.sourceforge.net/&lt;br /&gt;&lt;br /&gt;I tried it on my Oracle 11 running Linux 64bit and did not work.I used already made executable under Linux folder ( included into compressed source file )  but I am sure this can be fixed by comipiling source code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-5072341501292432016?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/5072341501292432016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/want-to-know-how-to-get-sqlplus-command.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/5072341501292432016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/5072341501292432016'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/want-to-know-how-to-get-sqlplus-command.html' title='Want to know how to get the SQLPLUS command history'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-1167068593561961491</id><published>2011-08-08T12:03:00.000-07:00</published><updated>2011-08-08T12:03:48.700-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DGMGRL'/><category scheme='http://www.blogger.com/atom/ns#' term='Data gaurd'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>How to trace Oralce Data Gaurd</title><content type='html'>Data Guard Broker (DGMGRL) can connect to database using following options:&lt;br /&gt;&lt;br /&gt;-echo&lt;br /&gt;-silent&lt;br /&gt;-xml&lt;br /&gt;-debug&lt;br /&gt;-logfile&lt;br /&gt;&lt;br /&gt;So if I need to run dgmgrl command in debug mode I would execute following :&lt;br /&gt;&lt;br /&gt;dgmgrl -debug / or&lt;br /&gt;&lt;br /&gt;-bash-3.2$ dgmgrl -debug sys/secret@test&lt;br /&gt;&lt;br /&gt;DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production&lt;br /&gt;Copyright (c) 2000, 2009, Oracle. All rights reserved.&lt;br /&gt;Welcome to DGMGRL, type "help" for information.&lt;br /&gt;[W000 01/05 12:27:03.81] Connecting to database using test.&lt;br /&gt;[W000 01/05 12:27:03.85] Executing query [select dbms_drs.dg_broker_info('VERSION') from dual].&lt;br /&gt;[W000 01/05 12:27:03.86] Query result is '11.2.0.1.0'&lt;br /&gt;Connected.&lt;br /&gt;or dgmgrl  -debug / shutdown command  will shutdown instance ,generate trace file and then exit.&lt;br /&gt;&lt;br /&gt;If Data Guard Broker is used then tracing can be enabled using DGMGRL command&lt;br /&gt;and setting property LogArchiveTrace to value other than 0.&lt;br /&gt;&lt;br /&gt;/** Tracing primary site **/&lt;br /&gt;&lt;br /&gt;DGMGRL&gt; edit database ‘primary_db_name’ set property LogArchiveTrace=’1′;&lt;br /&gt;&lt;br /&gt;/** Tracing standby site **/&lt;br /&gt;&lt;br /&gt;DGMGRL&gt; edit database ‘standby_db_name’ set property LogArchiveTrace=’1′;&lt;br /&gt;&lt;br /&gt;Also this parameter can be set by issueing a SQL statement :&lt;br /&gt;&lt;br /&gt;SQL&gt; ALTER SYSTEM SET LOG_ARCHIVE_TRACE=1;&lt;br /&gt;&lt;br /&gt;Values are described in table bellow:&lt;br /&gt;&lt;br /&gt;Level	Meaning&lt;br /&gt;0	Disables archived redo log tracing (default setting)&lt;br /&gt;1	Tracks archiving of log files&lt;br /&gt;2	Tracks archive status by archive log file destination&lt;br /&gt;4	Tracks archive operational phase&lt;br /&gt;8	Tracks archive log destination activity&lt;br /&gt;16	Tracks detailed archive log destination activity&lt;br /&gt;32	Tracks archive log destination parameter modifications&lt;br /&gt;64	Tracks ARCn process state activity&lt;br /&gt;128	Tracks FAL server process activity&lt;br /&gt;256	Tracks RFS Logical Client&lt;br /&gt;512	Tracks LGWR redo shipping network activity&lt;br /&gt;1024	Tracks RFS physical client&lt;br /&gt;2048	Tracks RFS/ARCn ping heartbeat&lt;br /&gt;4096	Tracks real-time apply activity&lt;br /&gt;8192	Tracks Redo Apply activity (media recovery or physical standby)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-1167068593561961491?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/1167068593561961491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/how-to-trace-oralce-data-gaurd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/1167068593561961491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/1167068593561961491'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/how-to-trace-oralce-data-gaurd.html' title='How to trace Oralce Data Gaurd'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-7906160210271650464</id><published>2011-08-08T11:57:00.000-07:00</published><updated>2011-08-08T11:58:22.387-07:00</updated><title type='text'>After a long time I am updating my blog.</title><content type='html'>After a long time I am updating my blog.&lt;br /&gt;&lt;br /&gt;Thanks for the mail. Which waked me up from my hot seat.&lt;br /&gt;&lt;br /&gt;Thanks for the one who sent that mail.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-7906160210271650464?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/7906160210271650464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/after-long-time-i-am-updating-my-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/7906160210271650464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/7906160210271650464'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2011/08/after-long-time-i-am-updating-my-blog.html' title='After a long time I am updating my blog.'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-453231562978318389</id><published>2011-01-12T05:44:00.000-08:00</published><updated>2011-01-12T05:44:04.960-08:00</updated><title type='text'>Monitor Dataguard Status</title><content type='html'>From Primary:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; select protection_mode,&lt;br /&gt;  2  protection_level,&lt;br /&gt;  3  database_role,&lt;br /&gt;  4  switchover_status&lt;br /&gt;  5  from v$database;&lt;br /&gt;&lt;br /&gt;PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    SWITCHOVER_STATUS&lt;br /&gt;-------------------- -------------------- ---------------- --------------------&lt;br /&gt;MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PRIMARY          TO STANDBY&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; set pages 999&lt;br /&gt;SQL&gt; select to_char(timestamp,'YYYY-MON-DD HH24:MI:SS')||'   '||message&lt;br /&gt;  2  from v$dataguard_status;&lt;br /&gt;&lt;br /&gt;TO_CHAR(TIMESTAMP,'YYYY-MON-DDHH24:MI:SS')||''||MESSAGE&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;2011-JAN-10 08:43:34   ARC0: Archival started&lt;br /&gt;2011-JAN-10 08:43:34   ARC1: Archival started&lt;br /&gt;2011-JAN-10 08:43:34   ARC2: Archival started&lt;br /&gt;2011-JAN-10 08:43:34   ARC1: Becoming the 'no FAL' ARCH&lt;br /&gt;2011-JAN-10 08:43:34   ARC1: Becoming the 'no SRL' ARCH&lt;br /&gt;2011-JAN-10 08:43:34   ARC2: Becoming the heartbeat ARCH&lt;br /&gt;2011-JAN-10 08:43:35   Error 12514 received logging on to the standby&lt;br /&gt;2011-JAN-10 08:43:35   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 12514.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:43:35   ARC1: Beginning to archive thread 1 sequence 58 (305558-3&lt;br /&gt;26454)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:43:35   ARC1: Completed archiving thread 1 sequence 58 (305558-32&lt;br /&gt;6454)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:43:35   ARC3: Archival started&lt;br /&gt;2011-JAN-10 08:43:37   Error 12514 received logging on to the standby&lt;br /&gt;2011-JAN-10 08:43:37   FAL[server, ARC2]: Error 12514 creating remote archivelog&lt;br /&gt; file 'drorcl'&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:43:38   ARC3: Beginning to archive thread 1 sequence 59 (326454-3&lt;br /&gt;26515)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:43:38   ARC3: Completed archiving thread 1 sequence 59 (326454-32&lt;br /&gt;6515)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:46:52   ARC2: Standby redo logfile selected for thread 1 sequence&lt;br /&gt; 58 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:46:52   ARC0: Beginning to archive thread 1 sequence 60 (326515-3&lt;br /&gt;26771)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:46:52   ARC0: Completed archiving thread 1 sequence 60 (326515-32&lt;br /&gt;6771)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:46:52   LNS: Standby redo logfile selected for thread 1 sequence&lt;br /&gt;61 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;&lt;br /&gt;2011-JAN-10 08:46:52   LNS: Beginning to archive log 1 thread 1 sequence 61&lt;br /&gt;2011-JAN-10 08:46:53   ARC0: Standby redo logfile selected for thread 1 sequence&lt;br /&gt; 60 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:20:03   LNS: Attempting destination LOG_ARCHIVE_DEST_2 network re&lt;br /&gt;connect (3135)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:20:03   LNS: Destination LOG_ARCHIVE_DEST_2 network reconnect aba&lt;br /&gt;ndoned&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:20:03   Error 3135 for archive log file 1 to 'drorcl'&lt;br /&gt;2011-JAN-10 10:20:03   LNS: Failed to archive log 1 thread 1 sequence 61 (3135)&lt;br /&gt;2011-JAN-10 10:25:22   Error 1031 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:25:22   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 1031.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:26:41   Error 1031 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:26:41   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 1031.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:28:02   Error 1031 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:28:02   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 1031.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:29:21   Error 1031 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:29:21   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 1031.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:30:40   Error 12514 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:30:40   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 12514.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:31:59   Error 12514 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:31:59   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 12514.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:33:18   Error 12514 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:33:18   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 12514.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:37   Error 12528 received logging on to the standby&lt;br /&gt;2011-JAN-10 10:34:37   PING[ARC2]: Heartbeat failed to connect to standby 'drorc&lt;br /&gt;l'. Error is 12528.&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:37   ARC3: Beginning to archive thread 1 sequence 61 (326771-3&lt;br /&gt;33704)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:38   ARC3: Completed archiving thread 1 sequence 61 (326771-33&lt;br /&gt;3704)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:38   LNS: Standby redo logfile selected for thread 1 sequence&lt;br /&gt;62 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:38   LNS: Beginning to archive log 2 thread 1 sequence 62&lt;br /&gt;2011-JAN-10 10:34:38   ARC0: Standby redo logfile selected for thread 1 sequence&lt;br /&gt; 61 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;46 rows selected.&lt;br /&gt;&lt;br /&gt;From standby database:&lt;br /&gt;&lt;br /&gt;SQL&gt; select protection_mode,&lt;br /&gt;  2  protection_level,&lt;br /&gt;  3  database_role,&lt;br /&gt;  4  switchover_status&lt;br /&gt;  5  from v$database;&lt;br /&gt;&lt;br /&gt;PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    SWITCHOVER_STATUS&lt;br /&gt;-------------------- -------------------- ---------------- --------------------&lt;br /&gt;MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED&lt;br /&gt;&lt;br /&gt;SQL&gt; select process,&lt;br /&gt;  2  status,&lt;br /&gt;  3  thread#,&lt;br /&gt;  4  sequence#,&lt;br /&gt;  5  block#,&lt;br /&gt;  6  blocks&lt;br /&gt;  7  from v$managed_standby;&lt;br /&gt;&lt;br /&gt;PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS&lt;br /&gt;--------- ------------ ---------- ---------- ---------- ----------&lt;br /&gt;ARCH      CONNECTED             0          0          0          0&lt;br /&gt;ARCH      CONNECTED             0          0          0          0&lt;br /&gt;ARCH      CONNECTED             0          0          0          0&lt;br /&gt;ARCH      CLOSING               1         61      10240       1111&lt;br /&gt;RFS       IDLE                  0          0          0          0&lt;br /&gt;RFS       IDLE                  1         62       1057          1&lt;br /&gt;RFS       IDLE                  0          0          0          0&lt;br /&gt;MRP0      APPLYING_LOG          1         62       1057     102400&lt;br /&gt;&lt;br /&gt;8 rows selected.&lt;br /&gt;&lt;br /&gt;SQL&gt; select to_char(timestamp,'YYYY-MON-DD HH24:MI:SS')||'   '||message from v$dataguard_status;&lt;br /&gt;&lt;br /&gt;TO_CHAR(TIMESTAMP,'YYYY-MON-DDHH24:MI:SS')||''||MESSAGE&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;2011-JAN-10 10:34:36   ARC0: Archival started&lt;br /&gt;2011-JAN-10 10:34:37   ARC1: Archival started&lt;br /&gt;2011-JAN-10 10:34:37   ARC2: Archival started&lt;br /&gt;2011-JAN-10 10:34:37   ARC1: Becoming the 'no FAL' ARCH&lt;br /&gt;2011-JAN-10 10:34:37   ARC2: Becoming the heartbeat ARCH&lt;br /&gt;2011-JAN-10 10:34:37   ARC2: Becoming the active heartbeat ARCH&lt;br /&gt;2011-JAN-10 10:34:38   Primary database is in MAXIMUM PERFORMANCE mode&lt;br /&gt;2011-JAN-10 10:34:38   RFS[1]: Assigned to RFS process 8979&lt;br /&gt;2011-JAN-10 10:34:38   RFS[2]: Assigned to RFS process 8981&lt;br /&gt;2011-JAN-10 10:34:38   ARC3: Archival started&lt;br /&gt;2011-JAN-10 10:34:38   ARC3: Beginning to archive thread 1 sequence 61 (326771-3&lt;br /&gt;33704)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:39   ARC3: Completed archiving thread 1 sequence 61 (0-0)&lt;br /&gt;2011-JAN-10 10:34:51   Attempt to start background Managed Standby Recovery proc&lt;br /&gt;ess&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:51   MRP0: Background Managed Standby Recovery process started&lt;br /&gt;2011-JAN-10 10:34:57   Managed Standby Recovery not using Real Time Apply&lt;br /&gt;2011-JAN-10 10:34:57   Media Recovery Log /u01/app/oracle/fast_recovery_area/DRO&lt;br /&gt;RCL/archivelog/2011_01_10/o1_mf_1_61_6lnw1yrp_.arc&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:34:57   Media Recovery Waiting for thread 1 sequence 62 (in trans&lt;br /&gt;it)&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:35:06   MRP0: Background Media Recovery cancelled with status 160&lt;br /&gt;37&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:35:06   MRP0: Background Media Recovery process shutdown&lt;br /&gt;2011-JAN-10 10:35:06   Managed Standby Recovery Canceled&lt;br /&gt;2011-JAN-10 10:35:12   Attempt to start background Managed Standby Recovery proc&lt;br /&gt;ess&lt;br /&gt;&lt;br /&gt;2011-JAN-10 10:35:12   MRP0: Background Managed Standby Recovery process started&lt;br /&gt;2011-JAN-10 10:35:18   Managed Standby Recovery starting Real Time Apply&lt;br /&gt;2011-JAN-10 10:35:18   Media Recovery Waiting for thread 1 sequence 62 (in trans&lt;br /&gt;it)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;24 rows selected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-453231562978318389?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/453231562978318389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2011/01/monitor-dataguard-status.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/453231562978318389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/453231562978318389'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2011/01/monitor-dataguard-status.html' title='Monitor Dataguard Status'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-7991281031757126745</id><published>2010-12-21T21:04:00.000-08:00</published><updated>2010-12-21T21:04:07.025-08:00</updated><title type='text'>How to disable flush of ASH data to AWR?</title><content type='html'>MMON process will periodically flush ASH data into AWR tables.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Oracle introduced WF enqueue which is used to serialize the flushing of snapshots.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If for any reason ( space issue, bugs, hanging etc..) you need to disable flushing the run time statistics for&lt;br /&gt;&lt;br /&gt;particular table than following procedure needs to be done.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First, locate the exact AWR Table Info (KEW layer):&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select table_id_kewrtb, table_name_kewrtb from x$kewrtb order by 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TABLE_ID_KEWRTB TABLE_NAME_KEWRTB&lt;br /&gt;&lt;br /&gt;————— —————————————————————-&lt;br /&gt;&lt;br /&gt;0 WRM$_DATABASE_INSTANCE&lt;br /&gt;&lt;br /&gt;1 WRM$_SNAPSHOT&lt;br /&gt;&lt;br /&gt;2 WRM$_BASELINE&lt;br /&gt;&lt;br /&gt;3 WRM$_WR_CONTROL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;—-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TABLE_ID_KEWRTB TABLE_NAME_KEWRTB&lt;br /&gt;&lt;br /&gt;————— —————————————————————-&lt;br /&gt;&lt;br /&gt;99 WRH$_RSRC_PLAN&lt;br /&gt;&lt;br /&gt;100 WRM$_BASELINE_DETAILS&lt;br /&gt;&lt;br /&gt;101 WRM$_BASELINE_TEMPLATE&lt;br /&gt;&lt;br /&gt;102 WRH$_CLUSTER_INTERCON&lt;br /&gt;&lt;br /&gt;103 WRH$_MEM_DYNAMIC_COMP&lt;br /&gt;&lt;br /&gt;104 WRH$_IC_CLIENT_STATS&lt;br /&gt;&lt;br /&gt;105 WRH$_IC_DEVICE_STATS&lt;br /&gt;&lt;br /&gt;106 WRH$_INTERCONNECT_PINGS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;107 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1st option :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter system set “_awr_disabled_flush_tables”=’&lt;table_name&gt;’;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;alter system set “_awr_disabled_flush_tables”=’WRH$_INTERCONNECT_PINGS,WRH$_RSRC_PLAN’;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2nd option:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter session set events ‘immediate trace name awr_flush_table_off level 106′;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter session set events ‘immediate trace name awr_flush_table_off level 99′&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you decide to turn on flushing statistics than&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter session set events ‘immediate trace name awr_flush_table_on level 106′;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter session set events ‘immediate trace name awr_flush_table_on level 99′;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-7991281031757126745?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/7991281031757126745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/how-to-disable-flush-of-ash-data-to-awr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/7991281031757126745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/7991281031757126745'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/how-to-disable-flush-of-ash-data-to-awr.html' title='How to disable flush of ASH data to AWR?'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-8029792956081487600</id><published>2010-12-21T21:03:00.001-08:00</published><updated>2010-12-21T21:03:20.640-08:00</updated><title type='text'>Network Time Protocol ( NTP ) &amp; Clusterware diagnostic script</title><content type='html'>One of the prerequisites to successfully install Oracle version 11.2 is to set Network Time Protocol ( NTP )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;( file /etc/sysconfig/ntpd )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;with -x flag which prevents time from adjusting backward.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This comes very crucial in debugging Oracle Clusterware.NTP will synchronize clocks among all nodes which will make correct analysis of trace files based on time stamps .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Oracle is providing diagnostic collection script diagcollection.pl to collect important log files.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Script is located under $&lt;grid_home&gt;/bin/ e.g. /u01/app/11.2.0/grid/bin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It will generate four tar.gz files in local directory which will have following information:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;traces,logs and cores for CRS home&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ocrcheck , ocrdump&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CRS core files&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;OS logs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After you are done you can clean them with same script.Just run diagcollection.pl -clean option.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Script must be run as root .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-8029792956081487600?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/8029792956081487600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/network-time-protocol-ntp-clusterware.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/8029792956081487600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/8029792956081487600'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/network-time-protocol-ntp-clusterware.html' title='Network Time Protocol ( NTP ) &amp; Clusterware diagnostic script'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-8876349920707851402</id><published>2010-12-21T21:02:00.001-08:00</published><updated>2010-12-21T21:02:39.256-08:00</updated><title type='text'>Add Unique key in a table that contains duplicate row</title><content type='html'>Requirement : A table contains some duplicate data. Now we want to add a unique constraint that skip existing duplicate values but check newly inserted duplicate values.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; create table t2 (id number(10), t varchar2(20));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values (1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values (1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values (1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; commit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t2 add constraint uk_t2 unique(id) ENABLE NOVALIDATE;&lt;br /&gt;&lt;br /&gt;alter table t2 add constraint uk_t2 unique(id) ENABLE NOVALIDATE&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;br /&gt;ORA-02299: cannot validate (HASAN.UK_T2) - duplicate keys found&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select * from t2;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ID T&lt;br /&gt;&lt;br /&gt;---------- ------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;1 A&lt;br /&gt;&lt;br /&gt;1 A&lt;br /&gt;&lt;br /&gt;1 A&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So normal method does not work !&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Case 1: New Table That means initially the table does not have any data&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; create table t3 (id number(10), t varchar2(20));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t3 add constraint gpu unique (id) deferrable initially deferred;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t3 disable constraint gpu;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t3 values(1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t3 values(1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t3 values(1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; commit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select * from t3;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ID T&lt;br /&gt;&lt;br /&gt;---------- ------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;1 A&lt;br /&gt;&lt;br /&gt;1 A&lt;br /&gt;&lt;br /&gt;1 A&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t3 enable novalidate constraint gpu;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t3 values(2,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; commit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t3 values(2,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; commit;&lt;br /&gt;&lt;br /&gt;commit&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;br /&gt;ORA-02091: transaction rolled back&lt;br /&gt;&lt;br /&gt;ORA-00001: unique constraint (HASAN.GPU) violated&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t3 modify constraint gpu INITIALLY IMMEDIATE;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t3 values(1,'A');&lt;br /&gt;&lt;br /&gt;insert into t3 values(1,'A')&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;br /&gt;ORA-00001: unique constraint (HASAN.GPU) violated&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Case 2: Existing Table that contains duplicate data&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; create table t2 (id number(1),a varchar2(10));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values(1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values(1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; commit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t2 add constraint uk_t2 unique(id) DEFERRABLE INITIALLY DEFERRED disable;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t2 enable novalidate constraint uk_t2;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values(1,'A');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 row created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; commit;&lt;br /&gt;&lt;br /&gt;commit&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;br /&gt;ORA-02091: transaction rolled back&lt;br /&gt;&lt;br /&gt;ORA-00001: unique constraint (HASAN.UK_T2) violated&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t2 modify constraint uk_t2 INITIALLY IMMEDIATE;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values(1,'A');&lt;br /&gt;&lt;br /&gt;insert into t2 values(1,'A')&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;br /&gt;ORA-00001: unique constraint (HASAN.UK_T2) violated&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;OR &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t2 add constraint uk_t2 unique(id) disable;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter table t2 enable novalidate constraint uk_t2;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Table altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; insert into t2 values(1,'A');&lt;br /&gt;&lt;br /&gt;insert into t2 values(1,'A')&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;br /&gt;ORA-00001: unique constraint (HASAN.UK_T2) violated&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-8876349920707851402?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/8876349920707851402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/add-unique-key-in-table-that-contains.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/8876349920707851402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/8876349920707851402'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/add-unique-key-in-table-that-contains.html' title='Add Unique key in a table that contains duplicate row'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-1043598455896618073</id><published>2010-12-21T21:01:00.001-08:00</published><updated>2010-12-21T21:01:22.843-08:00</updated><title type='text'>Estimate Tablespace growth</title><content type='html'>Some time it is very helpful to plan disk space/ tablespace management if you estimate the growth of your tablespace. Here is a select query which can be helpful : &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY') days &lt;br /&gt;&lt;br /&gt;, ts.tsname&lt;br /&gt;&lt;br /&gt;, max(round((tsu.tablespace_size* dt.block_size )/(1024*1024),2) ) cur_size_MB&lt;br /&gt;&lt;br /&gt;, max(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) usedsize_MB &lt;br /&gt;&lt;br /&gt;FROM DBA_HIST_TBSPC_SPACE_USAGE tsu&lt;br /&gt;&lt;br /&gt;, DBA_HIST_TABLESPACE_STAT ts &lt;br /&gt;&lt;br /&gt;, DBA_HIST_SNAPSHOT sp&lt;br /&gt;&lt;br /&gt;, DBA_TABLESPACES dt&lt;br /&gt;&lt;br /&gt;WHERE tsu.tablespace_id= ts.ts#&lt;br /&gt;&lt;br /&gt;AND tsu.snap_id = sp.snap_id&lt;br /&gt;&lt;br /&gt;AND ts.tsname = dt.tablespace_name&lt;br /&gt;&lt;br /&gt;AND ts.tsname NOT IN ('SYSAUX','SYSTEM')&lt;br /&gt;&lt;br /&gt;GROUP BY TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY'), ts.tsname &lt;br /&gt;&lt;br /&gt;ORDER BY ts.tsname, days;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-1043598455896618073?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/1043598455896618073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/estimate-tablespace-growth.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/1043598455896618073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/1043598455896618073'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2010/12/estimate-tablespace-growth.html' title='Estimate Tablespace growth'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-1638677225719314191</id><published>2010-09-02T23:55:00.000-07:00</published><updated>2010-09-02T23:55:17.748-07:00</updated><title type='text'>Size your Undo Tablespace</title><content type='html'>Size your Undo tablespace &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What should be the size of UNDO tablespace? Generally this question is vaguely answered saying that sizing comes with experience (of DBA) or looking at load on server or sometimes even by the number of ORA-1555 or out of space errors.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This paper is to help DBA’s in calculating the size of UNDO tablespace by using a simple formula.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;While designing an application, generally it is tough to know about the number of transactions and subsequently number of rows changed per second.&lt;br /&gt;&lt;br /&gt;So I suggest having a “big undo tablespace” to start with and based on load, after doing some calculations and resize your UNDO tablespace.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In my case one of the applications was going to production (live), and I had no idea that how many transactions will happen against this database. All what I was told that there will be optimum (transactional) activity on this database. The word “optimum” itself is vague.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So I started with UNDO tablespace with size of 2GB and datafiles with autoextend “on” .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;&lt;br /&gt;In production, you must be very careful in using this (autoextend on) as the space may grow to inifinity very fast. So my advice is either dont use this option, or use with "maxsize" or continuously monitor space (which is tough).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I month later, I noticed the activity from V$undostat.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the step by step approach:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 1: Longest running query.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select max(maxquerylen) from v$undostat;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MAX(MAXQUERYLEN)&lt;br /&gt;&lt;br /&gt;----------------&lt;br /&gt;&lt;br /&gt;1793&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This gives you ideal value for UNDO_RETENTION. To be on the safer size you should add few more seconds to get the right value. So in my case, the size of undo retention should be say 2000 secs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 2: Size of UNDO tablespace.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Size of UNDO needed = UNDO_RETENTION x [UNDO block Generation per sec x DB_BLOCK_SIZE] + Overhead(30xDB_BLOCK_SIZE)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Out of these we know UNDO_RETENTION and DB_BLOCK_SIZE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;All we need is to find out “UNDO Blocks per second”&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Which can be easily fetched from v$undostat&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; SELECT (SUM(undoblks))/ SUM ((end_time - begin_time) * 24*60*60) "UPS"&lt;br /&gt;&lt;br /&gt;2 FROM v$undostat;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;UPS&lt;br /&gt;&lt;br /&gt;------------------------------&lt;br /&gt;&lt;br /&gt;8.11985583&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;V$undostat stores data for every 10 mins and begin/end times are start/end time of those intervals. We multiplied it with 24*60*60 because the difference between two dates will be in days and to get to seconds, we need it to multiply with 24hrs*60mins*60secs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So now we have all the values needed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Undo size needed = [8.12 x 2000 x 8192] + [30 x 8192] = 133283840 bytes = 127.11 MB&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-1638677225719314191?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/1638677225719314191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2010/09/size-your-undo-tablespace.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/1638677225719314191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/1638677225719314191'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2010/09/size-your-undo-tablespace.html' title='Size your Undo Tablespace'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-3876310647993901307</id><published>2010-08-31T02:01:00.000-07:00</published><updated>2010-08-31T02:01:11.487-07:00</updated><title type='text'>Oracle Data Pump</title><content type='html'>Data Pump: Not Just for Data Moves&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Data Pump – introduced in Oracle Database 10g Release 1 – has been described in many different ways: from “Export/Import from Steroids” to the “Ultimate Data Mover”. Perhaps the use of superlatives creates a perception that this is only for data movements. Numerous presentations, articles, books and even Oracle manuals permeate that perception.&lt;br /&gt;&lt;br /&gt;However, Data Pump is much more than just moving data. While that was probably the original and primary intent and it still remains the principal usage, the other subtle but significant capabilities of Data Pump remains under represented if not undiscovered. In this article you will learn about those lesser known capabilities and how to use them to achieve your strategic and tactical objectives. Put into good use Data Pump can ease a lot of daily and longer term non-data movement related tasks and provide a viable platform for alternate use.&lt;br /&gt;&lt;br /&gt;This article assumes that the attendee is familiar with the Data Pump tool. This is not a introduction to the tool itself.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A Data Pump Primer&lt;br /&gt;&lt;br /&gt;Even though the audience is assumed to be fully conversant with Data Pump, a quick primer will cement that understanding and pave way for a better understanding of the material to come. If you are familiar with the basics of the tool, you may want to skip this section in its entirety.&lt;br /&gt;&lt;br /&gt;Data Pump is an evolution of the original export and import tools; and in fact, it’s also named Data Pump Export and Import. The purpose is similar – to export data out of the Oracle database and import back. The exported data is put in a dumpfile, which is portable across Operating Systems and even across Oracle versions (10g Release 1 and above). This export works by selecting the data from the tables using the SQL interface, similar to the original export; but at a much faster rate. My tests have shown Data Pump Export to be about 10 times faster than original export when conditions are right – with high degrees of parallelism, multiple spindles and so on. Similarly Data Pump Import is also faster than the original import, albeit at a lower scale.&lt;br /&gt;&lt;br /&gt;The dumpfile produced can only be ready by Data Pump Import, not the original import. The same holds true for the reverse process as well, i.e. the dumpfile produced by the original export is not readable by DP Import. A major difference in the two tools is the location where the dumpfiles are produced. In the original export, the dumpfiles are produced in the same server the tool is called; so if you issue the exp command at a client machine, such as your laptop, the dumpfile is produced there. In contrast, the DP Export always produces the dumpfile on the database server regardless where it is called. You can specify a location by creating a directory object and specifying that in the command line.&lt;br /&gt;&lt;br /&gt;Finally, for the sake of completeness, the commands are “expdp” for DP Export and “impdp” for DP Import.&lt;br /&gt;&lt;br /&gt;Now that the introduction part is complete, let’s jump to the main topic – the usefulness of this tool beyond the data movement.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regulatory Compliance&lt;br /&gt;&lt;br /&gt;Would you want to store the source codes of the database codes such as stored procedures and DDLs of the objects? It would have been nice; but probably not strictly needed, just a fe years ago. But thanks to the myriads of laws and regulations covering the corporate America today, this has now become a necessity; not just a nice to have. For instance, laws like Sarbanes-Oxley (SOX) actually require that you have to have a system where you can track the changes to object definitions – commonly referred to as “metadata” in Oracle technical parlance. Please note, the word metadata has many different meanings in technical discussions. For instance, the original meaning of the term is “data about the data”, i.e. the meaning of the data elements such as columns and tables. For example, the metadata on the column STATUS in the table EMP could be: it refers to the status of the employee in the company at this time and it can have values such as ACTIVE, INACTIVE, SUSPENDED, etc. This description is commonly referred to as “metadata”. However, in Oracle-speak, we usually refer to the definition of the objects, i.e. the DDL statement to create the table, the source code of the procedures and packages as metadata. I have used the latter definition of the term.&lt;br /&gt;&lt;br /&gt;Most regulations and internal controls in organizations require that the source code be stores in a repository which can be controlled and tracked. If the definitions changed, the system should be able to track it and report changes. The historical records of the metadata should be persevered. How do you accomplish this? One way to achieve this is constructing the sources and DDL from the data dictionary in regular intervals. For tables, you would select from DBA_TAB_COLUMNS (for columns), DBA_CONSTRAINTS, and DBA_CONS_COLUMNS (for constraints), DBA_TAB_PRIVS (for privileges granted to the table) and many others. For source code, you will need to select from DBA_SOURCES; te view DBA_TRIGGERS for triggers, DBA_VIEWS for view definitions and so on. The other option is extracting the DDL from the dictionary using DBMS_METADATA.GET_DDL packaged function. The solutions are technically possible; but may seem infeasible considering the effort. So, to address that deficiency, several tool manufactures have jumped into the fray. Needless to say, the tools do their job; but at a cost.&lt;br /&gt;&lt;br /&gt;Enter Data Pump, to accomplish the same objective. Let’s see how.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Metadata Management&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One of the least used parameters of Data Pump Export is CONTENT, which controls what is exported. It accepts three parameters:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; DATA_ONLY – this option exports the data from tables.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; METADATA_ONLY – this option does not export the data; merely exports the metadata of the database objects. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; ALL –this is the default; both the metadata and the data (where applicable) are exported.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This parameter is the one you can use to create a baseline repository of the database sources and DDLs very quickly. All you have to do is to use:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;expdp directory=dpump_dir dumpfile=metadata.dmp content=metadata_only&lt;br /&gt;&lt;br /&gt;This creates the file metadata.dmp in the directory specified by the directlory object dpump_dir containing all the DDLs and source codes of the database objects. The file does not contain any data. This is your baseline repository of the source. If you ever need to reinstate the source, simply drop it from the database and import back the source from this baseline:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;impdp directory=dpump_dir dumpfile=metadata.dmp&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will import the objects that are not present in the database now and skip the ones that are there.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In many cases, your database as a whole may not be subject to the baseline repository building; you may want to store objects of specific schemas in the repository; not all. For instance you may want to include the ACCMAIN and HRMAIN schemas but not the SYSTEM schema. The above command would be slightly modified in that case:&lt;br /&gt;&lt;br /&gt;expdp directory=dpump_dir dumpfile=metadata.dmp content=metadata_only schemas=ACCMAIN, HRMAIN&lt;br /&gt;&lt;br /&gt;By default, all the database objects in the schema are exported – tables, views, triggers, procedures, and so on. What if you want to store each object separately in its individual files? For instance, you may want to store the stored code such as triggers, procedures, etc. on a file named metadata_code.dmp and tables, views, etc. on a file named metadata_tabs.dmp. In this case, you can use the INCLUDE parameter to include only certain objects or types of objects in the export file; not all. The above command will then turn to:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;expdp directory=dpump_dir dumpfile=metadata_code.dmp content=metadata_only schemas=ACCMAIN, HRMAIN include=PROCEDURE,FUNCTION,PACKAGE,TRIGGER&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here the dumpfile has only the code related metadata, not all.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also specify a specific procedure or finction to export. Suppose you want to keep a very crucial function – GET_RATE and a table – RATES, in a separate file – metadata_imp.dmp, you can use:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;expdp directory=dump_dir dumpfile=metadata_imp.dmp schemas=ACCMAIN include=FUNCTION:\"=\'GET_RATE\'\",TABLE:\"=\'RATES\'\"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note, I have added the backslash (“\”) before the double quotes (“) and the single quotes (‘), just so that the unix shell will not interpret the characters as commands. If you use Windows, you will need to remove the back slashes. Alternatively, a better way is to use a parameter file where you can list all the parameter, one per line and call the parameter using the PARFILE parameter. In this case, just create a file called exp.par with the following as the contents:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;directory=dump_dir&lt;br /&gt;&lt;br /&gt;dumpfile=metadata_imp.dmp&lt;br /&gt;&lt;br /&gt;schemas=accman&lt;br /&gt;&lt;br /&gt;include=FUNCTION:"='GET_RATE'"&lt;br /&gt;&lt;br /&gt;include=TABLE:"='RATES'"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then you can call the Data Pump Export as&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp parfile=exp.par&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the parfile, you can see that I have placed two lines with the INCLUDE parameter; that’s allowed. I can place as many INCLUDE parameters as I need. The include parameter takes the values as&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;objecttype&gt;:"&lt;objectlist&gt;"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For instance, to include the functions FN1 and FN2, you would use:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;include=function:"in ('FN1','FN2')"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;or &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;include=function:"like 'FN%'"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Of course, you can also use this to get all but some:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;include=function:"not in ('FN1','FN2')"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, a more convenient alternative may be to use the EXCLUDE option. This is the inverse of INCLUDE and instructs the expdp command to exclude the objects. For example, you want to export the meta data for all objects excluding the functions FN1, FN2 and procedures PROC1 and PROC2. You will use:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;exclude=function:"in ('FN1','FN2')"&lt;br /&gt;&lt;br /&gt;exclude=procedure:"in ('PROC1','PROC2')"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To include all objects except all the tables in the export dump:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;exclude=table&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The syntax is the same as the include option. Note a very important difference in the usage of the parameters. Include is used to include a specific objects of a type; exclude is used to exclude a specific object of a type. They are not necessarily interchangeable. Consider these two options:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;exclude=function:"in ('FN1','FN2')"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;include=function:"not in ('FN1','FN2')"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;They are not the same. The first option (the exclude one) exports all the objects – tables, views, triggers, etc. and leaves out just two functions – FN1 and FN2. The second option (the include one), on the other hand, only exports all the functions except FN1 and FN2. Only the functions are exported, not tables, views, etc. They are fundamentally different in their behavior. You have to consider this carefully when you construct your parameter file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Creating an SQL File&lt;br /&gt;&lt;br /&gt;Earlier you learned how to create a baseline and also selective exports of the database objects for safe keeping. However, the dumpfiles are not human readable, i.e. you can’t just glean over the files and get the metadata. You need another step – to extract the SQL out of the dumpfile. You can do that using the parameter SQLFILE in the Data Pump Import. Here is an example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ impdp directory=dump_dir dumpfile=metadata_full.dmp sqlfile=metadata_full.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This operation does not actually import the objects into the database; but creates an SQL script called metadata_full.sql containing all the objects in the dumpfile. Here is an excerpt from the file:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- CONNECT ARUP&lt;br /&gt;&lt;br /&gt;-- new object type path is: DATABASE_EXPORT/TABLESPACE&lt;br /&gt;&lt;br /&gt;CREATE UNDO TABLESPACE "UNDOTBS1" DATAFILE&lt;br /&gt;&lt;br /&gt;'+NDSDATA7/undotbs101.dbf' SIZE 17179869184,&lt;br /&gt;&lt;br /&gt;'+NDSDATA8/undotbs102.dbf' SIZE 17179869184,&lt;br /&gt;&lt;br /&gt;'+NDSDATA9/undotbs103.dbf' SIZE 17179869184&lt;br /&gt;&lt;br /&gt;BLOCKSIZE 8192&lt;br /&gt;&lt;br /&gt;EXTENT MANAGEMENT LOCAL AUTOALLOCATE;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLESPACE "SYSAUX" DATAFILE&lt;br /&gt;&lt;br /&gt;'+NDSDATA1/sysaux01.dbf' SIZE 4294967296,&lt;br /&gt;&lt;br /&gt;'+NDSDATA1/sysaux02.dbf' SIZE 4194304000&lt;br /&gt;&lt;br /&gt;NOLOGGING ONLINE PERMANENT BLOCKSIZE 8192&lt;br /&gt;&lt;br /&gt;EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TEMPORARY TABLESPACE "TEMP1" TEMPFILE&lt;br /&gt;&lt;br /&gt;'+NDSDATA1/temp1_01.dbf' SIZE 1073741824&lt;br /&gt;&lt;br /&gt;......... and so on ........&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also apply the filters to extract the SQL statements for specific objects as well. For instance, you can extract only the procedures, functions and packages; nothing else by using the INCLUDE parameter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;include=procedure, package&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can include specific objects as well; not just specific types.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;include=procedure:"='PROC1'"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the file that is eventually produced:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- CONNECT SYS&lt;br /&gt;&lt;br /&gt;-- new object type path is: SCHEMA_EXPORT/PROCEDURE/PROCEDURE&lt;br /&gt;&lt;br /&gt;-- CONNECT ARUP&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE "ARUP"."PROC1"&lt;br /&gt;&lt;br /&gt;as&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;&lt;br /&gt;dbms_output.put_line ('Some text');&lt;br /&gt;&lt;br /&gt;end;&lt;br /&gt;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- new object type path is: SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE&lt;br /&gt;&lt;br /&gt;ALTER PROCEDURE "ARUP"."PROC1"&lt;br /&gt;&lt;br /&gt;COMPILE&lt;br /&gt;&lt;br /&gt;PLSQL_OPTIMIZE_LEVEL= 2&lt;br /&gt;&lt;br /&gt;PLSQL_CODE_TYPE= INTERPRETED&lt;br /&gt;&lt;br /&gt;PLSQL_DEBUG= FALSE&lt;br /&gt;&lt;br /&gt;REUSE SETTINGS TIMESTAMP '2006-08-11 13:27:55'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As with the export, you can exclude some objects as well:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;exclude=procedure:"='PROC1'"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Building a Repository&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now that you learned how to extract the database objects into SQL files, you can build a system or a rudimentary tool to make the process resemble more like, well, a process. This can be effected somehow using the a shell script and creating the dumpfile and the SQL file named based on the date of creation. Here is how the shell script would look like:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DATEVAR=`date +"%m%d%y"`&lt;br /&gt;&lt;br /&gt;DMPFILE=metadata_${DATEVAR}.dmp&lt;br /&gt;&lt;br /&gt;SQLFILE=metadata_${DATEVAR}.sql&lt;br /&gt;&lt;br /&gt;echo "arup" &lt;br /&gt;expdp arup directory=tmp_dir dumpfile=${DMPFILE}&lt;br /&gt;&lt;br /&gt;echo "arup" &lt;br /&gt;impdp arup directory=tmp_dir dumpfile=${DMPFILE} sqlfile=${SQLFILE}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This script will create the file in the format metadata_&lt;mmddyy&gt;.dmp where &lt;mmddyy&gt;is the month, day and year string. After the creation of the SQL file, you can remove the dumpfile. I, however, prefer to keep it since it cannot be created from the SQL file. You can selectively extract anything from the dumpfile, apply filters; but not so with the SQL file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As a part of the maintenance, you may want to move the created files periodically. Here is a simple command that moves the files to a name &lt;originalname&gt;.old after 30 days.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;find . -name "*.dmp" -ctime +30 -exec mv {} {}.old\;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Or, you can just remove it&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;find . -name "*.dmp" -ctime +30 -exec rm {}\;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Using this, you can build a full version control and repository system in just hours; not months and without using any tool from outside of what you already has. This is one of the most powerful yet underutilized capabilities of the Data Pump.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create a User Like …&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is a request you may have received several times – create a user just like JOE. The requestor doesn’t provide any other details – no tablespace quotas, no grants and so on. All the requestor knows that JOE userid works; so another one like JOE will work as well. How do you take care of the request?&lt;br /&gt;&lt;br /&gt;Of course, there are tools that can do this quickly; but you may not have them handy. Your only option at that point is to painstakingly create an SQL file caturing the user’s properties for data dictionary, all the objects and so on. While it’s possible, it’s tedious, prone to errors and sunstantilly time consuming. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Enter Data Pump to the rescue. You can create the user in just two commands:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp schemas=JOE content=metadata_only&lt;br /&gt;&lt;br /&gt;$ impdp remap_schema=JOE:NEWUSER&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first command (export) is necessary only if you don’t have a full export dump or baseline now. If you have been using DP to take your metadata baselines, you don’t need to perform that step. The second command (the import) imports the metadata about the user JOE, but transforms it so that instead of JOE, the user NEWUSER is created. All grants, privileges, quotas, objects, etc. of JOE now goes to NEWUSER. In just a matter of minutes you created a user like another accurately.&lt;br /&gt;&lt;br /&gt;If you have been using the repository as several versions with timestamps as shown in the previous section, you can even use that to create a user like JOE as of a certain date. For instance, JOE has DBA privileges now; but didn’t have them yesterday. Could we have NEWUSER sans DBA role? Sure; just use the dumpfile as of that day.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create Tablespaces in Test as in Production&lt;br /&gt;&lt;br /&gt;This is another of the challenges you may face – you have been asked to create a small test database, of the fraction of the size of the main database; but the structural elements must be identical. i.e. the tablespaces should be same, laid out in the same manner, across the same mount points and so on. How do you quickly do it?&lt;br /&gt;&lt;br /&gt;Sure, you could write a PL/SQL loop to get all the datafile properties from the data dictionary (dba_data_files and dba_tablespaces) and construct the SQL script to create the tablespaces. It will work; but will take a significant amount of time, and, needless to say, is highly susceptible to errors.&lt;br /&gt;&lt;br /&gt;Again, Data Pump comes to rescue. All you have to do is import the dumpfile and use the INCLUDE option.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp content=metadata_only&lt;br /&gt;&lt;br /&gt;$ impdp include=tablespace&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Like the previous case, the first command (expdp) is not necessary if you already have a dump. Instead of creating the tablespace directly, you may also want to see the script by using the SQLFILE option:&lt;br /&gt;&lt;br /&gt;$ impdp include=tablespace sqlfile=c.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will create a file called c.sql, which will have the tablespace creation scripts. You ca edit them, if needed and run them from SQL*Plus.&lt;br /&gt;&lt;br /&gt;A slight variation of the above may be more practical. In many cases, the test database may not have or need the size of the production database tablespaces. While creating the tablespaces, you may want to reduce the size of the datafiles by a certain percentage, say 90%. One option is to create a SQL file, edit it and manually change the sizes of all datafiles to 10% of the production size. While it’s doable, it’s not elegant as it adds time and risk of error. You can achieve that in a simple option – TRANSFORM.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ impdp include=tablespace sqlfile=c.sql transform=pctspace:10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The parameter transform=pctspace:10 instructs the IMPDP job to change the size of the datafiles to 10% of the original size. Here is the excerpt from the SQL file created without this parameter:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE UNDO TABLESPACE "UNDOTBS1" DATAFILE&lt;br /&gt;&lt;br /&gt;'/u01/undotbs101.dbf' SIZE 17179869184,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And here is the excerpt when the parameter was applied:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE UNDO TABLESPACE "UNDOTBS1" DATAFILE&lt;br /&gt;&lt;br /&gt;'/u01/undotbs101.dbf' SIZE 1717986918,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As you can see, the size with the parameter (1,717,986,918) is about 10% of the original size (17,179,869,184). You will learn more about the TRANSFORM parameter later in this article.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Data File Name Change&lt;br /&gt;&lt;br /&gt;You are moving some tables from another database and the tablespace in which these tables exist is also new in the target database. Importing those tables will create the tablespaces in the target database too; but here is a small problem – the filesystems are different. For example, the datafile for tablespace was “/u01/data1.dbf” but the target database does not have a mount point called /u01; instead it has “/u02”. Ordinarily you would have to create the tablespace manually and then import the table into the tablespace. &lt;br /&gt;&lt;br /&gt;Data Pump eliminates the extra step in one elegant motion. All you have to do is use the REMAP_DATAFILE option as follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ impdp remap_datafile=‘/u01/data1.dbf':'/u02/data1.dbf' &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This creates the same datafile as /u02/data1.dbf. you can use this option to recreate the test data even across different platforms. For instance, the following option in the option converts datafiles from a unix to Windows format.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;remap_datafile='/u01/data1.dbf':'c:\oradata\data1.dbf' &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Segment Transforms&lt;br /&gt;&lt;br /&gt;This is also a common problem in creating a test database from production. The test database may be very small compared to the production volume. Therefore, when you export and import the tables, they may fail if the initial extents are defined too large to fit in the test database. Instead of creating the table manually prior to importing, you will find Data Pump doing that work for you. You can remove the storage clauses of the tables, MVs etc. using a simple parameter TRANSFORM to impdp. The parameter has the following format:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;transform=segment_attributes:[N/Y]:&lt;objecttype&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;objecttype&gt;could be “table”. For instance, to include the storage clause for tables, use it like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;transform=segment_attributes:n:table&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When put it in impdp, the table creation does not include physical attributes, storage attributes, tablespaces and logging features. Here is a small example to illustrate the concept. First do a normal import:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ impdp arup/arup directory=tmp_dir dumpfile=metadata_full.dmp sqlfile=trans.sql include=table:\"=\'TRANS\'\" &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the DDL as shown in the SQL file trans.sql:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE "ARUP"."TRANS"&lt;br /&gt;&lt;br /&gt;( "TRANS_ID" NUMBER,&lt;br /&gt;&lt;br /&gt;"TRANS_DT" DATE,&lt;br /&gt;&lt;br /&gt;"PRODUCT_CODE" NUMBER,&lt;br /&gt;&lt;br /&gt;"STORE_ID" NUMBER,&lt;br /&gt;&lt;br /&gt;"TRANS_AMOUNT" NUMBER(12,2)&lt;br /&gt;&lt;br /&gt;) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255&lt;br /&gt;&lt;br /&gt;STORAGE(&lt;br /&gt;&lt;br /&gt;BUFFER_POOL DEFAULT)&lt;br /&gt;&lt;br /&gt;TABLESPACE "USERS"&lt;br /&gt;&lt;br /&gt;PARTITION BY RANGE ("TRANS_DT")&lt;br /&gt;&lt;br /&gt;(PARTITION "Y05Q1" VALUES LESS THAN (TO_DATE(' 2005-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))&lt;br /&gt;&lt;br /&gt;PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOLOGGING&lt;br /&gt;&lt;br /&gt;STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645&lt;br /&gt;&lt;br /&gt;PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)&lt;br /&gt;&lt;br /&gt;TABLESPACE "USERS" NOCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "Y05Q2" VALUES LESS THAN (TO_DATE(' 2005-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))&lt;br /&gt;&lt;br /&gt;PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOLOGGING&lt;br /&gt;&lt;br /&gt;STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645&lt;br /&gt;&lt;br /&gt;PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)&lt;br /&gt;&lt;br /&gt;TABLESPACE "USERS" NOCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "Y05Q3" VALUES LESS THAN (TO_DATE(' 2005-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))&lt;br /&gt;&lt;br /&gt;PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOLOGGING&lt;br /&gt;&lt;br /&gt;STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645&lt;br /&gt;&lt;br /&gt;PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)&lt;br /&gt;&lt;br /&gt;TABLESPACE "USERS" NOCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "Y05Q4" VALUES LESS THAN (TO_DATE(' 2006-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))&lt;br /&gt;&lt;br /&gt;PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOLOGGING&lt;br /&gt;&lt;br /&gt;STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645&lt;br /&gt;&lt;br /&gt;PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)&lt;br /&gt;&lt;br /&gt;TABLESPACE "USERS" NOCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "PMAX" VALUES LESS THAN (MAXVALUE)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, use the same command using the transform option:&lt;br /&gt;&lt;br /&gt;$ impdp arup/arup directory=tmp_dir dumpfile=metadata_full.dmp sqlfile=metadata_full.sql include=table:\"=\'TRANS\'\" transform=segment_attributes:n:table&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you see the SQL file:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE "ARUP"."TRANS"&lt;br /&gt;&lt;br /&gt;( "TRANS_ID" NUMBER,&lt;br /&gt;&lt;br /&gt;"TRANS_DT" DATE,&lt;br /&gt;&lt;br /&gt;"PRODUCT_CODE" NUMBER,&lt;br /&gt;&lt;br /&gt;"STORE_ID" NUMBER,&lt;br /&gt;&lt;br /&gt;"TRANS_AMOUNT" NUMBER(12,2)&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;PARTITION BY RANGE ("TRANS_DT")&lt;br /&gt;&lt;br /&gt;(PARTITION "Y05Q1" VALUES LESS THAN (TO_DATE(' 2005-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))&lt;br /&gt;&lt;br /&gt;NOCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "Y05Q2" VALUES LESS THAN (TO_DATE(' 2005-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) N&lt;br /&gt;&lt;br /&gt;OCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "Y05Q3" VALUES LESS THAN (TO_DATE(' 2005-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) N&lt;br /&gt;&lt;br /&gt;OCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "Y05Q4" VALUES LESS THAN (TO_DATE(' 2006-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) N&lt;br /&gt;&lt;br /&gt;OCOMPRESS ,&lt;br /&gt;&lt;br /&gt;PARTITION "PMAX" VALUES LESS THAN (MAXVALUE) NOCOMPRESS ) ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note how the storage options such as initial/next/max extents, buffer pool, etc. have been removed, even from the partitions. This way there is no conflict with the target database’s storage parameters and the table can be created easily.&lt;br /&gt;&lt;br /&gt;If you want to remove storage parameters from all objects, not just tables, leave the third part of the value in the TRANSFORM option:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;transform=segment_attributes:n&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Reducing Size&lt;br /&gt;&lt;br /&gt;On the same line as the above, suppose you want to still keep the initial extent clause in the CREATE TABLE script but want to make it much smaller than it’s in production database. Ordinarily you would have done it using the more laborious manual approach, i.e. creating the SQL file, calculating the desired initial extent and editing the SQL file to plug in those numbers. This may be technically possible but may be infeasible.&lt;br /&gt;&lt;br /&gt;A special modifier “PCTSPACE” in the TRANSFORM parameter shown above does the trick. Specifying a PCTSPACE puts the initial extent size as that much percentage of the production database. Here is how you can specify a 10% size of the initial extent:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp transform=pctspace:30 tables=accounts&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the above case, if the original INITIAL extent of the table ACCOUNTS was 100M, the import creates the table with INITIAL as 10M, or 10% of the original.&lt;br /&gt;&lt;br /&gt;Sub-setting a Table&lt;br /&gt;&lt;br /&gt;This is also a very common request – create a sub-set of a table in production in the test database so that the tests can be done against it. There could be several reasons why the full table couldn’t be used – the most common being lack of space in test database. So, how can you create a smaller portion of the table, say, 10% of the original rows?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are two options while creating a sub-set of the table:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Take a random sample of 10% of the rows&lt;br /&gt;&lt;br /&gt;2. Take the specific rows that satisfy some criteria&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Random Sample&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To export a random sample of 10% of the rows of all the tables, use the SAMPLE parameter in expdp command as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp SAMPLE=10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This takes a sample from all the tables. Suppose you want to take a sample from the table ACCOUNTS in ARUP schema only:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp SAMPLE=ARUP.ACCOUNTS:10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Rows Satisfying Some Condition&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Suppose you want to create a subset of the table based on some criteria, e.g. “SALARY&amp;gt;10000”, you would issue&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp query=employees:"where salary&amp;gt;10000" tables=employees&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This can also take the ORDER BY clause to create the dumpfile in a sorted order. Suppose you want to dump the EMPLOYEES table order by SALARY, here is how the complete command looks like (with the unix required escape characters – backslahes):&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp arup/arup directory=demo_dir dumpfile=employees.dmp query=employees:\"where salary\&amp;gt;10000\ order by salary" tables=employees&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you already have a full dump, you may want to import from that instead of creating a subset of the table in export. You can also use the QUERY parameter in impdp as well.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ impdp QUERY=CUSTOMERS:“WHERE TOTAL_SPENT &amp;gt; 10" &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This can also take the ORDER BY clause. This approach can be used to quickly load parts of the production table to test database. Please note that this does not take care of referential integrity constraints, i.e. the loaded rows do not necessarily satisfy all the foreign key relationships. For instance, if you import 10% of the tables DEPARTMENTS and EMPLOYEES, there is no guarantee that all the department number of the employees in the 10% of the rows of the EMPLOYEES table will be in the 10% of the DEPARTMENTS table. So, the import will fail. In such a case, you can either disable the constraint (not a very useful option) or use the QUERY parameter to select specific rows.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Refresh a Table Definition&lt;br /&gt;&lt;br /&gt;You maintain two different databases, say, Development and Integration. From time to time you want to make sure the definitions of the tables are in sync between the two databases. And suddenly you realize that the databases may be out of sync in the structure of the objects. How can you refresh the table in INT so it matches the copy in DEV? Of course you can drop and recreate all the objects; but that’s a task easier said than done. You need to create the SQL script of all the objects – tables, views, procedures, triggers, grants made and received and so on and so forth. You could just drop everything and recreate; but then that means dropping something that may be in INT only and that will not be recreated. &lt;br /&gt;&lt;br /&gt;As always, you can use Data Pump to achieve this in just one command. Just take an export of the metadata only. In this example, we assume that you want to refresh only the table ACCOUNTS. After the export, just import the table with the option table_exists_action set to “replace”, which drops the table and recreate it from the metadata contained in the dumpfile.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp tables=ACCOUNTS content=metadata_only&lt;br /&gt;&lt;br /&gt;$ impdp full=y table_exists_action=replace &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also use this technique to reinstate the copy of the table from the repository as of a certain date. While importing you may also want to modify the storage parameters of the table by using the TRANSFORM parameter as the storage parameters may not be adequate for the target database.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Changing Table’s Owner&lt;br /&gt;&lt;br /&gt;This is not a everyday case but it does happen. Someone created a table in the wrong schema – SCOTT, instead of ACCMAIN. Subsequent operations have placed dependent objects on it – triggers, constraints, indexes, etc.; and SCOTT has granted privileges to others. When the mistake was realized, it was too late to make a quick change. What can you do to quickly change the owner. &lt;br /&gt;&lt;br /&gt;Unfortunately, in Oracle there is no such thing called changing the owner of the table. The only option is a series of steps: &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. create the SQL to create table; &lt;br /&gt;&lt;br /&gt;2. create the table in the new schema; &lt;br /&gt;&lt;br /&gt;3. create all grants, triggers, constraints and so on; &lt;br /&gt;&lt;br /&gt;4. export the table, &lt;br /&gt;&lt;br /&gt;5. import into the old schema&lt;br /&gt;&lt;br /&gt;6. drop the table in the old schema&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Although feasible, this series of steps is very laborious and error-prone. Of course there are tools to do this; but again, we assume that we don’t have access to these tools. Wedo have access to, however, the Data Pump tool, which accomplishes the task in just one line, using the parameter “remap_schema”.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ impdp remap_schema=“OLDU:NEWU” network_link=maindb directory=…&lt;br /&gt;&lt;br /&gt;Here you changed the owner from OLDU to NEWU. Here is an important point to note here – the use of the parameter “network_link”. It’s a database link created pointing to the same database. The use of this parameter saves us from running an expdp to create a dumpfile. The parameter lets impdp get the metadata across the database link and bypass the dumpfile creation step.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;External Tables&lt;br /&gt;&lt;br /&gt;External tables are not new in the database; they were first introduced in Oracle 9i. In essence, they are text files outside the database, but are visible to the database users as simple tables. When users select from the table, the actual text file is read and the rows returned as if they are rows of a regular table. The table can only be queried; not updated.&lt;br /&gt;&lt;br /&gt;You can also create an ASCII file from a table or set of tables and create an external table on that file to make it visible to the applications. This comes handy while sending some data form one system to another. Since the external tables do not need to be loaded in the database to be visible, this technique makes the data immediately available to the end users and relives stress on the database. The real challenge is how to make this file that will be eventually be used as an external table. You can use the simple SQL*Plus to select all the columns and spool to a file. This approach is the simplest but also the slowest. The other option is to use OCI or Pro*C program to create these files. This makes the file creation quicker; but also adds a lot of time to the process. &lt;br /&gt;&lt;br /&gt;Many people are not aware of the fact that you can use Data Pump to create the external table file. This file is not ASCII; it’s binary; but it’s readable across platforms. Let’s see an example: Here we are creating a file trans_ext.dmp to be used as an en external table from the table TRANS.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;create table trans_ext (&lt;br /&gt;&lt;br /&gt;trans_id,&lt;br /&gt;&lt;br /&gt;trans_dt,&lt;br /&gt;&lt;br /&gt;product_code,&lt;br /&gt;&lt;br /&gt;store_id,&lt;br /&gt;&lt;br /&gt;trans_amount&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;organization external&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;type oracle_datapump&lt;br /&gt;&lt;br /&gt;default directory tmp_dir&lt;br /&gt;&lt;br /&gt;location ('trans_ext.dmp')&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;as&lt;br /&gt;&lt;br /&gt;select * from trans&lt;br /&gt;&lt;br /&gt;order by trans_id;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Once the table is created, you can use the file as an external table – trans_external – as:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;create table trans_external (&lt;br /&gt;&lt;br /&gt;trans_id number,&lt;br /&gt;&lt;br /&gt;trans_dt date,&lt;br /&gt;&lt;br /&gt;product_code number,&lt;br /&gt;&lt;br /&gt;store_id number,&lt;br /&gt;&lt;br /&gt;trans_amount number(12,2)&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;organization external&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;type oracle_datapump&lt;br /&gt;&lt;br /&gt;default directory tmp_dir&lt;br /&gt;&lt;br /&gt;location ('trans_ext.dmp')&lt;br /&gt;&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;And that’s it; the file is now available as an external table. You would select from it as you would select from a regular table:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select * &lt;br /&gt;&lt;br /&gt;from trans_external;&lt;br /&gt;&lt;br /&gt;So, how does all this make it any better? The user can always select from the original table TRANS, instead of TRANS_EXTERNAL; so there does not seem to be any advantage in using this approach.&lt;br /&gt;&lt;br /&gt;The advantage comes when the user does not have direct access to the database. In order to send the data to a remote user, you have to send it using Data Pump Export. At the other end, the user must import it into the database before he can start using it, which requires some technical expertise. On the other hand, the external table approach takes no technical expertise; the user can simply make the file available to the same server as the database runs on, using ftp, copying the file or something as trivial as mounting the CD on the CD-ROM. As soon as the server sees the file, the external table is immediately visible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Uses of External Tables&lt;br /&gt;&lt;br /&gt;Offline Receiver – in the cases where the receiver of the data is not online with the database, this is the best way to send data without strong technical expertise. The common example is a publication industry, which sends out period updates to the data it sells. Instead of importing the new data, the publisher merely creates an external table file, burns a CD with the file an sends it to the readers. The application on the database reads the external table. When the reader pops in the new CD, the application immediately sees the new data; no data manipulation need occur. Since the data in the external table can’t be written to, the system provides a read only mechanism to the process. &lt;br /&gt;&lt;br /&gt;Ease of Creation – You don’t have to write any code to create the files.&lt;br /&gt;&lt;br /&gt;Ordering and Grouping – While creating the external table files, you can use WHERE, ORDER BY and GROUP BY clauses, thereby sorting and grouping data. This approach can be used in ETL processes where the data can be loaded without an intermediate sorting/grouping step. One of the best uses of this technique is the creation of Index Organized Tables, described in a sub-section below.&lt;br /&gt;&lt;br /&gt;Faster Loading – The regular Data Pump Import still goes through the SQL layer, making it somewhat slower. The fastest way to load a table is still the APPEND method. So, you could use Data Pump export to create the external table file, create external table and load into the main table using the APPEND hint:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;insert /*+ append */ into trans&lt;br /&gt;&lt;br /&gt;select * from trans_external;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This allows the Direct Path Insert, bypassing the SQL processing layer and minimizing undo and redo and significantly improving the processing time.&lt;br /&gt;&lt;br /&gt;Creating IOTs – An Index Organized Table is a table built on a primary key index. In a normal PK index, only the PK columns and the pointer to the corresponding row in the table are stored. In the IOT, the entire row is stored along with the PK index columns. When a user queries a normal table using the PK columns in the WHERE condition, Oracle first gets the rowid from the PK index and gets the row from the table – a two step operation. In an IOT, since the entire row is stored along with the PK, the second step is eliminated. &lt;br /&gt;&lt;br /&gt;When you create an IOT, the rows can be loaded in any manner; but if the rows are already in a sorted format, the sorting from the IOT is considerably faster. This can be easily done in Data Pump using the external table approach. While creating the external table files, just use the ORDER BY clause on the PK columns and then load them; the rows will be in sorted order.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;General Tips ‘n Tricks&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Parallelizing&lt;br /&gt;&lt;br /&gt;To make DP Exports run faster, you can use the parallel option to execute the job in parallel. However, if you do use the parallel option, make sure you have that many files as parallel degree; otherwise the parallelism will not take effect.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp tables=CASES directory=DPDATA1 parallel=4 dumpfile=\(expCASES1.dmp,epCASES2.dmp,expCASES3.dmp,expCASES4.dmp\) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you do not wan to name the files individually, you can use the %U wildcard.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$ expdp tables=CASES directory=DPDATA1 dumpfile=expCASES_%U.dmp parallel=4 &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Monitoring&lt;br /&gt;&lt;br /&gt;One of the often asked questions is how to monitor the performance of the DP jobs that are running now. There are a few ways you can do it. One is identifying and monitoring the Oracle sessions of the DP jobs. The information about the Data Pump jobs are found in the view DBA_DATAPUMP_SESSIONS.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select sid, serial#&lt;br /&gt;&lt;br /&gt;from v$session s, dba_datapump_sessions d&lt;br /&gt;&lt;br /&gt;where s.saddr = d.saddr;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Once you identify the session, you can see the parallel query slave sessions spawned off by the main DP session by querying the V$PX_SESSION view.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select sid from v$px_session &lt;br /&gt;&lt;br /&gt;where qcsid = &lt;dp id="" session=""&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When DP jobs run, they post important runtime information in the view V$SESSION_LONGOPS. You can view all that by issuing:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select sid, serial#, sofar, totalwork &lt;br /&gt;&lt;br /&gt;from v$session_longops &lt;br /&gt;&lt;br /&gt;where opname = '&lt;dp job="" name=""&gt;' &lt;br /&gt;&lt;br /&gt;and sofar != totalwork; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Troubleshooting&lt;br /&gt;&lt;br /&gt;Like anything else, DP sometimes does not work the way it is supposed to, or perceived to –leading to the next section – Troubleshooting. Many problems can be easily diagnosed using the TRACE on the tool’s innards. There are two different types of trace on Data Pump. The trace built into the tool itself; and the SQL trace on the sessions of DP. Let’s see how each one works.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Data Pump TRACE&lt;br /&gt;&lt;br /&gt;The trace is given as a parameter in the command line of the tool in the following format:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TRACE=&lt;compid&gt;0300&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The &lt;compid&gt;is the component to trace and accepts the following values:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1FF – Full Tracing&lt;br /&gt;&lt;br /&gt;048 – Standard Tracing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In many cases the Standard tracing provides all the information you want for a detailed troubleshooting; but sometimes, and usually at the direction of the Oracle Support Services, you may want to enable the Full tracing. Here is an example of the standard tracing.&lt;br /&gt;&lt;br /&gt;$ impdp trace=0480300 schema=... and so on ...&lt;br /&gt;&lt;br /&gt;This produces a trace file in the user_dump_dest directory, which shows in detail different commands and where they are failing, if at all they are failing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL Trace&lt;br /&gt;&lt;br /&gt;This is the usual SQL Tracing you may have been familiar with; however there is a small challenge. Since DP jobs kick off the sessions themselves, you don’t have an opportunity to set the trace in the session by specifying “alter session set sql_trace = true”. Instead, you must enable an event in the session from outside using the dbms_system.set_ev procedure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First, get the SID and Serial# of the Data Pump session:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select sid,serial#,username,program&lt;br /&gt;&lt;br /&gt;from v$session &lt;br /&gt;&lt;br /&gt;where upper(program) like '%(DW%)'&lt;br /&gt;&lt;br /&gt;or upper(program) like '%(DM%)';&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then trace the session (place the SID and Serial# below)&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; exec dbms_system.set_ev(&lt;sid&gt;, &lt;serial#&gt;, 10046, 12, '')&lt;br /&gt;&lt;br /&gt;This will produce a trace file in the user_dump_dest directory of the database server.&lt;br /&gt;&lt;br /&gt;Conclusion&lt;br /&gt;&lt;br /&gt;Data Pump, although originally designed to be a tool to move a lot of data quickly and across multiple database versions and platforms, has some quite useful functionalities much beyond that. In this article you learned a few of those non-traditional uses of the tool that prove extremely useful in the long and short term objectives, without the use of any other expensive tool, whether from Oracle or another third party. The capabilities of the tool are not limited to those listed in the article; but only to your imagination&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-3876310647993901307?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/3876310647993901307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2010/08/oracle-data-pump.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/3876310647993901307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/3876310647993901307'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2010/08/oracle-data-pump.html' title='Oracle Data Pump'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-7387913649705275514</id><published>2008-08-25T20:47:00.000-07:00</published><updated>2009-08-31T22:39:13.305-07:00</updated><title type='text'>Oracle RAC installation on Solaris SPARC 64 bit</title><content type='html'>Keyword:&lt;strong&gt;&lt;h2&gt;Oracle RAC Installation RAC Installation &lt;br /&gt;&lt;br /&gt;Installing Oracle RAC Installing &lt;br /&gt;&lt;br /&gt;Oracle RAC on Solaris&lt;/h2&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Few weeks back i did a 2 node oracle RAC installation&lt;br /&gt;The Machines were Soalris 10 SPARC 64 bit (Sun-Fire-T2000).&lt;br /&gt;The Shared storage was NAS&lt;br /&gt;Even though Solaris 10 uses resource control, the kernel parameters were added in the /etc/system (#Metalink: Note:367442.1)&lt;br /&gt;&lt;br /&gt;The group OINSTALL and user ORACLE were created on both nodes&lt;br /&gt;&lt;br /&gt;Few parameters were tuned in /etc/rc2.d/S99nettune&lt;br /&gt;&lt;br /&gt;bash-3.00# more /etc/rc2.d/S99nettune&lt;br /&gt;#!/bin/sh&lt;br /&gt;ndd -set /dev/ip ip_forward_src_routed 0&lt;br /&gt;ndd -set /dev/ip ip_forwarding 0&lt;br /&gt;ndd -set /dev/tcp tcp_conn_req_max_q 16384&lt;br /&gt;ndd -set /dev/tcp tcp_conn_req_max_q0 16384&lt;br /&gt;ndd -set /dev/tcp tcp_xmit_hiwat 400000&lt;br /&gt;ndd -set /dev/tcp tcp_recv_hiwat 400000&lt;br /&gt;ndd -set /dev/tcp tcp_cwnd_max 2097152&lt;br /&gt;ndd -set /dev/tcp tcp_ip_abort_interval 60000&lt;br /&gt;ndd -set /dev/tcp tcp_rexmit_interval_initial 4000&lt;br /&gt;ndd -set /dev/tcp tcp_rexmit_interval_max 10000&lt;br /&gt;ndd -set /dev/tcp tcp_rexmit_interval_min 3000&lt;br /&gt;ndd -set /dev/tcp tcp_max_buf 4194304&lt;br /&gt;ndd -set /dev/tcp tcp_maxpsz_multiplier 10&lt;br /&gt;&lt;strong&gt;#Oracle Required&lt;/strong&gt;&lt;br /&gt;ndd -set /dev/udp udp_recv_hiwat 65535&lt;br /&gt;ndd -set /dev/udp udp_xmit_hiwat 65535&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Check /etc/system is readable by ORACLE (else RDBMS installation will fail)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-rw-r–r– 1 root root 2561 Apr 17 16:03 /etc/system&lt;br /&gt;&lt;strong&gt;Checked the system config on both nodes&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;For RAM&lt;/strong&gt;&lt;br /&gt;/usr/sbin/prtconf | grep “Memory size”&lt;br /&gt;Memory size: 8064 Megabytes&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For SWAP&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;/usr/sbin/swap -s&lt;br /&gt;total: 4875568k bytes allocated + 135976k reserved = 5011544k used, 9800072k available&lt;br /&gt;For /tmp&lt;br /&gt;df -h /tmp&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Filesystem size used avail capacity Mounted on&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;swap 9.4G 31M 9.4G 1% /tmp&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For OS&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;/bin/isainfo -kv&lt;br /&gt;64-bit sparcv9 kernel modules&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For user&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;id -a #both UID and GID of user ORACLE should be same on both nodes&lt;br /&gt;uid=300(ORACLE) gid=300(oinstall) groups=300(oinstall),301(dba),503(tms),504(mscat),102(dwh)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;User nobody should exist&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;id -a nobody&lt;br /&gt;&lt;br /&gt;uid=60001(nobody) gid=60001(nobody) groups=60001(nobody)&lt;br /&gt;I had the below entries in the /etc/hosts on both nodes&lt;br /&gt;[]cat /etc/hosts&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;#Public:&lt;/strong&gt;&lt;br /&gt;3.208.169.203 ownserver01 ownserver01ipmp0 loghost&lt;br /&gt;3.208.169.207 ownserver02 ownserver02ipmp0 loghost&lt;br /&gt;&lt;strong&gt;#Private:&lt;/strong&gt;&lt;br /&gt;10.47.2.82 ownserver01ipmp1 # e1000g1 -Used this while installing cluster&lt;br /&gt;10.47.2.85 ownserver02ipmp1 # e1000g1 -Used this while installing cluster&lt;br /&gt;10.47.2.76 ownserver01ipmp2 # e1000g0&lt;br /&gt;10.47.2.79 ownserver02ipmp2 # e1000g0 &lt;br /&gt;&lt;strong&gt;#Vip:&lt;/strong&gt;&lt;br /&gt;3.208.169.202 ownserverv01&lt;br /&gt;3.208.169.206 ownserverv02&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;All the interfaces had their ipmp groups.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Confirmed that the interface names of both Private and Public are same across the nodes.&lt;br /&gt;e1000g3 was the Public Interface on both nodes.&lt;br /&gt;e1000g0 and e1000g1 were the Private Interface on both nodes.&lt;br /&gt;-I had 2 interfaces for Private Interconnect, of which i used e1000g1 during the cluster installation.&lt;br /&gt;-The interface names for e1000g1 on each node were ownserver01ipmp1 and ownserver02ipmp1&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Below is the ‘ifconfig -a‘ from Ownserver01&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;ownserver01 [SHCL1DR1]$ ifconfig -a&lt;br /&gt;lo0: flags=2001000849&lt;UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL&gt; mtu 8232 index 1&lt;br /&gt;inet 127.0.0.1 netmask ff000000&lt;br /&gt;e1000g0: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 2&lt;br /&gt;inet 10.47.2.76 netmask ffffffe0 broadcast 10.47.2.95&lt;br /&gt;groupname ipmp2&lt;br /&gt;e1000g0:1: flags=9040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 2&lt;br /&gt;inet 10.47.2.77 netmask ffffffe0 broadcast 10.47.2.95&lt;br /&gt;e1000g0:2: flags=9040842&lt;BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 2&lt;br /&gt;inet 10.47.2.77 netmask ff000000 broadcast 10.255.255.255&lt;br /&gt;e1000g1: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 3&lt;br /&gt;inet 10.47.2.82 netmask ffffffe0 broadcast 10.47.2.95&lt;br /&gt;groupname ipmp1&lt;br /&gt;e1000g1:1: flags=9040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 3&lt;br /&gt;inet 10.47.2.83 netmask ffffffe0 broadcast 10.47.2.95&lt;br /&gt;e1000g1:2: flags=9040842&lt;BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 3&lt;br /&gt;inet 10.47.2.83 netmask ff000000 broadcast 10.255.255.255&lt;br /&gt;e1000g2: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 4&lt;br /&gt;inet 10.47.2.11 netmask ffffffc0 broadcast 10.47.2.63&lt;br /&gt;groupname ipmp3&lt;br /&gt;e1000g2:1: flags=9040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 4&lt;br /&gt;inet 10.47.2.12 netmask ffffffc0 broadcast 10.47.2.63&lt;br /&gt;e1000g2:2: flags=9040842&lt;BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 4&lt;br /&gt;inet 10.47.2.12 netmask ff000000 broadcast 10.255.255.255&lt;br /&gt;e1000g3: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 5&lt;br /&gt;inet 3.208.169.203 netmask ffffffc0 broadcast 3.208.169.255&lt;br /&gt;groupname ipmp0&lt;br /&gt;e1000g3:1: flags=9040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 5&lt;br /&gt;inet 3.208.169.204 netmask ffffffc0 broadcast 3.208.169.255&lt;br /&gt;e1000g3:2: flags=9040842&lt;BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER&gt; mtu 1500 index 5&lt;br /&gt;inet 3.208.169.204 netmask ff000000 broadcast 3.255.255.255&lt;br /&gt;nxge0: flags=69040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE&gt; mtu 1500 index 6&lt;br /&gt;inet 10.47.2.13 netmask ffffffc0 broadcast 10.47.2.63&lt;br /&gt;groupname ipmp3&lt;br /&gt;nxge1: flags=69040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE&gt; mtu 1500 index 7&lt;br /&gt;inet 3.208.169.205 netmask ffffffc0 broadcast 3.208.169.255&lt;br /&gt;groupname ipmp0&lt;br /&gt;nxge2: flags=69040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE&gt; mtu 1500 index 8&lt;br /&gt;inet 10.47.2.78 netmask ffffffe0 broadcast 10.47.2.95&lt;br /&gt;groupname ipmp2&lt;br /&gt;nxge3: flags=69040843&lt;UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE&gt; mtu 1500 index 9&lt;br /&gt;inet 10.47.2.84 netmask ffffffe0 broadcast 10.47.2.95&lt;br /&gt;groupname ipmp1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;From the above output its clear that On Ownserver01&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;e1000g0 is 10.47.2.76 and e1000g1 is 10.47.2.82 - For Private Interconnect&lt;br /&gt;e1000g2 is 10.47.2.11 - For Shared Storage (NAS)&lt;br /&gt;e1000g3 is 3.208.169.203 - For Public &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;On Ownserver02&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;e1000g0 is 10.47.2.79 and e1000g1 is 10.47.2.85 - For Private Interconnect&lt;br /&gt;e1000g2 is 10.47.2.14 - For Shared Storage (NAS)&lt;br /&gt;e1000g3 is 3.208.169.207 - For Public&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Checked for SSH and SCP in /usr/local/bin/&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The cluster verification utility(runcluvfy.sh ) checks for scp and ssh in /usr/local/bin/.&lt;br /&gt;Create soft links of ssh and scp in /usr/local/bin/ if they are not there.&lt;br /&gt;cd /usr/local/bin/&lt;br /&gt;ls -l&lt;br /&gt;lrwxrwxrwx 1 root root 12 Apr 25 16:57 /usr/local/bin/scp -&gt; /usr/bin/scp&lt;br /&gt;lrwxrwxrwx 1 root root 12 Apr 25 16:57 /usr/local/bin/ssh -&gt; /usr/bin/ssh&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Checked SSH equivalency between the nodes&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;ownserver01 [SHCL1DR1]$ ssh ownserver01 date&lt;br /&gt;ssh_exchange_identification: Connection closed by remote host&lt;br /&gt;ownserver01 [SHCL1DR1]$&lt;br /&gt;mkdir ~/.ssh&lt;br /&gt;chmod 700 ~/.ssh&lt;br /&gt;/usr/bin/ssh-keygen -t rsa&lt;br /&gt;usr/bin/ssh-keygen -t dsa&lt;br /&gt;touch ~/.ssh/authorized_keys&lt;br /&gt;ssh ownserver01 cat /home/oracle/.ssh/id_rsa.pub &gt;&gt;authorized_keys&lt;br /&gt;Passowrd: *****&lt;br /&gt;ssh ownserver01 cat /home/oracle/.ssh/id_dsa.pub &gt;&gt;authorized_keys&lt;br /&gt;Password: *****&lt;br /&gt;ssh ownserver02 cat /home/oracle/.ssh/id_rsa.pub &gt;&gt;authorized_keys&lt;br /&gt;Password: *****&lt;br /&gt;ssh ownserver02 cat /home/oracle/.ssh/id_dsa.pub&gt;&gt;authorized_keys&lt;br /&gt;Password:*****&lt;br /&gt;&lt;strong&gt;From Ownserver01&lt;/strong&gt;&lt;br /&gt;ownserver01 [SHCL1DR1]$ ssh OWNSERVER01 date&lt;br /&gt;ownserver01 [SHCL1DR1]$ ssh OWNSERVER02 date&lt;br /&gt;&lt;strong&gt;From Ownserver02&lt;/strong&gt;&lt;br /&gt;ownserver02 [SHCL1DR2]$ ssh OWNSERVER01 date&lt;br /&gt;ownserver02 [SHCL1DR2]$ ssh OWNSERVER02 date&lt;br /&gt;The time on both nodes were same at any time.&lt;br /&gt;I made sure that from Ownserver01 i could SSH to ownserver02 and also to ownserver01 itself and the same from Ownserver02 too.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Note: also mv /etc/issue to /etc/issue.bak or user equivalence will fail – This clears the login banner. (this may be for Solaris only)&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Checked for file /usr/lib/libdce.so [ Metalink Note Note:333348.1]&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The 10gR2 installer on Soalris 64 bit fails if the file /usr/lib/libdce.so is present.&lt;br /&gt;Check Metalink Note Note:333348.1 for the workaround.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Configure the .profile of user ORACLE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;stty cs8 -istrip -parenb&lt;br /&gt;PATH=/usr/bin:/usr/local/bin&lt;br /&gt;EDITOR=/usr/bin/vi&lt;br /&gt;#umask 077&lt;br /&gt;umask 022&lt;br /&gt;ulimit -c 0&lt;br /&gt;export PATH EDITOR&lt;br /&gt;set -o vi&lt;br /&gt;export ORACLE_BASE=/u01/app/oracle&lt;br /&gt;export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1&lt;br /&gt;export OH=$ORACLE_HOME&lt;br /&gt;export ORA_CRS_HOME=$ORACLE_BASE/product/crs&lt;br /&gt;export CH=$ORA_CRS_HOME&lt;br /&gt;export ORACLE_SID=SHCL1DR1&lt;br /&gt;#export NLS_LANG=Japanese_Japan.UTF8&lt;br /&gt;export NLS_LANG=AMERICAN_AMERICA.UTF8&lt;br /&gt;export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/sbin:/usr/bin:/usr/ccs/bin:/usr/ucb:/etc:/usr/X/bin:/usr/openwin/bin:/usr/local/bin:/usr/sbin&lt;br /&gt;export PS1=`hostname`” [$ORACLE_SID]\$ “&lt;br /&gt;####&lt;br /&gt;alias bdump=’cd /u01/app/oracle/admin/SHCL1/bdump/’&lt;br /&gt;alias talert=’tail -f $ORACLE_BASE/admin/SHCL1/bdump/alert_$ORACLE_SID.log’&lt;br /&gt;alias tns=’cd $ORACLE_HOME/network/admin’&lt;br /&gt;alias udump=’cd /u01/app/oracle/admin/SHCL1/bdump/’&lt;br /&gt;alias valert=’view $ORACLE_BASE/admin/SHCL1/bdump/alert_$ORACLE_SID.log’&lt;br /&gt;alias home=’cd $ORACLE_HOME’&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Created the directories on both nodes&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For ORACLE_BASE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;mkdir -p /u01/app/oracle&lt;br /&gt;chown -R ORACLE:oinstall /u01/app/oracle&lt;br /&gt;chmod -R 770 /u01/app/oracle&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For ORA_CRS_HOME&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;mkdir -p /u01/app/oracle/product/crs&lt;br /&gt;chown -R root:oinstall /u01/app/oracle/product/crs&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For ORACLE_HOME [RDBMS]&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;mkdir -p /u01/app/oracle/product/10.2.0/db_1&lt;br /&gt;chown -R ORACLE:oinstall /u01/app/oracle/product/10.2.0/db_1&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For OCR and Voting disks&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;mkdir -p /u02/oracle/crs/&lt;br /&gt;mkdir -p /u03/oracle/crs/&lt;br /&gt;mkdir -p /u04/oracle/crs/&lt;br /&gt;Check the privileges on the directories [should be ORACLE:oinstall]&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Created OCR and Voting Disk files&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In Linux, the oracle provided cluster file system OCSF2 is used on the shared disk,so ‘touch’ ing ocr_disk1 and vote_disk1would do.&lt;br /&gt;But since i used NAS as the shared storage (which is mounted on each nodes), i had to create raw files for ocr and voting disk.&lt;br /&gt;OCR&lt;br /&gt;&lt;br /&gt;chown root:oinstall /u02/oracle/crs/ocr_disk1&lt;br /&gt;chown root:oinstall /u03/oracle/crs/ocr_disk2&lt;br /&gt;chmod 660 /u02/oracle/crs/ocr_disk1&lt;br /&gt;chmod 660 /u03/oracle/crs/ocr_disk2&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;VOTING DISK&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;chown ORACLE:oinstall /u02/oracle/crs/vote_disk1&lt;br /&gt;chown ORACLE:oinstall /u03/oracle/crs/vote_disk2&lt;br /&gt;chown ORACLE:oinstall /u04/oracle/crs/vote_disk3&lt;br /&gt;chmod 660 /u02/oracle/crs/vote_disk1&lt;br /&gt;chmod 660 /u03/oracle/crs/vote_disk2&lt;br /&gt;chmod 660 /u04/oracle/crs/vote_disk3&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Downloaded and unzipped Oracle 10.2.0.1 installation files&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;10gr2_cluster_sol.cpio&lt;br /&gt;10gr2_companion_sol.cpio&lt;br /&gt;10gr2_db_sol.cpio&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Run the Cluster Verification Utility available in &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;10gr2_cluster_sol.cpio&lt;br /&gt;ownserver01 [SHCL1DR1]$ ./runcluvfy.sh stage -pre crsinst -n OWNSERVER01,OWNSERVER02 -verbose&lt;br /&gt;Performing pre-checks for cluster services setup&lt;br /&gt;Checking node reachability…&lt;br /&gt;Check: Node reachability from node “ownserver01″&lt;br /&gt;Destination Node Reachable?&lt;br /&gt;———————————— ————————&lt;br /&gt;OWNSERVER01 yes&lt;br /&gt;OWNSERVER02 yes&lt;br /&gt;Result: Node reachability check passed from node “ownserver01″.&lt;br /&gt;Checking user equivalence…&lt;br /&gt;Check: User equivalence for user “ORACLE”&lt;br /&gt;Node Name Comment&lt;br /&gt;———————————— ————————&lt;br /&gt;OWNSERVER02 passed&lt;br /&gt;OWNSERVER01 passed&lt;br /&gt;Result: User equivalence check passed for user “ORACLE”.&lt;br /&gt;Checking administrative privileges…&lt;br /&gt;Check: Existence of user “ORACLE”&lt;br /&gt;Node Name User Exists Comment&lt;br /&gt;———— ———————— ————————&lt;br /&gt;OWNSERVER02 yes passed&lt;br /&gt;OWNSERVER01 yes passed&lt;br /&gt;Result: User existence check passed for “ORACLE”.&lt;br /&gt;Check: Existence of group “oinstall”&lt;br /&gt;Node Name Status Group ID&lt;br /&gt;———— ———————— ————————&lt;br /&gt;OWNSERVER02 exists 300&lt;br /&gt;OWNSERVER01 exists 300&lt;br /&gt;Result: Group existence check passed for “oinstall”.&lt;br /&gt;Check: Membership of user “ORACLE” in group “oinstall” [as Primary]&lt;br /&gt;Node Name User Exists Group Exists User in Group Primary Comment&lt;br /&gt;—————- ———— ———— ———— ———— ————&lt;br /&gt;OWNSERVER02 yes yes yes yes passed&lt;br /&gt;OWNSERVER01 yes yes yes yes passed&lt;br /&gt;Result: Membership check for user “ORACLE” in group “oinstall” [as Primary] passed.&lt;br /&gt;Administrative privileges check passed.&lt;br /&gt;Checking node connectivity…&lt;br /&gt;Interface information for node “OWNSERVER02″&lt;br /&gt;Interface Name IP Address Subnet&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;e1000g0 10.47.2.79 10.47.2.64&lt;br /&gt;e1000g0 10.47.2.80 10.47.2.64&lt;br /&gt;e1000g0 10.47.2.80 10.0.0.0&lt;br /&gt;e1000g1 10.47.2.85 10.47.2.64&lt;br /&gt;e1000g1 10.47.2.86 10.47.2.64&lt;br /&gt;e1000g1 10.47.2.86 10.0.0.0&lt;br /&gt;e1000g2 10.47.2.14 10.47.2.0&lt;br /&gt;e1000g2 10.47.2.15 10.47.2.0&lt;br /&gt;e1000g2 10.47.2.15 10.0.0.0&lt;br /&gt;e1000g3 3.208.169.207 3.208.169.192&lt;br /&gt;e1000g3 3.208.169.208 3.208.169.192&lt;br /&gt;e1000g3 3.208.169.208 3.0.0.0&lt;br /&gt;nxge0 10.47.2.16 10.47.2.0&lt;br /&gt;nxge1 3.208.169.209 3.208.169.192&lt;br /&gt;nxge2 10.47.2.81 10.47.2.64&lt;br /&gt;nxge3 10.47.2.87 10.47.2.64&lt;br /&gt;Interface information for node “OWNSERVER01″&lt;br /&gt;Interface Name IP Address Subnet&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;e1000g0 10.47.2.76 10.47.2.64&lt;br /&gt;e1000g0 10.47.2.77 10.47.2.64&lt;br /&gt;e1000g0 10.47.2.77 10.0.0.0&lt;br /&gt;e1000g1 10.47.2.82 10.47.2.64&lt;br /&gt;e1000g1 10.47.2.83 10.47.2.64&lt;br /&gt;e1000g1 10.47.2.83 10.0.0.0&lt;br /&gt;e1000g2 10.47.2.11 10.47.2.0&lt;br /&gt;e1000g2 10.47.2.12 10.47.2.0&lt;br /&gt;e1000g2 10.47.2.12 10.0.0.0&lt;br /&gt;e1000g3 3.208.169.203 3.208.169.192&lt;br /&gt;e1000g3 3.208.169.204 3.208.169.192&lt;br /&gt;e1000g3 3.208.169.204 3.0.0.0&lt;br /&gt;nxge0 10.47.2.13 10.47.2.0&lt;br /&gt;nxge1 3.208.169.205 3.208.169.192&lt;br /&gt;nxge2 10.47.2.78 10.47.2.64&lt;br /&gt;nxge3 10.47.2.84 10.47.2.64&lt;br /&gt;Check: Node connectivity of subnet “10.47.2.64″&lt;br /&gt;Source Destination Connected?&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER02:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER02:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER02:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER02:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER02:nxge3 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER02:nxge3 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER02:nxge2 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER02:nxge3 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:nxge3 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:nxge3 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:nxge3 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:nxge3 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER02:nxge3 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER01:e1000g1 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER01:e1000g1 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER01:e1000g1 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER01:e1000g1 OWNSERVER01:nxge2 yes&lt;br /&gt;OWNSERVER01:e1000g1 OWNSERVER01:nxge3 yes&lt;br /&gt;OWNSERVER01:nxge2 OWNSERVER01:nxge3 yes&lt;br /&gt;Result: Node connectivity check passed for subnet “10.47.2.64″ with node(s) OWNSERVER02,OWNSERVER01.&lt;br /&gt;Check: Node connectivity of subnet “10.0.0.0″&lt;br /&gt;Source Destination Connected?&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER02:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g0 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER02:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g1 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g0 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g1 yes&lt;br /&gt;OWNSERVER01:e1000g0 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER01:e1000g1 OWNSERVER01:e1000g2 yes&lt;br /&gt;Result: Node connectivity check passed for subnet “10.0.0.0″ with node(s) OWNSERVER02,OWNSERVER01.&lt;br /&gt;Check: Node connectivity of subnet “10.47.2.0″&lt;br /&gt;Source Destination Connected?&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER02:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER02:nxge0 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:nxge0 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER02:nxge0 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:e1000g2 OWNSERVER01:nxge0 yes&lt;br /&gt;OWNSERVER02:nxge0 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:nxge0 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER02:nxge0 OWNSERVER01:nxge0 yes&lt;br /&gt;OWNSERVER01:e1000g2 OWNSERVER01:e1000g2 yes&lt;br /&gt;OWNSERVER01:e1000g2 OWNSERVER01:nxge0 yes&lt;br /&gt;OWNSERVER01:e1000g2 OWNSERVER01:nxge0 yes&lt;br /&gt;Result: Node connectivity check passed for subnet “10.47.2.0″ with node(s) OWNSERVER02,OWNSERVER01.&lt;br /&gt;Check: Node connectivity of subnet “3.208.169.192″&lt;br /&gt;Source Destination Connected?&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER02:e1000g3 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER02:nxge1 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:nxge1 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER02:nxge1 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:nxge1 yes&lt;br /&gt;OWNSERVER02:nxge1 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER02:nxge1 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER02:nxge1 OWNSERVER01:nxge1 yes&lt;br /&gt;OWNSERVER01:e1000g3 OWNSERVER01:e1000g3 yes&lt;br /&gt;OWNSERVER01:e1000g3 OWNSERVER01:nxge1 yes&lt;br /&gt;OWNSERVER01:e1000g3 OWNSERVER01:nxge1 yes&lt;br /&gt;Result: Node connectivity check passed for subnet “3.208.169.192″ with node(s) OWNSERVER02,OWNSERVER01.&lt;br /&gt;Check: Node connectivity of subnet “3.0.0.0″&lt;br /&gt;Source Destination Connected?&lt;br /&gt;—————————— —————————— —————-&lt;br /&gt;OWNSERVER02:e1000g3 OWNSERVER01:e1000g3 yes&lt;br /&gt;Result: Node connectivity check passed for subnet “3.0.0.0″ with node(s) OWNSERVER02,OWNSERVER01.&lt;br /&gt;Suitable interfaces for VIP on subnet “3.208.169.192″:&lt;br /&gt;OWNSERVER02 e1000g3:3.208.169.207 e1000g3:3.208.169.208&lt;br /&gt;OWNSERVER01 e1000g3:3.208.169.203 e1000g3:3.208.169.204&lt;br /&gt;Suitable interfaces for VIP on subnet “3.208.169.192″:&lt;br /&gt;OWNSERVER02 nxge1:3.208.169.209&lt;br /&gt;OWNSERVER01 nxge1:3.208.169.205&lt;br /&gt;I ignored the last messages about the VIP, as i knew there wasn’t any problem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Click “Add” to add the second node&lt;br /&gt;Public Node Name :ownserver02&lt;br /&gt;Private Node Name:ownserver02ipmp1&lt;br /&gt;Virtual Host Name:ownserverv02&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On Ownserver01&lt;br /&gt;bash-3.00# /u01/app/oracle/oraInventory/orainstRoot.sh&lt;br /&gt;Changing permissions of /u01/app/oracle/oraInventory to 770.&lt;br /&gt;Changing groupname of /u01/app/oracle/oraInventory to oinstall.&lt;br /&gt;The execution of the script is complete&lt;br /&gt;bash-3.00# ls -l /u01/app/oracle/product/crs/root.sh&lt;br /&gt;-rwxr-xr-x 1 ORACLE oinstall 105 Apr 30 11:14 /u01/app/oracle/product/crs/root.sh&lt;br /&gt;bash-3.00# /u01/app/oracle/product/crs/root.sh&lt;br /&gt;WARNING: directory ‘/u01/app/oracle/product’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app/oracle’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01′ is not owned by root&lt;br /&gt;Checking to see if Oracle CRS stack is already configured&lt;br /&gt;Setting the permissions on OCR backup directory&lt;br /&gt;Setting up NS directories&lt;br /&gt;Oracle Cluster Registry configuration upgraded successfully&lt;br /&gt;WARNING: directory ‘/u01/app/oracle/product’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app/oracle’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01′ is not owned by root&lt;br /&gt;Successfully accumulated necessary OCR keys.&lt;br /&gt;Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.&lt;br /&gt;node &lt;nodenumber&gt;: &lt;nodename&gt; &lt;private interconnect name&gt; &lt;hostname&gt;&lt;br /&gt;node 1: ownserver01 ownserver01ipmp1 ownserver01&lt;br /&gt;node 2: ownserver02 ownserver02ipmp1 ownserver02&lt;br /&gt;Creating OCR keys for user ‘root’, privgrp ‘root’..&lt;br /&gt;Operation successful.&lt;br /&gt;Now formatting voting device: /u02/oracle/crs/vote_disk1&lt;br /&gt;Now formatting voting device: /u03/oracle/crs/vote_disk2&lt;br /&gt;Now formatting voting device: /u04/oracle/crs/vote_disk3&lt;br /&gt;Format of 3 voting devices complete.&lt;br /&gt;Startup will be queued to init within 30 seconds.&lt;br /&gt;Adding daemons to inittab&lt;br /&gt;Expecting the CRS daemons to be up within 600 seconds.&lt;br /&gt;CSS is active on these nodes.&lt;br /&gt;ownserver01&lt;br /&gt;CSS is inactive on these nodes.&lt;br /&gt;ownserver02&lt;br /&gt;Local node checking complete.&lt;br /&gt;Run root.sh on remaining nodes to start CRS daemons.&lt;br /&gt;bash-3.00# /u01/app/oracle/product/crs/root.sh&lt;br /&gt;WARNING: directory ‘/u01/app/oracle/product’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app/oracle’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01′ is not owned by root&lt;br /&gt;Checking to see if Oracle CRS stack is already configured&lt;br /&gt;Setting the permissions on OCR backup directory&lt;br /&gt;Setting up NS directories&lt;br /&gt;Oracle Cluster Registry configuration upgraded successfully&lt;br /&gt;WARNING: directory ‘/u01/app/oracle/product’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app/oracle’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01/app’ is not owned by root&lt;br /&gt;WARNING: directory ‘/u01′ is not owned by root&lt;br /&gt;clscfg: EXISTING configuration version 3 detected.&lt;br /&gt;clscfg: version 3 is 10G Release 2.&lt;br /&gt;Successfully accumulated necessary OCR keys.&lt;br /&gt;Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.&lt;br /&gt;node &lt;nodenumber&gt;: &lt;nodename&gt; &lt;private interconnect name&gt; &lt;hostname&gt;&lt;br /&gt;node 1: ownserver01 ownserver01ipmp1 ownserver01&lt;br /&gt;node 2: ownserver02 ownserver02ipmp1 ownserver02&lt;br /&gt;clscfg: Arguments check out successfully.&lt;br /&gt;NO KEYS WERE WRITTEN. Supply -force parameter to override.&lt;br /&gt;-force is destructive and will destroy any previous cluster&lt;br /&gt;configuration.&lt;br /&gt;Oracle Cluster Registry for cluster has already been initialized&lt;br /&gt;Startup will be queued to init within 30 seconds.&lt;br /&gt;Adding daemons to inittab&lt;br /&gt;Expecting the CRS daemons to be up within 600 seconds.&lt;br /&gt;CSS is active on these nodes.&lt;br /&gt;ownserver01&lt;br /&gt;ownserver02&lt;br /&gt;CSS is active on all nodes.&lt;br /&gt;Waiting for the Oracle CRSD and EVMD to start&lt;br /&gt;Oracle CRS stack installed and running under init(1M)&lt;br /&gt;Running vipca(silent) for configuring nodeapps&lt;br /&gt;Creating VIP application resource on (2) nodes…&lt;br /&gt;Creating GSD application resource on (2) nodes…&lt;br /&gt;Creating ONS application resource on (2) nodes…&lt;br /&gt;Starting VIP application resource on (2) nodes…&lt;br /&gt;Starting GSD application resource on (2) nodes…&lt;br /&gt;Starting ONS application resource on (2) nodes…&lt;br /&gt;Done.&lt;strong&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-7387913649705275514?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/7387913649705275514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2008/08/oracle-rac-installation-on-solaris.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/7387913649705275514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/7387913649705275514'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2008/08/oracle-rac-installation-on-solaris.html' title='Oracle RAC installation on Solaris SPARC 64 bit'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-2515501977532815209</id><published>2008-04-25T19:56:00.002-07:00</published><updated>2009-08-31T22:40:17.065-07:00</updated><title type='text'>Knowing when to Rebuild Indexes</title><content type='html'>&lt;strong&gt;Abstract&lt;/strong&gt;&lt;br /&gt;Indexes provide a fast and efficient method of retrieving selected data from a table. By pointing to the blocks that contain the selected data, the entire table does not have to read in order to extract the required information. Most indexes in Oracle databases are built using the B-tree data structure. Contrary to some widely accepted beliefs, indexes in Oracle are not self-balancing. After a table experiences a large number of inserts, updates, and deletes, the index can become unbalanced and fragmented and can hinder query performance. Knowing when to rebuild the indexes is a topic of some confusion. This paper hopes to shine some light on the subject.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Where is the index now?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;In order to understand what we must do with the index, we must first get an idea of the current state of the index. This can be accomplished by using the ANALYZE INDEX VALIDATE STRUCTURE command. Normally, the ANALYZE INDEX command creates either computed or estimated statistics for the index that can be seen in the DBA_INDEXES view. Analyzing the index changes the optimizer’s execution plans for queries that potentially use that index. This action may produce unintentional side effects, especially if the index has not previously been analyzed. The VALIDATE STRUCTURE command can be safely executed without affecting the optimizer. The VALIDATE STRUCTURE command populates the SYS.INDEX_STATS table only. The SYS.INDEX_STATS table can be accessed with the public synonym INDEX_STATS. The INDEX_STATS table will only hold validation information for one index at a time. You will need to query this table before validating the structure of the next index.&lt;br /&gt;&lt;br /&gt;Below is an example of ANALYZE INDEX VALIDATE STRUCTURE and sample output from INDEX_STATS:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; ANALYZE INDEX shopping_basket_pk VALIDATE STRUCTURE;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Statement processed.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; SELECT name,height,lf_rows,lf_blks,del_lf_rows,distinct_keys,used_space&lt;/em&gt;&lt;br /&gt;&lt;em&gt;2&gt; FROM INDEX_STATS;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NAME HEIGHT LF_ROWS LF_BLKS DEL_LF_ROW DISTINCT_K USED_SPACE------------------------- --------- ---------- ---------- ---------- ---------- ----------SHOPPING_BASKET_PK 2 1 3 1 1 65&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;1 row selected.&lt;br /&gt;&lt;/em&gt;&lt;strong&gt;I have the information, now what?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;There are two rules of thumb to help determine if the index needs to be rebuilt. If it is determined that the index needs to be rebuilt, this can easily be accomplished by the ALTER INDEX REBUILD command. Although not necessarily recommended, this command could be executed during normal operating hours. Rebuilding the index uses the existing index as a basis. The alternative is to drop and re-create the index. Creating an index uses the base table as its data source that needs to put a lock on the table. The index is also unavailable during creation.&lt;br /&gt;&lt;br /&gt;First rule of thumb is if the index has height greater than four, rebuild the index. For most indexes, the height of the index will be quite low, i.e. one or two. I have seen an index on a 3 million-row table that had height three. An index with height greater than four may need to be rebuilt as this might indicate a skewed tree structure. This can lead to unnecessary database block reads of the index. It is helpful to know the data structure for the table and index. Most times, the index height should be two or less, but there are exceptions.&lt;br /&gt;&lt;br /&gt;The second rule of thumb is that the deleted leaf rows should be less than 20% of the total number of leaf rows. An excessive number of deleted leaf rows indicates that a high number of deletes or updates have occurred to the index column(s). The index should be rebuilt to better balance the tree. The INDEX_STATS table can be queried to determine if there are excessive deleted leaf rows in relation to the total number of leaf rows. Let’s look at an example:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; ANALYZE INDEX item_basket_pk VALIDATE STRUCTURE;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Statement processed.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 as ratio 2&gt; FROM INDEX_STATS;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NAME HEIGHT LF_ROWS DEL_LF_ROW RATIO&lt;/em&gt;&lt;br /&gt;&lt;em&gt;------------------------------ ---------- ---------- ---------- ----------ITEM_BASKET_PK 1 235 74 31.4893617&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;1 row selected.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;In this example, the ratio of deleted leaf rows to total leaf rows is clearly above 20%. This is a good candidate for rebuilding. Let’s rebuild the index and examine the results.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; ALTER INDEX item_basket_pk REBUILD;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Statement processed.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; ANALYZE INDEX item_basket_pk VALIDATE STRUCTURE;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Statement processed.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;SQLWKS&gt; SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 as ratio&lt;/em&gt;&lt;br /&gt;&lt;em&gt;2&gt; FROM INDEX_STATS;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NAME HEIGHT LF_ROWS DEL_LF_ROW RATIO ------------------------------ ---------- ---------- ---------- ----------ITEM_BASKET_PK 1 161 0 0&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;1 row selected.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The index is rebuilt and validated once again. Examining the INDEX_STATS table shows that the 74 deleted leaf rows were dropped from the index. Notice that the total number of leaf rows went from 235 to 161, which is a difference of 74 leaf rows. This index should provide better performance for the application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;A Case Study&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;To illustrate the ideas in this paper, a test case was created and various queries were executed against a large table before and after rebuilding the primary key index. It should be noted that this test case was created specifically for this paper and results in the field may vary.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The test table only contains two columns, ID and NAME. The table is described below:&lt;br /&gt;REQ SQL&gt; desc analyze;&lt;br /&gt;Name Null? Type&lt;br /&gt;------------------------------- -------- ----&lt;br /&gt;ID NUMBER NAME VARCHAR2(20)&lt;br /&gt;&lt;br /&gt;The test table has a primary key, ANALYZE_PK on the ID field. The test table was populated with 1 million rows of data. After populating the table, over 270,000 rows were selectively deleted from the table. This method ensured that the primary key index would have a sufficient number of deleted leaf rows. After populating and deleting rows from the table, the index was validated as below:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;REQ SQL&gt; analyze index analyze_pk validate structure; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Index analyzed.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;REQ SQL&gt; select name,height,lf_rows,del_lf_rows,del_lf_rows/lf_rows from index_stats;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NAME HEIGHT LF_ROWS DEL_LF_ROWS DEL_LF_ROWS/LF_ROWS------------------------------ ---------- ---------- ----------- -------------------ANALYZE_PK 3 990206 277353 .280096263&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;It is now clear that the deleted leaf rows comprise approximately 28% of the total leaf rows.&lt;br /&gt;&lt;br /&gt;Four different queries were executed against the table. All of these queries will utilize the primary key index as verified by the explain plan. These queries are executed against the table with the current index. The index is then rebuilt. These queries are re-executed and the results are compared. The four queries are:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;1. select count(*) from analyze where id between 250000 and 600000;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;2. select count(*) from analyze where id in (50000,4321,698754);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;3. select count(*) from analyze where id &gt; 500000;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;4. select count(*) from analyze where id = 4321;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;With the current index, these three queries are executed against the test table. SQL Trace is enabled and the queries are shown in the following excerpt from TKPROF: ********************************************************************************&lt;br /&gt;select count(*) from analyze where id between 250000 and 600000&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.47 0.47 0 293 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.47 0.47 0 293 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSE&lt;br /&gt;Parsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;138614 INDEX (RANGE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id in (50000,4321,698754)&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.01 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.00 0.00 0 9 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.00 0.01 0 9 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSE&lt;br /&gt;Parsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;0 CONCATENATION&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id &gt; 500000&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 1.11 1.11 0 1611 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 1.11 1.11 0 1611 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 1&lt;br /&gt;Optimizer goal: CHOOSEParsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;445545 INDEX (RANGE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id = 4321&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.00 0.00 0 3 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.00 0.00 0 3 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 1&lt;br /&gt;Optimizer goal: CHOOSEParsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;&lt;br /&gt;After these results have been obtained, the index is rebuilt. The index is then validated and the results are show below:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;REQ SQL&gt; alter index analyze_pk rebuild;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Index altered.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;REQ SQL&gt; analyze index analyze_pk validate structure;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Index analyzed.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;REQ SQL&gt; select name,height,lf_rows,del_lf_rows,del_lf_rows/lf_rows from index_stats;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NAME HEIGHT LF_ROWS DEL_LF_ROWS DEL_LF_ROWS/LF_ROWS------------------------------ ---------- ---------- ----------- -------------------ANALYZE_PK 3 712853 0 0&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;It is clear that the deleted leaf rows have been removed from the index. The four queries are run against the table once again. Again, SQL Trace is enabled and the queries are shown in the following excerpt from TKPROF:&lt;br /&gt;&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id between 250000 and 600000&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.23 0.23 0 679 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.23 0.23 0 679 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSEParsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;138614 INDEX (RANGE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id in (50000,4321,698754)&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.00 0.00 0 9 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.00 0.00 0 9 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSEParsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;0 CONCATENATION&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id &gt; 500000&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.96 0.96 0 933 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.96 0.96 0 933 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSEParsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan&lt;br /&gt;------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;445545 INDEX (RANGE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;********************************************************************************&lt;br /&gt;select count(*) from analyze where id = 4321&lt;br /&gt;&lt;br /&gt;call count cpu elapsed disk query current rows&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;Parse 1 0.00 0.00 0 0 0 0&lt;br /&gt;Execute 1 0.00 0.00 0 0 0 0&lt;br /&gt;Fetch 2 0.00 0.00 0 3 0 1&lt;br /&gt;------- ------ -------- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;total 4 0.00 0.00 0 3 0 1&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSEParsing user id: 5 (SYSTEM)&lt;br /&gt;&lt;br /&gt;Rows Execution Plan------- ---------------------------------------------------&lt;br /&gt;0 SELECT STATEMENT GOAL: CHOOSE&lt;br /&gt;0 SORT (AGGREGATE)&lt;br /&gt;1 INDEX (UNIQUE SCAN) OF 'ANALYZE_PK' (UNIQUE)&lt;br /&gt;&lt;br /&gt;The same queries have now been executed against the test table before and after rebuilding the index. The results are summarized in the following table:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Before index rebuild After index rebuild % Change&lt;br /&gt;CPU Elapsed CPU Elapsed CPU Elapsed&lt;br /&gt;Query 1 0.47 0.47 0.23 0.23 51% 51%&lt;br /&gt;Query 2 0.00 0.01 0.00 0.00 0% 0%&lt;br /&gt;Query 3 1.11 1.11 0.96 0.96 13.5% 13.5%&lt;br /&gt;Query 4 0.00 0.00 0.00 0.00 0% 0%&lt;br /&gt;&lt;br /&gt;The results in the above table show that queries 1 and 3 experienced up to 51% improvement in execution time. It should be noted that the queries were executed at least once prior to tracing the queries so that the data would reside in the buffer cache and first time executions of the queries would not skew the results. This fact explains why the CPU and elapsed times for a query are nearly identical. The data was read from the buffer cache. Queries 2 and 4 took minimal time to execute. These queries searched for specific values. Since the data was cached, the CPU and Elapsed times are minimal. Queries 1 and 3 took significantly longer. These queries returned a range of values. This paper does not attempt to generate any findings on the improvement of different types of queries when rebuilding an index. Rather it gives a broader statement that query execution times will improve after rebuilding substandard indexes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Script to find indexes to rebuild&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Below is a sample script that can be run to determine which indexes need to be rebuilt. For those indexes that need to be rebuilt, the ALTER INDEX REBUILD command is dynamically generated as output. The user can tailor the height and percentage of deleted leaf rows by altering the vMaxHeight and vMaxDel variables. The output of this script can be spooled to a file. This file can then be run to rebuild the indexes.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;-- validate_idx.sql&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- by Arun Mahendran&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- Database Administrator&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- 26 April 2008&lt;/em&gt;&lt;br /&gt;&lt;em&gt;--- This script will check indexes to find candidates for rebuilding.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- Run this script in SQL*Plus as a user with SELECT ANY TABLE&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- privileges.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;---- This script can be used and modified without permission. Run this&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- script at your own risk! The script author is not responsible for&lt;/em&gt;&lt;br /&gt;&lt;em&gt;-- any problems that may arise from running this script.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;set serveroutput on size 100000&lt;/em&gt;&lt;br /&gt;&lt;em&gt;DECLARE&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vOwner dba_indexes.owner%TYPE; /* Index Owner&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vIdxName dba_indexes.index_name%TYPE; /* Index Name&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vAnalyze VARCHAR2(100); /* String of Analyze Stmt&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vCursor NUMBER; /* DBMS_SQL cursor&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vNumRows INTEGER; /* DBMS_SQL return rows&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vHeight index_stats.height%TYPE; /* Height of index tree&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vLfRows index_stats.lf_rows%TYPE; /* Index Leaf Rows&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vDLfRows index_stats.del_lf_rows%TYPE; /* Deleted Leaf Rows&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vDLfPerc NUMBER; /* Del lf Percentage&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vMaxHeight NUMBER; /* Max tree height&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ vMaxDel NUMBER; /* Max del lf percentage&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*/ &lt;/em&gt;&lt;br /&gt;&lt;em&gt;CURSOR cGetIdx IS SELECT owner,index_name&lt;/em&gt;&lt;br /&gt;&lt;em&gt;FROM dba_indexes WHERE OWNER NOT LIKE 'SYS%';&lt;/em&gt;&lt;br /&gt;&lt;em&gt;BEGIN&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* Define maximums. This section can be customized. */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vMaxHeight := 3;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vMaxDel := 20;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* For every index, validate structure */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;OPEN cGetIdx;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;LOOP&lt;/em&gt;&lt;br /&gt;&lt;em&gt;FETCH cGetIdx INTO vOwner,vIdxName;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;EXIT WHEN cGetIdx%NOTFOUND;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* Open DBMS_SQL cursor */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vCursor := DBMS_SQL.OPEN_CURSOR;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* Set up dynamic string to validate structure */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vAnalyze := 'ANALYZE INDEX ' vOwner '.' vIdxName '&lt;/em&gt;&lt;br /&gt;&lt;em&gt;VALIDATE STRUCTURE';&lt;/em&gt;&lt;br /&gt;&lt;em&gt;DBMS_SQL.PARSE(vCursor,vAnalyze,DBMS_SQL.V7);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vNumRows := DBMS_SQL.EXECUTE(vCursor);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* Close DBMS_SQL cursor */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;DBMS_SQL.CLOSE_CURSOR(vCursor);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* Does index need rebuilding? */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* If so, then generate command */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;SELECT height,lf_rows,del_lf_rows INTO vHeight,vLfRows,vDLfRows&lt;/em&gt;&lt;br /&gt;&lt;em&gt;FROM INDEX_STATS;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;IF vDLfRows = 0 THEN&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/* handle case where div by zero */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vDLfPerc := 0;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;ELSE&lt;/em&gt;&lt;br /&gt;&lt;em&gt;vDLfPerc := (vDLfRows / vLfRows) * 100;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;END IF;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;IF (vHeight &gt; vMaxHeight) OR (vDLfPerc &gt; vMaxDel) THEN DBMS_OUTPUT.PUT_LINE('ALTER INDEX ' vOwner '.' &lt;/em&gt;&lt;br /&gt;&lt;em&gt;vIdxName ' REBUILD;');&lt;/em&gt;&lt;br /&gt;&lt;em&gt;END IF;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;END LOOP;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;CLOSE cGetIdx;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;END;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/&lt;/em&gt;&lt;br /&gt;&lt;strong&gt;Summary&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;One of the areas lacking in Oracle documentation pertains to rebuilding an index. Oracle’s ANALYZE INDEX VALIDATE STRUCTURE command provides a nice way to check an index to see if it is a candidate for rebuilding. This command does not affect the Oracle optimizer’s execution plan for queries that may use the index. The results in the INDEX_STATS are checked after issuing the VALIDATE STRUCTURE command. If an index has excessive height (greater than four) or a high number of deleted leaf rows (over 20% of the total), we rebuild the index.&lt;br /&gt;A test case was studied to show the potential for improvements after rebuilding an index. In one example, the query executed 51% faster after rebuilding the index. While this example is specific to the test case, it does show the potential for improvement after rebuilding an index.&lt;br /&gt;Keywords:&lt;br /&gt;&lt;h1&gt;Index Index Rebuild Rebuild Index Online ALTER INDEX REBUILD ANALYZE INDEX VALIDATE STRUCTURE ANALYZE INDEX LF_ROWS DEL_LF_ROW &lt;/h1&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-2515501977532815209?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/2515501977532815209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2008/04/knowing-when-to-rebuild-indexes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/2515501977532815209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/2515501977532815209'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2008/04/knowing-when-to-rebuild-indexes.html' title='Knowing when to Rebuild Indexes'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-4191416972803494818</id><published>2008-04-17T00:49:00.000-07:00</published><updated>2009-08-31T22:41:12.998-07:00</updated><title type='text'>Increase in Controlfile Size ???</title><content type='html'>In Oracle8i and higher, if the MAXDATAFILES limit is reached the controlfile will expand automatically.In Oracle 8i and higher, when you issue CREATE DATABASE or CREATE CONTROLFILE statements, the MAXDATAFILES parameter specifies an initial size of the datafile portion of the control file.&lt;br /&gt;&lt;br /&gt;Later, if you add a file whose number exceeds MAXDATAFILES but is less than or equal to the value specified by the DB_FILES initialization parameter, the control file automatically expands to allow the datafile portion to accommodate more files.&lt;br /&gt;&lt;br /&gt;We can have DB_FILES set to more than the value of MAXDATAFILES.However note that these DB_FILES parameter value should be within the OS kernel limits.&lt;br /&gt;&lt;br /&gt;Refer to Note 144638.1 - Relationship Between Common Init.ora Parameters and Unix Kernel Parameters.&lt;br /&gt;&lt;br /&gt;If you are adding datafiles to the database and is within the DB_FILES limit, you will get an error only if control file is unable to allocate more space. Recreating the control file is not required to increase the MAXDATAFILES parameter.It is not good to have a high DB_FILES parameter value ( much higher than required ). Increasing the value of DB_FILES increases the size of the PGA, or Program Global Area, which is allocated for every user process connected to ORACLE.&lt;br /&gt;KeyWords:&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;&lt;strong&gt;CREATE CONTROLFILE CREATE DATABASE controlfile 144638.1 Unix Kernel Parameters OS kernel limits controlfile size&lt;/strong&gt;&lt;/h1&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-4191416972803494818?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/4191416972803494818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2008/04/increase-in-controlfile-size.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/4191416972803494818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/4191416972803494818'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2008/04/increase-in-controlfile-size.html' title='Increase in Controlfile Size ???'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-780970947075523306</id><published>2008-03-18T20:51:00.002-07:00</published><updated>2009-08-31T22:41:48.052-07:00</updated><title type='text'>RMAN Recovery Methods</title><content type='html'>&lt;a href="http://bp0.blogger.com/_cSEWIZogIIc/R-CTX0f7ckI/AAAAAAAAAAs/NMcRHm4k69Q/s1600-h/mod9.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5179301608914907714" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_cSEWIZogIIc/R-CTX0f7ckI/AAAAAAAAAAs/NMcRHm4k69Q/s320/mod9.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;RMAN Recovery Methods&lt;/strong&gt;&lt;br /&gt;When performing a restore operation, it is best to open two telnet sessions, one for SQL commands, and one for RMAN commands. For the rest of this document, RMAN commands will be prefaced with the RMAN&gt; prompt, and SQL commands will be prefaced with the SQL&gt; prompt. A $ indicates that the command is executed from the Unix prompt.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Restoring and Recovering All Datafiles&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;In this scenario, it is assumed that your control files are still accessible. You have a backup, done for example with backup database plus archivelog;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Your first step is to make sure that the target database is shut down: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;$ sqlplus “/ as SYSDBA”&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;SQL&gt; shutdown abort;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;ORACLE instance shut down.&lt;/span&gt;&lt;/div&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Next, you need to start up your target database in mount mode. RMAN cannot restore datafiles unless the database is at least in mount mode, because RMAN needs to be able to access the control file to determine which backup sets are necessary to recover the database. If the control file isn't available, you have to recover it first. Issue the STARTUP MOUNT command shown in the following example to mount the database: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;SQL&gt; startup mount;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;Oracle instance started.&lt;br /&gt;Database mounted&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Since backup set files are created in an RMAN-specific format, you must use RMAN to restore the datafiles. To use RMAN, connect to the target database: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;The remainder of this example shows how to restore all of the datafiles of the target database. When the restore command is executed, RMAN will automatically go to its last good backup set and restore the datafiles to the state they were in when that backup set was created.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;When restoring database files, RMAN reads the datafile header and makes the determination as to whether the file needs to be restored. The recovery is done by allocating a channel for I/O and then issuing the RMAN restore database command. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;With Oracle9i and above, you don't need to allocate a channel explicitly. Instead, you can use the default channel mode: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;RMAN&gt; restore database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;For Oracle8i, the ALLOCATE, RESTORE, and RECOVER commands need to be enclosed by the run{} command: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;RMAN&gt; run {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;allocate channel d1 type disk;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;restore database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;recover database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;alter database open;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Once the recovery has been completed, execute a complete RMAN backup to establish a new baseline.&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;Restoring Specific Tablespaces&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;In this scenario, it is assumed that your control files are still accessible. You have a backup, done for example with backup database plus archivelog;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Take the tablespace that needs recovery offline, restore the tablespace, recover the tablespace, and bring the tablespace online. If you cannot take the tablespace offline, then shutdown abort the database and restore in mount mode.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;First try to take the tablespace offline;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;$ sqlplus "/ as sysdba"&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter tablespace tab offline;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;If this works, continue with the RMAN recovery:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; restore tablespace tab;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover tablespace tab;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter tablespace tab online;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;If taking the tablespace offline fails, follow these steps:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;$ sqlplus “/ as SYSDBA”&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; shutdown abort;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; startup mount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; restore tablespace tab;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover tablespace tab;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Once the recovery has been completed, execute a complete RMAN backup to establish a new baseline.&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;Restoring Specific Datafiles&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;In this scenario, it is assumed that your control files are still accessible. You have a backup, done for example with backup database plus archivelog;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Take the datafile that needs recovery offline, restore the datafile, recover the datafile, and bring the datafile online. If you cannot take the datafile offline, then shutdown abort the database and restore in mount mode.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;First try to take the datafile offline:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;SQL&gt; alter database datafile '/u01/oracle/db/AKI1/tab/AKI1_tab.dbf' offline;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;If this works, continue with the RMAN recovery:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;RMAN&gt; restore datafile '/u01/oracle/db/AKI1/tab/AKI1_tab.dbf'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover datafile '/u01/oracle/db/AKI1/tab/AKI1_tab.dbf'&lt;br /&gt;SQL&gt; alter database datafile '/u01/oracle/db/AKI1/tab/AKI1_tab.dbf' online;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;If taking the datafile offline fails, follow these steps:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;$ sqlplus “/ as SYSDBA”&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; shutdown abort;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; startup mount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; restore datafile '/u01/oracle/db/AKI1/tab/AKI1_tab.dbf';&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover datafile '/u01/oracle/db/AKI1/tab/AKI1_tab.dbf';&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Once the recovery has been completed, execute a complete RMAN backup to establish a new baseline.&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Restoring Control Files&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;In this scenario, it is assumed that your control files are backed up. You have a backup, done for example with backup database plus archivelog;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;In an ideal world you'll never use RMAN to restore a control file. But if something catastrophic happens, and you lose all control files, here are the steps for getting them back: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;The following examples assume that you are using a catalog. First, here's the simplest Oracle9i syntax for restoring a control file: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;$ sqlplus “/ as SYSDBA”&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; shutdown abort;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; startup nomount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Set the database id (DBID) with the following command. This is a 10-digit number that RMAN uses to uniquely identify this database in the recovery log. The number can be obtained from any previous RMAN backup log file.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;RMAN&gt; set dbid = xxxxxxxxxx;&lt;br /&gt;RMAN&gt; restore controlfile;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database mount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;If this fails with ...&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;ORA-01589: must use RESETLOGS or NORESETLOGS option for database open&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;... then you must perform a recover database:&lt;br /&gt;SQL&gt; shutdown abort;&lt;br /&gt;&lt;div&gt;SQL&gt; startup mount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open resetlogs;&lt;br /&gt;RMAN&gt; reset database;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;Note, that all offline archivelogs are now useless, perform a full back as soon as possible.&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Restoring Online Redologs&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;In this scenario, it is assumed that your control files are backed up. You have a backup, done for example with backup database plus archivelog;&lt;br /&gt;&lt;br /&gt;$ sqlplus "/ as sysdba"&lt;br /&gt;&lt;div&gt;SQL&gt; shutdown abort;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; startup nomount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Set the database id (DBID) with the following command. This is a 10-digit number that RMAN uses to uniquely identify this database in the recovery log. The number can be obtained from any previous RMAN backup log file.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;RMAN&gt; set dbid = xxxxxxxxxx;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; restore controlfile;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database mount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; restore database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAM&gt; recover database;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;RMAN-00571:=========================================================&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS=============&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;RMAN-00571:=========================================================&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;RMAN-03002: failure of recover command at 09/28/2004 11:03:23&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#66ffff;"&gt;RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 8448414&lt;/span&gt;&lt;/div&gt;&lt;span style="color:#66ffff;"&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;Since the online logs were lost, complete recovery is not possible. Open the database with resetlogs to continue.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;RMAN&gt; alter database open resetlogs;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;-------------------------------------IMPORTANT-------------------------------------------&lt;br /&gt;During this type of recovery, if you receive error messages like this:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;RMAN&gt; restore database;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Starting restore at 11-JUL-05&lt;br /&gt;&lt;br /&gt;using channel ORA_SBT_TAPE_1&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;RMAN-00571:=========================================================&lt;br /&gt;RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============&lt;br /&gt;RMAN-00571:========================================================&lt;br /&gt;RMAN-03002: failure of restore command at 07/11/2005 14:25:22&lt;br /&gt;RMAN-06026: some targets not found - aborting restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 10 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 9 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 8 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 7 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 6 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 5 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 4 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 3 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 2 found to restore&lt;br /&gt;RMAN-06023: no backup or copy of datafile 1 found to restore&lt;br /&gt;&lt;br /&gt;…use the following directions to recover (recreate the controlfile):&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;1.With the database mounted, execute ‘alter database backup controlfile to trace resetlogs;’&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;2.Perform a shutdown abort on the database, but remain at the SQL&gt; prompt.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;3.In another telnet session, go to the udump directory to retrieve the resulting trace file and copy it to another location to edit it.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;4.Edit the file and add the phrase “until cancel” to the recover database command at the end. The phrase should read “recover database until cancel using backup controlfile”. Remove the “alter database open” command after the recover command. Save the file with a .sql extension.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;5.Back at the SQL&gt; prompt, execute the modified trace file. When prompted for an archived log, type in “cancel” and the reply should be “media recovery cancelled”.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;6.Issue “alter database open resetlogs”. The database should open after a few moments.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;7.Connect to the RMAN recovery catalog and issue the “reset database” command.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;8.Perform a full RMAN backup as soon as possible.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;----------------------------------------------------------------------------------------&lt;br /&gt;Time-Based, Change-Based, or SCN-based Incomplete Recovery&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Incomplete recovery uses a backup to produce a non-current version of the database. In other words, youdo not apply all of the redo records generated after the most recent backup.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;You usually perform incomplete recovery of the whole database in the following situations:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Media failure destroys some or all of the online redo logs.&lt;br /&gt;A user error causes data loss, for example, a user inadvertently drops a table.&lt;br /&gt;You cannot perform complete recovery because an archived redo log is missing.&lt;br /&gt;You lose your current control file and must use a backup control file to open the database. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;To perform incomplete media recovery, you must restore all datafiles from backups created prior to the time to which you want to recover and then open the database with the RESETLOGS option when recovery completes. The RESETLOGS operation creates a new incarnation of the database; in other words, a database with a new stream of log sequence numbers starting with log sequence 1.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;NOTE – Start every RMAN incomplete recovery with the following commands:&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ sqlplus "/ as sysdba"&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; shutdown abort;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; startup mount;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;--For time-based recovery, use these commands:&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;RMAN&gt; restore database until time "to_date('07/12/05 12:0:00','MM/DD/YY HH24:MI:SS')RMAN&gt; recover database until time "to_date('07/12/05 12:0:00','MM/DD/YY HH24:MI:SS')&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;media recovery complete.SQL&gt; alter database open resetlogs;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;--For SCN-based recovery, user these commands:&lt;br /&gt;&lt;/strong&gt;RMAN&gt; restore database until scn 1000;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; recover database until scn 1000;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;media recovery complete.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open resetlogs;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;--For change-based recovery, user these commands:&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;RMAN&gt; restore database until sequence 9923; --Archived log sequence number&lt;br /&gt;&lt;div&gt;RMAN&gt; recover database until sequence 9923; --Archived log sequence numbermedia recovery complete.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&gt; alter database open resetlogs;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Once the recovery has been completed, execute the following steps:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Delete prior backups with this command (from the RMAN prompt):&lt;br /&gt;&lt;br /&gt;RMAN&gt; delete force backup;&lt;br /&gt;&lt;br /&gt;This command removes all prior backups from the RMAN catalog as they can no longer be used once the database has been restarted with the resletlogs option. After completing this command, create a new RMAN backup to establish a new baseline.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Recovering Archived Logs only &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In the event that you want to recover the database archived redo logs until a desired time, you can use the following commands:&lt;br /&gt;&lt;br /&gt;$ rman target / rcvcat &lt;a href="mailto:rcvcat/rcvcat@oemprod"&gt;rcvcat/rcvcat@oemprod&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;RMAN&gt; restore ARCHIVELOG FROM TIME 'SYSDATE-1' UNTIL TIME 'SYSDATE';&lt;br /&gt;or&lt;br /&gt;RMAN&gt; restore ARCHIVELOG FROM TIME "to_date('07/11/05 00:00:01','MM/DD/YY HH24:MI:SS')UNTIL TIME 'SYSDATE';&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;By&lt;/div&gt;&lt;br /&gt;&lt;div&gt;-6N&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Keywords:&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;&lt;strong&gt;RMAN Recovery Methods Restoring and Recovering All Datafiles Recovering Datafiles ALLOCATE, RESTORE, and RECOVER commands RMAN backup Restoring Specific Tablespaces Restoring Specific Datafiles Restoring Control Files offline archivelogs Restoring Online Redologs Perform a full RMAN backup Incomplete recovery Time-Based, Change-Based, or SCN-based Incomplete Recovery&lt;br /&gt;&lt;/h1&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-780970947075523306?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/780970947075523306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2008/03/rman-recovery-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/780970947075523306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/780970947075523306'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2008/03/rman-recovery-methods.html' title='RMAN Recovery Methods'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_cSEWIZogIIc/R-CTX0f7ckI/AAAAAAAAAAs/NMcRHm4k69Q/s72-c/mod9.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-6337598048935222160</id><published>2008-03-05T20:53:00.003-08:00</published><updated>2009-08-31T22:42:09.571-07:00</updated><title type='text'>Hot Backup internals</title><content type='html'>&lt;strong&gt;Why do I have to put a tablespace into a special hot backup mode when I perform a backup with operating system 'copy' or 'cp' commands? Why can't I just copy the files?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;An operating system doesn't understand how Oracle works internally. So when you ask it to copy a database file, it has no idea of the significance of the internal organisation of the file it's copying, and simply copies whichever pieces of it happen to swing under the disk head from time to time. That is unfortunate for two separate reasons.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First, Oracle uses the first database block within every data file (known as the data file header block) to store that file's checkpoint change number -and it is this number which acts as the 'timestamp' for the entire data file. Since a recovery involves applying redo which was generated after the 'time' of a data file, it's important that the checkpoint change number for a data file faithfully records the earliest age of any part of that data file. We can then roll everything forward from that earliest point, and arrive at a totally consistent file as a whole. But if the checkpoint change number happens to state a time which is later than the actual time of even just one part of the data file's contents, then Oracle will not know to roll that particular piece of the file forward, and it will be 'left behind'. You'll have a corrupt data file on your hands, and an unrecoverable tablespace -and if it's the SYSTEM tablespace we're talking about, you've just lost your entire database.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example, suppose my data file's checkpoint change number reads '1000', but there are actually blocks of data in that file which are actually from time '900'. During a recovery, Oracle will think it should apply redo from time 1000 onwards (because that's what the data file's header block tells it). But that leaves some blocks very out-of-synch with the rest of the file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So the data file's header block is crucial in telling us the point from which we need to start rolling forward. But if you are doing a hot backup, then the instance&lt;a title="instance: A set of memory structures and processes which open, manage and access an Oracle database. Instances completely cease to exist when they are shutdown: they are entirely virtual entities. The largest component of the instance is the SGA. An insta" href="http://www.dizwell.com/prod/glossary/term/28"&gt;?&lt;/a&gt; (specifically, the CKPT background process) may need to update the contents of that block whilst the file is being copied. That would not be a problem if the operating system was smart enough to know that the data file header block should be the first block copied... but, because it doesn't understand the internal organisation of an Oracle datafile, it doesn't know that. It may therefore copy that block after CKPT has updated it... and the backup file is therefore immediately rendered useless for recovery purposes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now that is our first problem with just copying hot data files: parts of a data file being out of synchronisation with each other, and with an unreliable checkpoint change number in the data file header, mean the data file as a whole is unusable. But the same sort of problem also arises within an Oracle block itself. We tend to think of an Oracle block as a single entity -but it isn't. Physically, an Oracle block is made up of multiple operating system blocks: for example, an 8K database block is usually comprised of 16 separate O/S blocks (because most O/S blocks are 512 bytes in size). For an Oracle block to be readable by an instance, all 16 of those O/S blocks must be synchronised, or from the same 'database time'. Unfortunately, if it's an operating system utility which is copying the database blocks, that utility has no idea that all 16 O/S blocks need to be kept synchronised: it just copies whichever of them happen to turn up under the disk head at any one moment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But if people are actually modifying the contents of an Oracle block during the copy operation (which is definitely possible during a hot backup, of course), then you could conceivably end up with a copy of what we think of as a single Oracle block that is actually from 16 different database times. Such a block copy is termed a fractured block, and it's unusable in a recovery scenario.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So if you just copy your datafiles, whilst they're in use, you will end up with inconsistent block images, and a datafile header block that does not correctly describe the time of the entire datafile. Such a copy is useless.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;OK, but what precisely does the begin backup command do to prevent these problems arising? &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Two separate things. To deal with the data file header block not accurately describing the earliest time of the contents of the data file, the command causes the header block to be locked from all further updates by the CKPT process. If the data file header block is locked, so that it records the database time from just before it started to be copied, it must tell a valid point from which to start applying redo in a recovery scenario.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example, if I lock the header block when it contains a checkpoint change number of '1000'; and if I then take half an hour to copy the entire file; then there are bound to be blocks within the resulting backup file from time 1100, 1200, 1400 and so on. But there will not be blocks from a time before 1000, and therefore no bits of the file would get 'forgotten' during a recovery.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Second: to deal with the fractured block issue, the begin backup command sets a flag which tells Oracle that the first piece of DML to modify any part of a block whilst its file is being copied will cause the entire block to be written to the redo logs. This ensures that whilst the image of the block in the backup file is fractured, and hence useless, there is a clean image of the block in the redo stream -which we can obviously use to replace the fractured version during a recovery operation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;I think I understand. Can you show me these two things happening?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Sure. The locked datafile header block is easiest to demonstrate. First, I issue this piece of SQL:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT T.NAME, H.FILE#, H.CHECKPOINT_CHANGE#&lt;br /&gt;&lt;br /&gt;FROM V$TABLESPACE T, V$DATAFILE_HEADER H&lt;br /&gt;&lt;br /&gt;WHERE T.TS#=H.TS#;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NAME FILE# CHECKPOINT_CHANGE#&lt;br /&gt;&lt;br /&gt;SYSTEM 1 121923&lt;br /&gt;&lt;br /&gt;UNDOTBS 2 121923&lt;br /&gt;&lt;br /&gt;INDX 3 121923&lt;br /&gt;&lt;br /&gt;TOOLS 4 121923&lt;br /&gt;&lt;br /&gt;USERS 5 121923&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, all tablespaces (and all data files) start off synchronised with the same checkpoint change number. Now let's go through the motion of beginning a hot backup and see what happens:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;alter tablespace users begin backup;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select t.name, h.file#, h.checkpoint_change#&lt;br /&gt;&lt;br /&gt;from v$tablespace t, v$datafile_header h&lt;br /&gt;&lt;br /&gt;where t.ts#=h.ts#;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NAME FILE# CHECKPOINT_CHANGE&lt;br /&gt;&lt;br /&gt;SYSTEM 1 121923&lt;br /&gt;&lt;br /&gt;UNDOTBS 2 121923&lt;br /&gt;&lt;br /&gt;INDX 3 121923&lt;br /&gt;&lt;br /&gt;TOOLS 4 121923&lt;br /&gt;&lt;br /&gt;USERS 5 121925&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do you notice how the USERS tablespace is now actually slightly ahead of the time the rest of the database has gotten to? That's because, as a tablespace is put into hot backup, any dirty buffers which belong to that tablespace are flushed by DBWR from the buffer cache back down to disk. CKPT then updates the time in that file's header block. In short, putting a tablespace into hot backup causes that tablespace (alone) to be checkpointed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That datafile doesn't stay ahead of the rest of the database for long, however. If we simulate some transactional activity on the database, we can check the timestamps again:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;alter system switch logfile;&lt;br /&gt;&lt;br /&gt;alter system switch logfile;&lt;br /&gt;&lt;br /&gt;alter system switch logfile;&lt;br /&gt;&lt;br /&gt;alter system switch logfile;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;At each log switch (which would normally be caused by users continuing to perform transactions, of course), a system-wide checkpoint is issued. So if we now check the data file headers again, we should see some changes:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select t.name, h.file#, h.checkpoint_change#&lt;br /&gt;&lt;br /&gt;from v$tablespace t, v$datafile_header h&lt;br /&gt;&lt;br /&gt;where t.ts#=h.ts#;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NAME FILE# CHECKPOINT_CHANGE&lt;br /&gt;&lt;br /&gt;SYSTEM 1 121939&lt;br /&gt;&lt;br /&gt;UNDOTBS 2 121939&lt;br /&gt;&lt;br /&gt;INDX 3 121939&lt;br /&gt;&lt;br /&gt;TOOLS 4 121939&lt;br /&gt;&lt;br /&gt;USERS 5 121925&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You might need to look at those numbers carefully to spot the effect, but if you do, you'll see that file 5 is no longer ahead of the pack. In fact, it's still stuck very firmly at timestamp 121925, whilst the other files have moved on to later times. Of course, the checkpoint change number reported here for file 5 is a complete lie in a sense: the contents of file 5 will be just as much at time 121939 as the rest of the database. But the 'begin backup' has locked the header so that it reports the time the file started being backed up, not the time of its contents.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;OK. The data file header issue I can see. What about the block-sized redo thing?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;That one's a bit harder to demonstrate. We'll first have to run an Oracle script that makes it possible to see how much redo a transaction generates. Then we can perform the same transaction when the data file is not being backed up and compare it with when it is.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First, I connect to my database as a normal user -in this case, as Scott. I then run the Oracle-supplied UTLXPLAN.SQL script. And as SYS, I then grant Scott the DBA role as a quick-fix way of allowing Scott to make use of the redo-measuring features that the UTLXPLAN script makes possible:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sqlplus scott/tiger&lt;br /&gt;&lt;br /&gt;@%ORACLE_HOME%\rdbms\admin\utlxplan.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;connect / as sysdba&lt;br /&gt;&lt;br /&gt;grant dba to scott;&lt;br /&gt;&lt;br /&gt;connect scott/tiger&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now we can test the amount of redo a transaction generates normally:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;set autotrace trace stat&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;update emp set sal=900 where ename='MILLER';&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;&lt;br /&gt;339 recursive calls&lt;br /&gt;&lt;br /&gt;3 db block gets&lt;br /&gt;&lt;br /&gt;65 consistent gets&lt;br /&gt;&lt;br /&gt;5 physical reads&lt;br /&gt;&lt;br /&gt;188 redo size&lt;br /&gt;&lt;br /&gt;631 bytes sent via SQL*Net to client&lt;br /&gt;&lt;br /&gt;548 bytes received via SQL*Net from client&lt;br /&gt;&lt;br /&gt;3 SQL*Net roundtrips to/from client&lt;br /&gt;&lt;br /&gt;8 sorts (memory)&lt;br /&gt;&lt;br /&gt;0 sorts (disk)&lt;br /&gt;&lt;br /&gt;1 rows processed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;set autotrace trace stat&lt;/strong&gt; command means we get to see a short report about what went on inside Oracle to process the update command I issued. As you can see, the update of Miller's salary generated 188 bytes of redo. That's what this particular update generates â€œnormallyâ€. Now, let me put the tablespace where the EMP table lives into hot backup and issue exactly the same update:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;alter tablespace users begin backup;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;update emp set sal=900 where ename='MILLER';&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;&lt;br /&gt;2 db block gets&lt;br /&gt;&lt;br /&gt;3 consistent gets&lt;br /&gt;&lt;br /&gt;0 physical reads&lt;br /&gt;&lt;br /&gt;8740 redo size&lt;br /&gt;&lt;br /&gt;632 bytes sent via SQL*Net to client&lt;br /&gt;&lt;br /&gt;548 bytes received via SQL*Net from client&lt;br /&gt;&lt;br /&gt;3 SQL*Net roundtrips to/from client&lt;br /&gt;&lt;br /&gt;1 sorts (memory)&lt;br /&gt;&lt;br /&gt;0 sorts (disk)&lt;br /&gt;&lt;br /&gt;1 rows processed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Suddenly, the exact same transaction now generates 8,740 bytes of redo. That's an extra 8,552 bytes, or a 4500% increase! The reason is not hard to find:&lt;br /&gt;&lt;br /&gt;Keywords:&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;&lt;strong&gt;Hot Backup internals special hot backup mode suppose my data file's checkpoint CKPT has updated it oracle hot backup Oracle hotbackup Internals of Oracle hotbackup Internals of Oracle hot backup how hot backup works what is happening in hot backup begin backup alter tablespace set autotrace trace stat system-wide checkpoint &lt;/h1&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-6337598048935222160?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/6337598048935222160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2008/03/hot-backup-internals_05.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/6337598048935222160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/6337598048935222160'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2008/03/hot-backup-internals_05.html' title='Hot Backup internals'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1624281472776718399.post-8053655437584508548</id><published>2008-03-05T03:54:00.000-08:00</published><updated>2009-08-31T22:42:29.354-07:00</updated><title type='text'>Oracle Memory Tuning</title><content type='html'>Redo Log Buffer Latches&lt;br /&gt;Database Buffer Cache Size&lt;br /&gt;Shared Pool Size&lt;br /&gt;&lt;br /&gt;&lt;a name="Redo_Log_Buffer_Latches"&gt;&lt;strong&gt;Redo Log Buffer Latches&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When a transaction is ready to write its changes to the redo log, it first has to grab the Redo Allocation Latch, of which there is only one, to keep others from writing to the log at the same time.  If someone else has that latch, it has to wait for the latch, resulting in a "miss".&lt;br /&gt;&lt;br /&gt;Once it grabs that latch, if the change is larger than log_small_entry_max_size bytes and if your server has multiple CPU's, it then tries to grab a Redo Copy Latch, of which there can be up to 2 times the number of CPU's, which would allow it to release the Redo Allocation Latch for someone else to use.  If none of them are available, resulting in an "immediate miss", it will not wait for a Redo Copy Latch (thus, the "immediate"), but, instead, hangs on to the Redo Allocation Latch until the change is written.&lt;br /&gt;&lt;br /&gt;Oracle keeps statistics for these latches in v$latch, including the number of gets and misses for the Redo Allocation Latch and the number of immediate gets and immediate misses for the Redo Copy Latches, which are cumulative values since instance startup.  If you've got a 100% hit ratio for either of those latch types, that's a good thing.  It just means that all of your transactions were able to grab and use the latch without retrying. It's when you get below a 99% hit ratio that you need to start looking out. The following sql figures the current hit ratios for those latches:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;column latch_name format a20&lt;br /&gt;select name latch_name, gets, misses,&lt;br /&gt;round(decode(gets-misses,0,1,gets-misses)/&lt;br /&gt;decode(gets,0,1,gets),3) hit_ratio&lt;br /&gt;from v$latch where name = 'redo allocation';&lt;br /&gt;&lt;br /&gt;column latch_name format a20&lt;br /&gt;select name latch_name, immediate_gets, immediate_misses,&lt;br /&gt;round(decode(immediate_gets-immediate_misses,0,1,&lt;br /&gt;immediate_gets-immediate_misses)/&lt;br /&gt;decode(immediate_gets,0,1,immediate_gets),3) hit_ratio&lt;br /&gt;from v$latch where name = 'redo copy';&lt;br /&gt;&lt;br /&gt;If your Redo Allocation Latch hit ratio consistently falls below 99%, and if you have a multi-CPU machine, you can lower the value for log_small_entry_max_size (see below) in your init.ora file (ours is currently 800 bytes, but, maybe 100 or so bytes may be better - you'll have to try out different values over time), which says that any change smaller than that will hang onto the Redo Allocation Latch until Oracle is finished writing that change.  Anything larger than that grabs a Redo Copy Latch, if currently available, and releases the Redo Allocation Latch for another transaction to use.&lt;br /&gt;&lt;br /&gt;If your Redo Copy Latch hit ratio consistently falls below 99%, and if you have a multi-CPU machine, you can raise the value of log_simultaneous_copies in your init.ora file up to twice the number of CPU's to provide more Redo Copy Latches (there is only one Redo Allocation Latch, so it is at a premium).  Remember that you have to shut down your database instance and restart it to reread the new parameter values in the init.ora file ($ORACLE_HOME/dbs/initSID.ora).  The following sql shows the current values for those associated parameters:&lt;br /&gt;&lt;br /&gt;column name format a30&lt;br /&gt;column value format a10&lt;br /&gt;select name,value from v$parameter where name in     ('log_small_entry_max_size','log_simultaneous_copies',&lt;br /&gt;'cpu_count');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name="Database_Buffer_Cache_Size"&gt;&lt;strong&gt;Database Buffer Cache Size&lt;/strong&gt;&lt;/a&gt;&lt;a name="Database_Buffer_Cache_Size"&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Database Buffer Cache is part of the Shared Global Area (SGA) in memory for a single database instance (SID) and holds the blocks of data and indexes that you and everyone else is currently using.  It may even contain multiple copies of the same data block if, for example, more than one transaction is making changes to it but not yet committed, or, if you are looking at the original copy (select) and someone else is looking at their modified but uncommitted copy (insert, update, or delete).  The parameters db_block_buffers and db_block_size in your init.ora file determine the size of the buffer cache.   db_block_size, in bytes, is set at database creation, and cannot be changed (unless you recreate the database from scratch), so, the only thing that you can adjust is the number of blocks in db_block_buffers (one buffer holds one block).    &lt;br /&gt;The Database Buffer Cache is part of the Shared Global Area (SGA) in memory for a single database instance (SID) and holds the blocks of data and indexes that you and everyone else is currently using.  It may even contain multiple copies of the same data block if, for example, more than one transaction is making changes to it but not yet committed, or, if you are looking at the original copy (select) and someone else is looking at their modified but uncommitted copy (insert, update, or delete).  The parameters db_block_buffers and db_block_size in your init.ora file determine the size of the buffer cache.   db_block_size, in bytes, is set at database creation, and cannot be changed (unless you recreate the database from scratch), so, the only thing that you can adjust is the number of blocks in db_block_buffers (one buffer holds one block).&lt;br /&gt;&lt;br /&gt;The Cache Hit Ratio shows how many blocks were already in memory (logical reads, which include "db block gets" for blocks you are using and "consistent gets" of original blocks from rollback segments that others are updating) versus how many blocks had to be read from disk ("physical reads").   Oracle recommends that this ratio be at least 80%, but, I like at least 90% myself.   The ratio can be obtained from values in v$sysstat, which are constantly being updated and show statistics since database startup (it is only accessable from a DBA user account).  You will get a more representative sample if the database has been running several hours with normal user transactions taking place.  The Cache Hit Ratio is determined as follows:&lt;br /&gt;&lt;br /&gt;select (1-(pr.value/(dbg.value+cg.value)))*100&lt;br /&gt;from v$sysstat pr, v$sysstat dbg, v$sysstat cg&lt;br /&gt;where pr.name = 'physical reads'&lt;br /&gt;and dbg.name = 'db block gets'&lt;br /&gt;and cg.name = 'consistent gets';&lt;br /&gt;&lt;br /&gt;If you have a low Cache Hit Ratio, you can test to see what the effect of adding buffers would be by putting "db_block_lru_extended_statistics = 1000" in the init.ora file, doing a shutdown and startup of the database, and waiting a few hours to get a representative sample.  Oracle determines how many Additional Cache Hits (ACH) would occur for each query and transaction for each of the 1000 buffer increments (or whatever other maximum value you might want to try out), and places them into the x$kcbrbh table, which is only accessable from user "sys".   To measure the new Cache Hit Ratio with, for example, 100 extra buffers, determine ACH as follows:&lt;br /&gt;&lt;br /&gt;select sum(count) "ACH" from x$kcbrbh where indx &lt; 100;and plug that value into the Cache Hit Ratio formula as follows:select (1-((pr.value-&amp;amp;ACH)/(dbg.value+cg.value)))*100from v$sysstat pr, v$sysstat dbg, v$sysstat cgwhere pr.name = 'physical reads'and dbg.name = 'db block gets'and cg.name = 'consistent gets';If the ratio originally was lower than 80% and is now higher with ACH, you may want to increase db_block_buffers by that number of extra buffers, restarting your database to put the increase into effect.  Be sure to try several values for the number of extra buffers to find an optimum for your work load.  Also, remove db_block_lru_extended_statistics from your init.ora file before restarting your database to stop gathering statistics, which tends to slow down the transaction time.   (Removing that clears the x$kcbrbh table.)  Also, make sure that your server has enough memory to accomodate the increase!If you are running really tight on memory, and the Cache Hit Ratio is running well above 80%, you might want to check the effect of lowering the number of buffers, which would release Oracle memory that could then be used by other processes, but would also potentially slow down database transactions.  To test this, put "db_block_lru_statistics = true" in your init.ora file and restart your database.  This gathers statistics for Additional Cache Misses (ACM) that would occur for each query and transaction for each of the buffer decrements up to the current db_block_buffers value, placing them into the x$kcbcbh table, also only accessable from user "sys".  To measure the new Cache Hit Ratio with, for example, 100 fewer buffers, determine ACM as follows:select sum(count) "ACM" from x$kcbcbhwhere indx &gt;= (select max(indx)+1-100 from x$kcbcbh);&lt;br /&gt;&lt;br /&gt;and plug that value into the Cache Hit Ratio formula as follows:&lt;br /&gt;&lt;br /&gt;select (1-((pr.value+&amp;amp;ACM)/(dbg.value+cg.value)))*100&lt;br /&gt;from v$sysstat pr, v$sysstat dbg, v$sysstat cg&lt;br /&gt;where pr.name = 'physical reads'&lt;br /&gt;and dbg.name = 'db block gets'&lt;br /&gt;and cg.name = 'consistent gets';&lt;br /&gt;&lt;br /&gt;If the ratio is still above 80%, you may want to decrease db_block_buffers by that number of fewer buffers, restarting your database to put the decrease into effect.  Be sure to try several values for the number of fewer buffers to find an optimum for your work load.  Also, remove db_block_lru_statistics from your init.ora file before restarting your database to stop gathering statistics, which tends to slow down the transaction time.  (Removing that clears the x$kcbcbh table.)&lt;br /&gt;&lt;br /&gt;I have three scripts which you can use to figure your instance's optimum number of db_block_buffers.  And  computes the current ratio for the database buffer cache, and can be run from any DBA account.   And computes the resulting ratio for an increase in the buffer cache size of the given number of buffer blocks (figuring ACH itself).  It must be run from user "sys", after a representative sampling time with db_block_lru_extended_statistics in place. .  It must be run from user "sys", after a representative sampling time with db_block_lru_statistics in place.&lt;br /&gt;&lt;br /&gt;&lt;a name="Shared_Pool_Size"&gt;&lt;strong&gt;Shared Pool Size&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Shared Pool is also part of the Shared Global Area (SGA) in memory for a single database instance (SID) and holds the Library Cache with the most recently used SQL statements and parse trees along with PL/SQL blocks, and the Data Dictionary Cache with definitions of tables, views, and other dictionary objects.   Both of those sets of cached objects can be used by one or more users, and are aged out (Least Recently Used) as other objects need the space.  (You can pin large frequently-used objects in the Shared Pool for performance and other reasons, but, I won't go into that here.)&lt;br /&gt;&lt;br /&gt;There are several ratios that you can check after a representative sample time that may indicate that you need to enlarge the shared pool, which is set by the shared_pool_size parameter in your init.ora file and defaults to 3500000 (3.5 Meg).   One indicator is the Library Cache Get Hit Ratio, which shows how many cursors are being shared (SQL statements (gets) which were already found and parsed (gethits) in the shared pool, with no parsing or re-parsing needed), and is determined by:&lt;br /&gt;&lt;br /&gt;select gethits,gets,gethitratio from v$librarycache&lt;br /&gt;where namespace = 'SQL AREA';&lt;br /&gt;&lt;br /&gt;If the gethitratio is less than 90%, you should consider increasing the shared pool size.  Another indicator is the reloads per pin ratio, which shows how many parsed statements (pins) have been aged out (reloaded) of the shared pool for lack of space (ideally 0), and is determined by:&lt;br /&gt;&lt;br /&gt;select reloads,pins,reloads/pins from v$librarycache&lt;br /&gt;where namespace = 'SQL AREA';&lt;br /&gt;&lt;br /&gt;If the reloads/pins ratio is more than 1%, you should consider increasing the shared pool size.  A third indicator, which is not as important as the first two, is the dictionary object getmisses per get ratio, which shows how many cached dictionary object definitions in the dictionary cache are encountering too many misses (aged out?), and is determined by:&lt;br /&gt;&lt;br /&gt;select sum(getmisses),sum(gets),sum(getmisses)/sum(gets)&lt;br /&gt;from v$rowcache;&lt;br /&gt;&lt;br /&gt;If the getmisses/gets ratio is more than 15%, you should consider increasing the shared pool size.&lt;br /&gt;&lt;br /&gt;If these ratios indicate that your shared pool is too small, you can estimate the size of the shared pool by doing the following.  Set the shared_pool_size to a very large number, maybe a fourth or more of your system's available memory, depending on how many other instances and processes that you have running that are also using memory, then shutdown and startup your database and let it run for a representative time (like all day or when a large batch job is running that you want to accomodate), then, figure the memory required for packages and views, memory required for frequently used SQL statements, and memory required for users SQL statements executed, as shown below:&lt;br /&gt;&lt;br /&gt;select sum(sharable_mem) "Packages/Views" from v$db_object_cache;&lt;br /&gt;select sum(sharable_mem) "SQL Statements" from v$sqlarea&lt;br /&gt;where executions &gt; 5;select sum(250 * users_opening) "SQL Users" from v$sqlarea;&lt;br /&gt;&lt;br /&gt;Then, add the above three numbers and multiply the results by 2.5.   Use this estimated size as a guideline for the value for shared_pool_size, changing that parameter to the estimated size or back to the original size and doing another shutdown/startup to put the value into effect. &lt;br /&gt;&lt;br /&gt;select sum(a.spspv) "Packages/Views", sum(a.spssql) "SQL&lt;br /&gt;Statements",&lt;br /&gt;sum(a.spsusr) "SQL Users", round((sum(a.spspv) + sum(a.spssql) +&lt;br /&gt;sum(a.spsusr)) * 2.5,-6) "Estimated shared_pool_size"&lt;br /&gt;from (select sum(sharable_mem) spspv, 0 spssql, 0 spsusr&lt;br /&gt;from v$db_object_cache&lt;br /&gt;union all&lt;br /&gt;select 0, sum(sharable_mem), 0 from v$sqlarea&lt;br /&gt;where executions &gt; 5&lt;br /&gt;union all&lt;br /&gt;select 0, 0, sum(250 * users_opening) from v$sqlarea) a;&lt;br /&gt;&lt;br /&gt;Keywords:&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;&lt;strong&gt;Oracle Memory Tuning Redo Log Buffer Latches Database Buffer Cache Size Shared Pool Size Redo Allocation Latch  v$latch 99% hit ratio  Shared Global Area Database Buffer Cache db_block_size physical reads v$sysstat db block gets db_block_lru_statistics shared_pool_size librarycache pins cached dictionary object definitions shared pool advisery &lt;/h1&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1624281472776718399-8053655437584508548?l=troubleurheart.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://troubleurheart.blogspot.com/feeds/8053655437584508548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://troubleurheart.blogspot.com/2008/03/oracle-memory-tuning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/8053655437584508548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1624281472776718399/posts/default/8053655437584508548'/><link rel='alternate' type='text/html' href='http://troubleurheart.blogspot.com/2008/03/oracle-memory-tuning.html' title='Oracle Memory Tuning'/><author><name>Troubleurheart</name><uri>http://www.blogger.com/profile/11746429569778169935</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='24' src='http://4.bp.blogspot.com/-LRF2iVTyZK8/TkAvbOpFk6I/AAAAAAAACWo/oWsfZhfZIyU/s220/PQAAAII9oOf1vxkRe25vft3h8WSofEPfZIR6eyLQFXpEXUkuMF95DxFoylAiLZvSrmcUR43tH6WrNprylj2n7_oiYyYAm1T1UA2zvnvfdQP8ZvgB7XD8HyWIhglT.jpg'/></author><thr:total>0</thr:total></entry></feed>
