<?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-4528047187449612761</id><updated>2011-11-03T12:34:37.849+01:00</updated><title type='text'>Jaume Bernadó Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4528047187449612761.post-7543667728235886935</id><published>2008-04-05T21:10:00.006+02:00</published><updated>2008-04-08T20:34:55.912+02:00</updated><title type='text'>Migrate users with DBMS_METADATA</title><content type='html'>Do you need to migrate users with all system and object grants ?.  The DBMS_METADATA package helps us on Oracle 9i or higher.  This script collects all information that you need:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;-- DIR_OUTPUT:  directory where create the output script file cr_users.sql.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-family:verdana;" &gt;create procedure EXTRACT_DDL_FOR_USERS as&lt;br /&gt;&lt;br /&gt;no_grant exception;&lt;br /&gt;&lt;br /&gt;pragma exception_init( no_grant, -31608 );&lt;br /&gt;-- to skip the ORA-31608 when no data for the object requested.&lt;br /&gt;&lt;br /&gt;cursor get_username is&lt;br /&gt;select username&lt;br /&gt;from dba_users;&lt;br /&gt;&lt;br /&gt;file_handle utl_file.file_type;&lt;br /&gt;stmt clob;&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;file_handle:=utl_file.fopen('DIR_OUTPUT','cr_users.sql','w',32767);&lt;br /&gt;&lt;br /&gt;for l_user in get_username loop&lt;br /&gt;&lt;br /&gt;-- USERS&lt;br /&gt;stmt := DBMS_METADATA.GET_DDL('USER', l_user.username);&lt;br /&gt;utl_file.put(file_handle, stmt);&lt;br /&gt;&lt;br /&gt;-- SYSTEM GRANTS&lt;br /&gt;begin&lt;br /&gt;   stmt := DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT', l_user.username);&lt;br /&gt;   exception&lt;br /&gt;      when no_grant then stmt := '-- no system grants';&lt;br /&gt;end;&lt;br /&gt;utl_file.put(file_handle,stmt);&lt;br /&gt;&lt;br /&gt;-- OBJECT GRANTS&lt;br /&gt;begin&lt;br /&gt;stmt := DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', l_user.username);&lt;br /&gt;exception&lt;br /&gt;when no_grant then stmt := '-- no object grants';&lt;br /&gt;end;&lt;br /&gt;utl_file.put(file_handle,stmt);&lt;br /&gt;&lt;br /&gt;-- ROLE GRANTS&lt;br /&gt;begin&lt;br /&gt;stmt := DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT', l_user.username);&lt;br /&gt;exception&lt;br /&gt;when no_grant then stmt := '-- no role grants';&lt;br /&gt;end;&lt;br /&gt;utl_file.put(file_handle, stmt);&lt;br /&gt;&lt;br /&gt;-- TABLESPACE QUOTAS&lt;br /&gt;begin&lt;br /&gt;stmt:=DBMS_METADATA.GET_GRANTED_DDL('TABLESPACE_QUOTA',l_user.username);&lt;br /&gt;exception&lt;br /&gt;when no_grant then stmt := '-- no tablespace quota';&lt;br /&gt;end;&lt;br /&gt;utl_file.put(file_handle, stmt);&lt;br /&gt;&lt;br /&gt;-- DEFAULT ROLES&lt;br /&gt;begin&lt;br /&gt;stmt := DBMS_METADATA.GET_GRANTED_DDL('DEFAULT_ROLE', l_user.username);&lt;br /&gt;exception&lt;br /&gt;when no_grant then stmt := '-- no default role';&lt;br /&gt;end;&lt;br /&gt;utl_file.put(file_handle, stmt);&lt;br /&gt;&lt;br /&gt;end loop;&lt;br /&gt;utl_file.fclose(file_handle);&lt;br /&gt;end;&lt;br /&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;font-size:78%;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Then you can execute it with:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:85%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;set long 100000&lt;br /&gt;begin&lt;br /&gt; DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);&lt;br /&gt; extract_ddl_for_users;&lt;br /&gt; DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',FALSE);&lt;br /&gt;end;&lt;br /&gt;/    &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;I use the SET_TRANSFORM_PARAM to add the terminator character statement (;).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4528047187449612761-7543667728235886935?l=jaumebernado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/7543667728235886935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4528047187449612761&amp;postID=7543667728235886935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/7543667728235886935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/7543667728235886935'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/2008/04/migrate-users-with-dbmsmetadata.html' title='Migrate users with DBMS_METADATA'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4528047187449612761.post-1936046648354728373</id><published>2008-03-29T20:41:00.003+01:00</published><updated>2008-04-01T18:13:04.122+02:00</updated><title type='text'>Statistics on Dictionary tables</title><content type='html'>Gathering statistics on dictionary tables (owned by 'sys')  is a recommended 10g best practice. The  automatic statistics gathering job performs this task, but if we use a customized statistics gathering job and switch off the default automatic job then the recommended strategy is don't switch off the automatic job and configure the value of AUTOSTATS_TARGET to ORACLE instead of AUTO using the procedure DBMS_STATS.SET_PARAM:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;DBMS_STATS.SET_PARAM('AUTOSTATS_TARGET','ORACLE');&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;with this configuration we can use our customized job and let the automatic job that runs during the maintenance window gather statistics on dictionary tables.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4528047187449612761-1936046648354728373?l=jaumebernado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/1936046648354728373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4528047187449612761&amp;postID=1936046648354728373' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/1936046648354728373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/1936046648354728373'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/2008/03/statistics-on-dictionary-tables.html' title='Statistics on Dictionary tables'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4528047187449612761.post-1939606236264377389</id><published>2007-12-09T17:53:00.000+01:00</published><updated>2007-12-09T18:21:24.616+01:00</updated><title type='text'>RMAN. To be or not to be about Oracle Backup</title><content type='html'>I have found a lot of sites still using the user-managed backup method. We're in the RMAN century and I believe it's necessary migrate to RMAN for Oracle Backup&amp;amp;Recovery.&lt;br /&gt;&lt;br /&gt;RMAN has a lot of useful functions that free the DBA of awful rutinary tasks. RMAN takes care of our backups and with a simple command you can backup your database without operating system scripts. RMAN provides block level corruption detection during backup and restore, optimize performance and space consumption with backup set compression. With 10g we have the new feature Flash Recovery Area, disk destination space for RMAN backup's that Oracle manage and it's not necessary to be worried about managing free space of our destination backup area. We have to dimension the Flash Recovery Area with the space needed for our backup policy retention.&lt;br /&gt;&lt;br /&gt;There is a lot of information about RMAN but all that you must know is in "Backup and Recovery Advanced User’s Guide" that you can download of &lt;a href="http://www.oracle.com/technology/index.html"&gt;OTN&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4528047187449612761-1939606236264377389?l=jaumebernado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/1939606236264377389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4528047187449612761&amp;postID=1939606236264377389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/1939606236264377389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/1939606236264377389'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/2007/12/rman-to-be-or-not-to-be-about-oracle.html' title='RMAN. To be or not to be about Oracle Backup'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4528047187449612761.post-7812805435546492182</id><published>2007-10-14T16:21:00.000+02:00</published><updated>2007-10-21T18:13:40.424+02:00</updated><title type='text'>Oracle CPU Costing. More information for the optimizer.</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;We collect object statistics, so the optimizer has information about the data distribution to calculate execution plans. But, how the optimizer can get information about our system load ? The answer is CPU costing gathering system statistics in the desired time interval.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;Since Oracle 9i we can collect system statistics manually but it's in 10g where there are two different system statistics options:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul  style="text-align: justify;font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;No workload (default option):  when we don't collect system statistics, the optimizer use CPUSPEEDNW, IOSEEKTIM, IOTFRSPEED from AUX_STATS$ to calculate multiblock read time and single block read time.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul  style="text-align: justify;font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Workload: when we collect system statistics, the AUX_STATS$ will have information of the system load to calculate multiblock read time, single block read time that reflects the system load.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;We can see all of this with a simple example:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;No workload: the AUX_STATS$ has these values stored in my system (10.2.0.3)&lt;/span&gt;:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;span style="font-family:courier new;"&gt;        PNAME                               PVAL1&lt;br /&gt;  ------------------------------ ----------&lt;br /&gt;  CPUSPEEDNW                        524.368&lt;br /&gt;  IOSEEKTIM                              10&lt;br /&gt;  IOTFRSPEED                           4096&lt;br /&gt;  SREADTIM&lt;br /&gt;  MREADTIM&lt;br /&gt;  CPUSPEED&lt;br /&gt;  MBRC&lt;br /&gt;  MAXTHR&lt;br /&gt;  SLAVETHR&lt;br /&gt;&lt;br /&gt;SQL&gt;  create table t1 as select * from all_objects;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into t1 select * from all_objects;&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t1 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t1 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t1 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t1 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; commit;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;set autotrace traceonly explain statitics&lt;br /&gt;&lt;br /&gt;SQL&gt; select * from t1 where object_type = 'SYNONYM';&lt;br /&gt;&lt;br /&gt;121176 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3617692013&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;|   0 | SELECT STATEMENT  |      |   123K|    11M|   &lt;span style="color: rgb(255, 0, 0); font-style: italic; font-weight: bold;"&gt;795   (3)&lt;/span&gt;| 00:00:10 |&lt;br /&gt;|*  1 |  TABLE ACCESS FULL| T1   |   123K|    11M|   &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;795   (3)&lt;/span&gt;| 00:00:10 |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;1 - filter("OBJECT_TYPE"='SYNONYM')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;    1  recursive calls&lt;br /&gt;    0  db block gets&lt;br /&gt;11442  consistent gets&lt;br /&gt;    0  physical reads&lt;br /&gt;    0  redo size&lt;br /&gt;5584938  bytes sent via SQL*Net to client&lt;br /&gt;89254  bytes received via SQL*Net from client&lt;br /&gt; 8080  SQL*Net roundtrips to/from client&lt;br /&gt;    0  sorts (memory)&lt;br /&gt;    0  sorts (disk)&lt;br /&gt;121176  rows processed&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);font-size:100%;" &gt;Workload: gathering system statistics in the time interval when we want to collect, the AUX_STATS$ has in my system these values stored:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);font-size:100%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;PNAME                               PVAL1&lt;br /&gt;------------------------------ ----------&lt;br /&gt;CPUSPEEDNW                        524.368&lt;br /&gt;IOSEEKTIM                              10&lt;br /&gt;IOTFRSPEED                           4096&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;SREADTIM                            23.19&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;MREADTIM                           39.333&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;CPUSPEED                             2812&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;MBRC                                   14&lt;/span&gt;&lt;br /&gt;MAXTHR                              19456&lt;br /&gt;SLAVETHR&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system flush buffer_cache;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system flush shared_pool;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;SQL&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; select * from t1 where object_type = 'SYNONYM';&lt;br /&gt;&lt;br /&gt;121176 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3617692013&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;|   0 | SELECT STATEMENT  |      |   123K|    11M|   &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;432   (1)|&lt;/span&gt; 00:00:11 |&lt;br /&gt;|*  1 |  TABLE ACCESS FULL| T1   |   123K|    11M|   &lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;432   (1)|&lt;/span&gt; 00:00:11 |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;1 - filter("OBJECT_TYPE"='SYNONYM')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;  591  recursive calls&lt;br /&gt;    0  db block gets&lt;br /&gt;11551  consistent gets&lt;br /&gt; 3467  physical reads&lt;br /&gt;    0  redo size&lt;br /&gt;5584938  bytes sent via SQL*Net to client&lt;br /&gt;89254  bytes received via SQL*Net from client&lt;br /&gt; 8080  SQL*Net roundtrips to/from client&lt;br /&gt;    6  sorts (memory)&lt;br /&gt;    0  sorts (disk)&lt;br /&gt;121176  rows processed&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;When we have collected system statistics in the time interval that we consider like representative of the our system load:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt; &lt;span style=";font-family:arial;font-size:85%;"  &gt; exec dbms_stats.gather_system_stats('START');&lt;br /&gt;&lt;br /&gt;.....  interval time&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;        exec dbms_stats.gather_system_stats('STOP');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;The optimizer has more information about the system load that it uses to calculate a more realistic cost on our system.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;The recommendation is to use system statistics with workload mode to supply the optimizer with this strategic information to find the more appropiate execution plan.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;I have done more testing about this topic following the comment of &lt;a href="http://www.davidpujol.blogspot.com/"&gt;David Pujol&lt;/a&gt;.  System statistics can change execution plans, we can see it in this testcase.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify; font-family: arial;"&gt;&lt;span style="font-size:100%;"&gt;I have collected system statistics in a representative workload with:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;exec DBMS_STATS.CREATE_STAT_TABLE ('SYS','STAT_TAB','USERS');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;exec dbms_stats.gather_system_stats('START', NULL, 'STAT_TAB');&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify; font-family: arial;"&gt;&lt;span style="font-family: arial;font-size:100%;" &gt;....  period of time  of a typical workload&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;exec dbms_stats.gather_system_stats('STOP', NULL, 'STAT_TAB');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;SQL&gt;  create table t9 as select * from all_objects;&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;SQL&gt; insert into t9 select * from all_objects;&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t9 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t9 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t9 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;&lt;br /&gt;SQL&gt; R&lt;br /&gt;1* insert into t9 select * from all_objects&lt;br /&gt;&lt;br /&gt;41205 rows created.&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;SQL&gt; commit;&lt;br /&gt;&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;create index i1_t9 on t1(object_type) nologging;&lt;br /&gt;&lt;br /&gt;exec DBMS_STATS.GATHER_TABLE_STATS (ownname=&gt;USER, tabname=&gt; 'T9',estimate_percent=&gt;dbms_stats.auto_sample_size, method_opt=&gt;'for columns size 20 OBJECT_TYPE',cascade=&gt;true, granularity=&gt;'all');&lt;br /&gt;&lt;br /&gt;SQL&gt; SELECT pname, pval1 FROM aux_stats$ WHERE sname = 'SYSSTATS_MAIN';&lt;br /&gt;&lt;br /&gt;PNAME                               PVAL1&lt;br /&gt;------------------------------ ----------&lt;br /&gt;CPUSPEEDNW                        803.781&lt;br /&gt;IOSEEKTIM                              10&lt;br /&gt;IOTFRSPEED                           4096&lt;br /&gt;SREADTIM&lt;br /&gt;MREADTIM&lt;br /&gt;CPUSPEED&lt;br /&gt;MBRC&lt;br /&gt;MAXTHR&lt;br /&gt;SLAVETHR&lt;br /&gt;&lt;br /&gt;SQL&gt;  select owner, object_name, object_type from t9;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3973213776&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;|   0 | SELECT STATEMENT  |      |  3225K|   123M|  9861   (2)| 00:01:59 |&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;|   1 |  TABLE ACCESS FULL| T9   |  3225K|   123M|  9861   (2)| 00:01:59 |&lt;/span&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;SQL&gt;  select owner, object_name, object_type from t9 where object_type='SCHEDULE';&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 533680601&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;-------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;| Id  | Operation                   | Name  | Rows  | Bytes | Cost (%CPU)| Time     |&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;-------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;|   0 | SELECT STATEMENT            |       |   124K|  4846K|  7158   (1)| 00:01:26 |&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;|   1 |  TABLE ACCESS BY INDEX ROWID| T9    |   124K|  4846K|  7158   (1)| 00:01:26 |&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;|*  2 |   INDEX RANGE SCAN          | I1_T9 |   124K|       |   348   (1)| 00:00:05 |&lt;/span&gt;&lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;2 - access("OBJECT_TYPE"='SCHEDULE')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;execute DBMS_STATS.IMPORT_SYSTEM_STATS('STAT_TAB');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;SQL&gt; SELECT pname, pval1 FROM aux_stats$ WHERE sname = 'SYSSTATS_MAIN';&lt;br /&gt;&lt;br /&gt;PNAME                               PVAL1&lt;br /&gt;------------------------------ ----------&lt;br /&gt;CPUSPEEDNW                        803.781&lt;br /&gt;IOSEEKTIM                              10&lt;br /&gt;IOTFRSPEED                           4096&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;SREADTIM                            3.423&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;MREADTIM                            4.243&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;CPUSPEED                             1421&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;MBRC                                   14&lt;/span&gt;&lt;br /&gt;MAXTHR                              13312&lt;br /&gt;SLAVETHR&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system flush buffer_cache;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter system flush shared_pool;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; select owner, object_name, object_type from t9;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3973213776&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;|   0 | SELECT STATEMENT  |      |  3225K|   123M|  4176   (6)| 00:00:15 |&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;|   1 |  TABLE ACCESS FULL| T9   |  3225K|   123M|  4176   (6)| 00:00:15 |&lt;/span&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;SQL&gt; select owner, object_name, object_type from t9 where object_type='SCHEDULE';&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 3973213776&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;|   0 | SELECT STATEMENT  |      |   124K|  4846K|  4209   (7)| 00:00:15 |&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;|*  1 |  TABLE ACCESS FULL| T9   |   124K|  4846K|  4209   (7)| 00:00:15 |&lt;/span&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Predicate Information (identified by operation id):&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;1 - filter("OBJECT_TYPE"='SCHEDULE')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;span style="font-size:85%;"&gt;When we have system statistics in action (workload), the second query has changed the execution plan from INDEX RANGE SCAN to FULL SCAN. The system has more information about our system and can choose a more convenient execution plan.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4528047187449612761-7812805435546492182?l=jaumebernado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/7812805435546492182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4528047187449612761&amp;postID=7812805435546492182' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/7812805435546492182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/7812805435546492182'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/2007/10/oracle-cpu-costing-more-information-for.html' title='Oracle CPU Costing. More information for the optimizer.'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4528047187449612761.post-2841889037840229540</id><published>2007-09-21T20:13:00.000+02:00</published><updated>2007-10-06T17:53:48.768+02:00</updated><title type='text'>Installing Oracle Database Vault 10.2.0.3</title><content type='html'>Oracle Database Vault is an add-on to enterprise database software that places restrictions on what privileged users can do.  It protects against insider security threats with separation of tasks between Database Administrator and Security Administrator. It's possible to meet regulatory compliance requirements too and all of these features are in the database software. It's not necessary to make complex developments to comply with these required security features.&lt;br /&gt;&lt;br /&gt;I'm describing the installation process of Oracle Database Vault on RHEL4.  If you are using ASM as the database storage option then you must install ASM in another Oracle Home Directory.&lt;br /&gt;&lt;br /&gt;1.- Install Oracle ASM binaries in the ASM Home Directory. (e.g.  /u01/app/oracle/product/10.2.0/ASM_1 )&lt;br /&gt;2.- &lt;span class="revnumber"&gt;Install 10&lt;span class="italic"&gt;g&lt;/span&gt; Release 2 (10.2.0.3) Patch Set 2&lt;/span&gt; in ASM Home Directory.&lt;br /&gt;3.- Install Oracle Database binaries in the Database Home Directory. (e.g.  /u01/app/oracle/product/10.2.0/db_1 )&lt;br /&gt;4.-  &lt;span class="revnumber"&gt;Install 10&lt;span class="italic"&gt;g&lt;/span&gt; Release 2 (10.2.0.3) Patch Set 2&lt;/span&gt; in Database Home Directory.&lt;br /&gt;5.- Create the ASM instance with dbca from the ASM Home Directory.&lt;br /&gt;6.- Create the database with dbca from the Database Home Directory.&lt;br /&gt;7.- Install Oracle Database Vault 10g Release 2  (10.2.0.3.0) in Database Home Directory.&lt;br /&gt;&lt;br /&gt;When the  Database Vault configuration assistant run I have got the following error messages in $ORACLE_HOME/cfgtoollogs/dvca_install.log file:&lt;br /&gt;&lt;br /&gt;RULE_SYNC:java.sql.SQLException: ORA-24141: rule set DVSYS.DV$1 does not exist&lt;br /&gt;ORA-06512: at "SYS.DBMS_RULE_ADM", line 188&lt;br /&gt;ORA-06512: at "DVSYS.DBMS_MACADM", line 2701&lt;br /&gt;ORA-06512: at line 1&lt;br /&gt;&lt;br /&gt;It was solved setting the following variable prior to the installer being run:&lt;br /&gt;                 &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt; $ export NLS_LANG=AMERICAN_AMERICA.US7ASCII&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Security Administrator can define the enterprise security policy from the Oracle Database Vault Administrator utility (http:&lt;hostname&gt;:&lt;port&gt;/dva).&lt;br /&gt;&lt;br /&gt;You can see the product functionality with the "Oracle by Example" at the &lt;a href="http://www.oracle.com/technology/deploy/security/database-security/database-vault/index.html"&gt;http://www.oracle.com/technology/deploy/security/database-security/database-vault/index.html&lt;/a&gt;, but then you need the Database Sample schemas. You can install the Database Sample Schemas with the Companion CD.&lt;/port&gt;&lt;/hostname&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4528047187449612761-2841889037840229540?l=jaumebernado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/2841889037840229540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4528047187449612761&amp;postID=2841889037840229540' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/2841889037840229540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/2841889037840229540'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/2007/09/installing-oracle-database-vault-10203.html' title='Installing Oracle Database Vault 10.2.0.3'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4528047187449612761.post-5262896276227175774</id><published>2007-09-01T20:54:00.000+02:00</published><updated>2007-09-01T21:17:09.085+02:00</updated><title type='text'>Installing Oracle 10gR2 on Oracle Enterprise Linux 5</title><content type='html'>I have installed Oracle 10.2.0.3 on Oracle Enterprise Linux 5 with some issues that I'm describing below.&lt;br /&gt;&lt;br /&gt;When I try to execute runInstaller, I have got the error message:&lt;br /&gt;&lt;br /&gt;           &lt;span style="font-weight: bold;"&gt;"libXp.so.6: cannot open shared object ..."&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;To solve this issue it's necessary to install  &lt;span style="font-weight: bold;"&gt;libXp&lt;/span&gt;  RPM  from CD2.&lt;br /&gt;&lt;br /&gt;To pass the system prerequisites step, I have followed the Metalink Note &lt;span style="font-weight: bold;"&gt;456634.1.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;To create an ASM Disk Group,  I have modified the ASM_DISKSTRING parameter with the value&lt;br /&gt;        &lt;span style="font-weight: bold;"&gt;ASM_DISKSTRING= '/dev/oracleasm/disks/VOL*'&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;where VOL is the prefix of the ASM disks created with &lt;span style="font-weight: bold;"&gt;oracleasm&lt;/span&gt; utility.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4528047187449612761-5262896276227175774?l=jaumebernado.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaumebernado.blogspot.com/feeds/5262896276227175774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4528047187449612761&amp;postID=5262896276227175774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/5262896276227175774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4528047187449612761/posts/default/5262896276227175774'/><link rel='alternate' type='text/html' href='http://jaumebernado.blogspot.com/2007/09/installing-oracle-10gr2-on-oracle.html' title='Installing Oracle 10gR2 on Oracle Enterprise Linux 5'/><author><name>Jaume Bernadó</name><uri>http://www.blogger.com/profile/01180992055368169954</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
