<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Oracle ... as usual</title>
	<atom:link href="http://laurentleturgez.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurentleturgez.wordpress.com</link>
	<description>Just another Oracle Blog</description>
	<lastBuildDate>Thu, 01 Dec 2011 17:03:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='laurentleturgez.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Oracle ... as usual</title>
		<link>http://laurentleturgez.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://laurentleturgez.wordpress.com/osd.xml" title="Oracle ... as usual" />
	<atom:link rel='hub' href='http://laurentleturgez.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Trace Oracle CBO computations for a specific sql_id</title>
		<link>http://laurentleturgez.wordpress.com/2011/11/29/trace-cbo-computation-for-a-specific-sql_id/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/11/29/trace-cbo-computation-for-a-specific-sql_id/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 10:46:38 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[CBO]]></category>
		<category><![CDATA[Internals]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=251</guid>
		<description><![CDATA[In this post, I will explain how to trace CBO computation (aka 10053 event) for a specific sql_id and in another session. To do this, we need to know two things: 1) How to trace another session? To do this, I will use undocumented oracle tool &#8220;oradebug&#8221;. More precisely, I will use the new event [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=251&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this post, I will explain how to trace CBO computation (aka 10053 event) for a specific sql_id and in another session.</p>
<p>To do this, we need to know two things:</p>
<p>1) How to trace another session? To do this, I will use undocumented oracle tool &#8220;oradebug&#8221;. More precisely, I will use the new event declaration syntax which is not based on event id.</p>
<p>2) How to trace CBO computation for a specific sql_id? To do this, I will use the new event declaration syntax (more details in the demonstration above)</p>
<p>To demonstrate this trick, I will consider two sessions:</p>
<p>- The first session (S1) is logged as an application user named LAURENT. This user owns two table T1 and T4, and we only want to trace a specific SQL Query (select count(*) from t4 where id between 500 and 550;).</p>
<p>- The second session (S2) is logged as SYS user who will launch oradebug commands.</p>
<p>* S1 (logged as LAURENT)</p>
<pre>SQL&gt; select count(*) from t4 where id between 500 and 550;
COUNT(*)
----------
 51</pre>
<p>* S2 (logged as SYS) : querying the dictionary to obtain sql_id associated to the SQL query:</p>
<pre>SQL&gt; select sql_id,sql_text from v$sql
 2 where sql_text like 'select count(*) from t4 where id between 500 and 550%';
SQL_ID        SQL_TEXT
------------- --------------------------------------------------------------------------------
2zg40utr7a08n select count(*) from t4 where id between 500 and 550</pre>
<p>* S1 (logged as LAURENT): obtain Oracle PID and system PID (spid) of the session we will trace. This information will be used for oradebug in the next step.</p>
<pre>SQL&gt; select pid,spid from v$process
 2 where addr=(select paddr from v$session
 3 where sid=(select sid from v$mystat where rownum=1));
PID        SPID
---------- ---------
25         4850</pre>
<p>* S2 (Logged as SYS) : we will use oradebug new features to trace a specific sql_id by using the new syntax for tracing CBO Computations (trace[RDBMS.SQL_Optimizer.*])</p>
<pre>SQL&gt; ALTER SYSTEM FLUSH SHARED_POOL;
SQL&gt; -- Setting Oracle PID to trace and verify by crossing the result of the system pid
<strong>SQL&gt; oradebug setorapid 25</strong>
Oracle pid: 25, Unix process pid: 4850, image: oracle@oel (TNS V1-V3)
SQL&gt; -- nolimit to tracefile
<strong>SQL&gt; oradebug unlimit</strong>
Statement processed.
SQL&gt; -- tracing SQL_Optimizer computation for a specific sql (here's our sql_id)
<strong>SQL&gt; oradebug event <span style="color:#ff0000;">trace[RDBMS.SQL_Optimizer.*][sql:2zg40utr7a08n]</span></strong>
Statement processed.
SQL&gt; -- obtain the trace file name
<strong>SQL&gt; oradebug tracefile_name</strong>
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4850.trc</pre>
<p>NB : Flushing shared pool is mandatory if you have already shared cursor for the statement to trace in the shared pool.</p>
<p>&nbsp;</p>
<p>* S1 (Logged as LAURENT) : execute many sql statements in the session including our specific sql statement:</p>
<pre>S1 (execute sql_id 2zg40utr7a08n one time, and others sql):
<strong>SQL&gt; select count(*) from t4 where id between 500 and 550;</strong>
<strong>COUNT(*)</strong>
<strong>----------</strong>
<strong> 51</strong>

SQL&gt; select count(*) from t4 ;
COUNT(*)
----------
 300000

SQL&gt; select count(*) from t1;
COUNT(*)
----------
 294958</pre>
<p>Finally, open the tracefile generated, you will only have the CBO computations and statistics for our specific sql_id:</p>
<pre>[oracle@oel ~]$ vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4850.trc
Registered qb: SEL$1 0xe47325b8 (PARSER)
---------------------
QUERY BLOCK SIGNATURE
---------------------
 signature (): qb_name=SEL$1 nbfros=1 flg=0
 fro(0): flg=4 objn=78460 hint_alias="T4"@"SEL$1"
SPM: statement not found in SMB
**************************
Automatic degree of parallelism (ADOP)
**************************
Automatic degree of parallelism is disabled: Parameter.
PM: Considering predicate move-around in query block SEL$1 (#0)
**************************
Predicate Move-Around (PM)
**************************
OPTIMIZER INFORMATION
******************************************
----- Current SQL Statement for this session (<span style="color:#ff0000;"><strong>sql_id=2zg40utr7a08n</strong></span>) -----
<strong>select count(*) from t4 where id between 500 and 550</strong>
*******************************************

.../...

Query Block Registry:
SEL$1 0xe47325b8 (PARSER) [FINAL]
:
 call(in-use=13920, alloc=49184), compile(in-use=88336, alloc=152104), execution(in-use=6016, alloc=8088)
End of Optimizer State Dump
Dumping Hints
=============
====================== END SQL Statement Dump ======================</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/251/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=251&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/11/29/trace-cbo-computation-for-a-specific-sql_id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Monitor how are used your table&#8217;s columns</title>
		<link>http://laurentleturgez.wordpress.com/2011/11/24/monitor-how-are-used-your-tables-columns/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/11/24/monitor-how-are-used-your-tables-columns/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 15:56:50 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[CBO]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=239</guid>
		<description><![CDATA[If you want to know how are used your columns when they are involved in sql queries, you can use a specific function in the dbms_stats package called REPORT_COL_USAGE. This function will give you what operation have been executed on your table columns, e.g. : SQL&#62; set lines 150 pages 400 long 20000000 longchunksize 50000 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=239&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to know how are used your columns when they are involved in sql queries, you can use a specific function in the dbms_stats package called REPORT_COL_USAGE.</p>
<p>This function will give you what operation have been executed on your table columns, e.g. :</p>
<pre>SQL&gt; set lines 150 pages 400 long 20000000 longchunksize 50000
SQL&gt; select dbms_stats.report_col_usage('SH','SALES') from dual;
DBMS_STATS.REPORT_COL_USAGE('SH','SALES')
-------------------------------------------------------------------------------
LEGEND:
.......
EQ : Used in single table EQuality predicate
RANGE : Used in single table RANGE predicate
LIKE : Used in single table LIKE predicate
NULL : Used in single table is (not) NULL predicate
EQ_JOIN : Used in EQuality JOIN predicate
NONEQ_JOIN : Used in NON EQuality JOIN predicate
FILTER : Used in single table FILTER predicate
JOIN : Used in JOIN predicate
GROUP_BY : Used in GROUP BY expression
...............................................................................
###############################################################################
COLUMN USAGE REPORT FOR SH.SALES
................................
1. AMOUNT_SOLD : EQ RANGE
###############################################################################</pre>
<p>In the previous example, we can see the AMOUNT_SOLD column have been accessed with an equality and a range predicates.</p>
<p>If I execute a query which filter on the PROD_ID column, the report will be updated:</p>
<pre>SQL&gt; select count(*) from sh.sales where prod_id=400;
COUNT(*)
----------
 0
SQL&gt; select dbms_stats.report_col_usage('SH','SALES') from dual;
DBMS_STATS.REPORT_COL_USAGE('SH','SALES')
--------------------------------------------------------------------------------
LEGEND:
.......
EQ : Used in single table EQuality predicate
RANGE : Used in single table RANGE predicate
LIKE : Used in single table LIKE predicate
NULL : Used in single table is (not) NULL predicate
EQ_JOIN : Used in EQuality JOIN predicate
NONEQ_JOIN : Used in NON EQuality JOIN predicate
FILTER : Used in single table FILTER predicate
JOIN : Used in JOIN predicate
GROUP_BY : Used in GROUP BY expression
...............................................................................
###############################################################################
COLUMN USAGE REPORT FOR SH.SALES
................................
1. AMOUNT_SOLD : EQ RANGE
<span style="color:#ff0000;">2. PROD_ID : EQ</span>
###############################################################################</pre>
<p>Another feature of this package will report joins that have been done on the table columns (You can have a look to the legend which mentions what the function can report):</p>
<pre>SQL&gt; select count(*) from sh.sales s, sh.products p where s.prod_id=p.prod_id;
COUNT(*)
----------
 918843
SQL&gt; select dbms_stats.report_col_usage('SH','SALES') from dual;
DBMS_STATS.REPORT_COL_USAGE('SH','SALES')
--------------------------------------------------------------------------------
LEGEND:
.......
EQ : Used in single table EQuality predicate
RANGE : Used in single table RANGE predicate
LIKE : Used in single table LIKE predicate
NULL : Used in single table is (not) NULL predicate
EQ_JOIN : Used in EQuality JOIN predicate
NONEQ_JOIN : Used in NON EQuality JOIN predicate
FILTER : Used in single table FILTER predicate
JOIN : Used in JOIN predicate
GROUP_BY : Used in GROUP BY expression
...............................................................................
###############################################################################
COLUMN USAGE REPORT FOR SH.SALES
................................
1. AMOUNT_SOLD : EQ RANGE
2. PROD_ID : EQ EQ_JOIN
###############################################################################</pre>
<p>If you want to reset usage statistics, use the undocumented procedure RESET_COL_USAGE:</p>
<pre>SQL&gt; exec dbms_stats.reset_col_usage('SH','SALES');
PL/SQL procedure successfully completed.
SQL&gt; select dbms_stats.report_col_usage('SH','SALES') from dual;
DBMS_STATS.REPORT_COL_USAGE('SH','SALES')
--------------------------------------------------------------------------------
LEGEND:
.......
EQ : Used in single table EQuality predicate
RANGE : Used in single table RANGE predicate
LIKE : Used in single table LIKE predicate
NULL : Used in single table is (not) NULL predicate
EQ_JOIN : Used in EQuality JOIN predicate
NONEQ_JOIN : Used in NON EQuality JOIN predicate
FILTER : Used in single table FILTER predicate
JOIN : Used in JOIN predicate
GROUP_BY : Used in GROUP BY expression
...............................................................................
###############################################################################
COLUMN USAGE REPORT FOR SH.SALES
................................
###############################################################################</pre>
<p>Note: If you execute a query using a function based index, your column name will be the virtual column name used for applying the function:</p>
<pre>SQL&gt; exec dbms_stats.reset_col_usage('SH','SALES');
PL/SQL procedure successfully completed.
SQL&gt; drop index idx;
Index dropped.
SQL&gt; create index idx on sh.sales(amount_sold*2);
Index created.
SQL&gt; set autotrace trace
SQL&gt; select count(*) from sh.sales where amount_sold*2&gt;40;

Execution Plan
----------------------------------------------------------
Plan hash value: 875048923
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 25 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | INDEX RANGE SCAN| IDX | 45873 | 582K| 25 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("AMOUNT_SOLD"*2&gt;40)

Statistics
----------------------------------------------------------
 12 recursive calls
 0 db block gets
 1828 consistent gets
 1812 physical reads
 0 redo size
 528 bytes sent via SQL*Net to client
 524 bytes received via SQL*Net from client
 2 SQL*Net roundtrips to/from client
 7 sorts (memory)
 0 sorts (disk)
 1 rows processed
SQL&gt; set autotrace off
SQL&gt; select dbms_stats.report_col_usage('SH','SALES') from dual;
DBMS_STATS.REPORT_COL_USAGE('SH','SALES')
--------------------------------------------------------------------------------
LEGEND:
.......
EQ : Used in single table EQuality predicate
RANGE : Used in single table RANGE predicate
LIKE : Used in single table LIKE predicate
NULL : Used in single table is (not) NULL predicate
EQ_JOIN : Used in EQuality JOIN predicate
NONEQ_JOIN : Used in NON EQuality JOIN predicate
FILTER : Used in single table FILTER predicate
JOIN : Used in JOIN predicate
GROUP_BY : Used in GROUP BY expression
...............................................................................
###############################################################################
COLUMN USAGE REPORT FOR SH.SALES
................................
1. SYS_NC00008$ : RANGE
###############################################################################</pre>
<p>If you want to desactivate this feature because your database contains a lot of tables and columns and you don&#8217;t want to overload your system, you can set the undocumented parameter &#8220;_column_tracking_level&#8221; to 0 (default value = 1).</p>
<p>All results of the DBMS_STATS.REPORT_COL_USAGE are based on the COL_USAGE$ dictionary table.</p>
<p>Finally, you can use this method to decide if a column needs a histogram or if it&#8217;s an unindexed column that needs one.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=239&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/11/24/monitor-how-are-used-your-tables-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Read rdbms and listener log (xml) from SQL*Plus prompt</title>
		<link>http://laurentleturgez.wordpress.com/2011/11/16/read-rdbms-and-listener-log-xml-from-sqlplus-prompt/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/11/16/read-rdbms-and-listener-log-xml-from-sqlplus-prompt/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 17:13:21 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Internals]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=207</guid>
		<description><![CDATA[Recently I have searched a method to read and filter entries in alert log files (rdbms and listener.log). A documented method consists in using adrci (ADR command interpreter) but I wanted an easier method, so I searched on the net and found this thread in Tanel Poder&#8217;s Blog (http://blog.tanelpoder.com/2009/03/21/oracle-11g-reading-alert-log-via-sql/). This method seems to answer my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=207&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I have searched a method to read and filter entries in alert log files (rdbms and listener.log).</p>
<p>A documented method consists in using adrci (ADR command interpreter) but I wanted an easier method, so I searched on the net and found this thread in Tanel Poder&#8217;s Blog (<a href="http://blog.tanelpoder.com/2009/03/21/oracle-11g-reading-alert-log-via-sql/">http://blog.tanelpoder.com/2009/03/21/oracle-11g-reading-alert-log-via-sql/</a>).</p>
<p>This method seems to answer my questions but it only shows rdbms entries.</p>
<p>So I found another V$ table (undocumented) that resolves my problem : V$DIAG_ALERT_EXT.</p>
<p>This view is based on X$DIAG_ALERT_EXT and contains log entries about rdbms, tnslsnr etc. Now, I just have to write the code to exploit this.</p>
<p>1- First view for rdbms log entries:</p>
<pre>create or replace view my_db_alert_log as
select ORIGINATING_TIMESTAMP,HOST_ID,HOST_ADDRESS,DETAILED_LOCATION,MODULE_ID,
CLIENT_ID,PROCESS_ID,USER_ID,MESSAGE_ID,MESSAGE_GROUP,MESSAGE_TEXT,PROBLEM_KEY,FILENAME
from V$DIAG_ALERT_EXT WHERE trim(COMPONENT_ID)='rdbms';</pre>
<p>2- Another one for listener log entries:</p>
<pre>create or replace view my_lsnr_alert_log as
select ORIGINATING_TIMESTAMP,HOST_ID,HOST_ADDRESS,DETAILED_LOCATION,MODULE_ID,
CLIENT_ID,PROCESS_ID,USER_ID,MESSAGE_ID,MESSAGE_GROUP,MESSAGE_TEXT,PROBLEM_KEY,FILENAME
from V$DIAG_ALERT_EXT WHERE trim(COMPONENT_ID)='tnslsnr';</pre>
<p>Off course, you can add every column useful for you <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, you can query alert.log directly in SQL*Plus (for example, here&#8217;s my last hour rdbms alert log file entries):</p>
<pre>SQL&gt; select ORIGINATING_TIMESTAMP,DETAILED_LOCATION,MESSAGE_GROUP,MESSAGE_TEXT
  2  from my_db_alert_log
  3  where ORIGINATING_TIMESTAMP&gt; systimestamp - INTERVAL '0 01:00:00.0' DAY TO SECOND(1)
  4  order by 1
  5  /

ORIGINATING_TIMESTAMP                  DETAILED_LOCATION    MESSAGE_GROUP             MESSAGE_TEXT
-------------------------------------- -------------------- ------------------------- --------------------------------------------------
16-NOV-11 05.33.03.090000000 PM +01:00                                                ALTER SYSTEM: Flushing buffer cache
16-NOV-11 05.57.16.259000000 PM +01:00 /u01/app/oracle/diag                           Errors in file /u01/app/oracle/diag/rdbms/db112/db
                                       /rdbms/db112/db112/t                           112/trace/db112_ora_6377.trc  (incident=139371):
                                       race/db112_ora_6377.                           ORA-00700: erreur logicielle interne, arguments :
                                       trc                                            [kgerev1], [600], [600], [700], [], [], [], [], []
                                                                                      , [], [], []

16-NOV-11 05.57.16.262000000 PM +01:00                                                Incident details in: /u01/app/oracle/diag/rdbms/db
                                                                                      112/db112/incident/incdir_139371/db112_ora_6377_i1
                                                                                      39371.trc

16-NOV-11 05.57.16.943000000 PM +01:00 /u01/app/oracle/diag Generic Internal Error    Errors in file /u01/app/oracle/diag/rdbms/db112/db
                                       /rdbms/db112/db112/t                           112/trace/db112_ora_6377.trc  (incident=139372):
                                       race/db112_ora_6377.                           ORA-00600: code d'erreur interne, arguments : [],
                                       trc                                            [], [], [], [], [], [], [], [], [], [], []

16-NOV-11 05.57.16.946000000 PM +01:00                                                Incident details in: /u01/app/oracle/diag/rdbms/db
                                                                                      112/db112/incident/incdir_139372/db112_ora_6377_i1
                                                                                      39372.trc

16-NOV-11 05.57.17.278000000 PM +01:00                                                Dumping diagnostic data in directory=[cdmp_2011111
                                                                                      6175717], requested by (instance=1, osid=6377), su
                                                                                      mmary=[incident=139371].

16-NOV-11 05.57.17.544000000 PM +01:00                                                Use ADRCI or Support Workbench to package the inci
                                                                                      dent.
                                                                                      See Note 411.1 at My Oracle Support for error and
                                                                                      packaging details.

16-NOV-11 05.57.18.425000000 PM +01:00                                                Dumping diagnostic data in directory=[cdmp_2011111
                                                                                      6175718], requested by (instance=1, osid=6377), su
                                                                                      mmary=[incident=139372].

16-NOV-11 05.57.19.201000000 PM +01:00                      ami_comp                  Sweep [inc][139372]: completed
16-NOV-11 05.57.19.220000000 PM +01:00                      ami_comp                  Sweep [inc][139371]: completed
16-NOV-11 05.57.19.222000000 PM +01:00                      ami_comp                  Sweep [inc2][139372]: completed
16-NOV-11 05.57.19.222000000 PM +01:00                      ami_comp                  Sweep [inc2][139371]: completed

12 rows selected.</pre>
<p>And for the listener.log</p>
<pre>SQL&gt; select ORIGINATING_TIMESTAMP,DETAILED_LOCATION,MESSAGE_GROUP,MESSAGE_TEXT
  2  from my_lsnr_alert_log
  3  where ORIGINATING_TIMESTAMP&gt; systimestamp - INTERVAL '0 01:00:00.0' DAY TO SECOND(1)
  4  order by 1
  5  /

ORIGINATING_TIMESTAMP                  DETAILED_LOCATION    MESSAGE_GROUP             MESSAGE_TEXT
-------------------------------------- -------------------- ------------------------- --------------------------------------------------
16-NOV-11 05.11.24.147000000 PM +01:00                                                16-NOV-2011 17:11:24 * service_update * db112 * 0
16-NOV-11 05.11.54.266000000 PM +01:00                                                16-NOV-2011 17:11:54 * service_update * db112 * 0
16-NOV-11 05.12.24.385000000 PM +01:00                                                16-NOV-2011 17:12:24 * service_update * db112 * 0
16-NOV-11 05.12.54.487000000 PM +01:00                                                16-NOV-2011 17:12:54 * service_update * db112 * 0
16-NOV-11 05.13.24.573000000 PM +01:00                                                16-NOV-2011 17:13:24 * service_update * db112 * 0
16-NOV-11 05.13.54.818000000 PM +01:00                                                16-NOV-2011 17:13:54 * service_update * db112 * 0
16-NOV-11 05.14.25.011000000 PM +01:00                                                16-NOV-2011 17:14:25 * service_update * db112 * 0
16-NOV-11 05.14.28.013000000 PM +01:00                                                16-NOV-2011 17:14:28 * service_update * db112 * 0
16-NOV-11 05.14.55.085000000 PM +01:00                                                16-NOV-2011 17:14:55 * service_update * db112 * 0
16-NOV-11 05.15.28.207000000 PM +01:00                                                16-NOV-2011 17:15:28 * service_update * db112 * 0
16-NOV-11 05.15.46.267000000 PM +01:00                                                16-NOV-2011 17:15:46 * service_update * db112 * 0
16-NOV-11 05.15.52.297000000 PM +01:00                                                16-NOV-2011 17:15:52 * service_update * db112 * 0</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=207&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/11/16/read-rdbms-and-listener-log-xml-from-sqlplus-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Monitor Oracle B*Tree index creation</title>
		<link>http://laurentleturgez.wordpress.com/2011/11/08/monitor-oracle-btree-index-creation/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/11/08/monitor-oracle-btree-index-creation/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 11:40:12 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=160</guid>
		<description><![CDATA[Today, one of my client asks me how to monitor index creation and was a little bit curious about what happened during this process. To answer him, I remember operation that are executed to build an index: 1- Data needed to build the index are read 2- A sort segment is created 3- The index [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=160&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today, one of my client asks me how to monitor index creation and was a little bit curious about what happened during this process.</p>
<p>To answer him, I remember operation that are executed to build an index:</p>
<p>1- Data needed to build the index are read</p>
<p>2- A sort segment is created</p>
<p>3- The index is progressively build as a temporary segment in the destination tablespace</p>
<p>The first phase is monitored like a classic read operation : V$SESSION_WAIT, 10046 event trace etc.</p>
<p>Next phase can be monitored by querying the V$SORT_USAGE view:</p>
<pre>select USERNAME,SESSION_NUM,TABLESPACE,CONTENTS,SEGTYPE,BLOCKS*dbbs/1024/1024 as sizeMb
  2* from v$sort_usage, (select to_number(value) dbbs from v$parameter where name='db_block_size')

USERNAME   SESSION_NUM TABLESPACE CONTENTS  SEGTYPE       SIZEMB
---------- ----------- ---------- --------- --------- ----------
LAURENT             46 TEMP       TEMPORARY SORT             101</pre>
<p><span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">Finally, when the sort segment has been created, you will see a new segment in the index tablespace. This segment is a TEMPORARY segment with a numeric format name (Usually the final size is close to the sort segment size) :</span></p>
<pre>select segment_name,segment_type,sum(bytes)/1024/1024/1024 as SIZE_GB
from dba_segments
where tablespace_name='DWH_P_IDX'
group by segment_name,segment_type;
SEGMENT_NAME                   SEGMENT_TYPE       SIZE_GB
------------------------------ ------------------ -------
.../...
14.4483                        TEMPORARY           1.1875
.../...</pre>
<p><span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">If you repeat this query, you will see the segment size grow.</span> <span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">When the operation ends, this temporary segment becomes an INDEX segment which is &#8230; your index.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=160&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/11/08/monitor-oracle-btree-index-creation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Dump ASM disk header</title>
		<link>http://laurentleturgez.wordpress.com/2011/11/02/dump-asm-file-header/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/11/02/dump-asm-file-header/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 08:25:00 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[ASM / ADVM]]></category>
		<category><![CDATA[Internals]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=180</guid>
		<description><![CDATA[If you want to dump ASM disk header, you can use an Oracle internal tool to obtain information about your disk, diskgroup etc. even if the disk is offline. This tool is named KFED (Kernel File EDitor). It is fitted by default with an Oracle 11g installation, but you&#8217;ll need to build it  if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=180&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to dump ASM disk header, you can use an Oracle internal tool to obtain information about your disk, diskgroup etc. even if the disk is offline.</p>
<p>This tool is named KFED (Kernel File EDitor). It is fitted by default with an Oracle 11g installation, but you&#8217;ll need to build it  if you want to use it with Oracle 10g :</p>
<pre>[oracle@oel ~]$ make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk ikfed</pre>
<p>Well, now have a closer look to a feature of this tool.</p>
<p>If you want to read information stored on the ASM Disk header, you can use it like this :</p>
<pre>[oracle@oel ~]$ kfed read /dev/oracleasm/disks/ASM3 dsk1.dump</pre>
<p>Now, you have in the dsk1.dump file the content of your ASM file header &#8220;/dev/oracleasm/disks/ASM3&#8243;. This file can be easily read by a text editor</p>
<pre> 
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check:                  2930000864 ; 0x00c: 0xaea443e0
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr:     ORCLDISKASM3 ; 0x000: length=12
kfdhdb.driver.reserved[0]:    860705601 ; 0x008: 0x334d5341
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                186646528 ; 0x020: 0x0b200000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        2 ; 0x026: KFDGTP_NORMAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:          MIRROR_DG_0000 ; 0x028: length=14
kfdhdb.grpname:               MIRROR_DG ; 0x048: length=9
kfdhdb.fgname:           MIRROR_DG_0000 ; 0x068: length=14
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32959021 ; 0x0a8: HOUR=0xd DAYS=0x11 MNTH=0xa YEAR=0x7db
kfdhdb.crestmp.lo:           3500063744 ; 0x0ac: USEC=0x0 MSEC=0x3af SECS=0x9 MINS=0x34
kfdhdb.mntstmp.hi:             32959382 ; 0x0b0: HOUR=0x16 DAYS=0x1c MNTH=0xa YEAR=0x7db
kfdhdb.mntstmp.lo:            505578496 ; 0x0b4: USEC=0x0 MSEC=0xa1 SECS=0x22 MINS=0x7
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    1019 ; 0x0c4: 0x000003fb
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000</pre>
<p>Now, we can read some information about the file : on the structure &#8220;kfdhdb&#8221;, at the offset 0&#215;048, and coded on 9 bytes, the name of the diskgroup which owns this ASM disk  file.</p>
<p>Most important information are detailed below :</p>
<p>* kfbh.endian: Endian used on this disk : 1 for little endian.</p>
<p>* kfdhdb.driver.provstr: Provision String used for ASM (which means in our case : ORCL:DISKASM3)</p>
<p>* kfdhdb.grptyp: type of diskgroup the disk is attached to.</p>
<p>* kfdhdb.hdrsts: header status. Here, the disk is a member of the diskgroup.</p>
<p>* kfdhdb.dskname: disk name in the disk group</p>
<p>* kfdhdb.grpname: disk group name</p>
<p>* kfdhdb.fgname: failure group name which owns the disk</p>
<p>* kfdhdb.secsize: sector size</p>
<p>* kfdhdb.blksize:  block size</p>
<p>* kfdhdb.ausize: allocation unit size</p>
<p>If you want to rename the diskgroup the disk belongs to, you can edit the dumpfile and use the &#8220;merge&#8221; command of KFED to apply changes to the disk header.</p>
<pre>[oracle@oel ~]$ kfed merge /dev/oracleasm/disks/ASM3 text=dsk1.dump</pre>
<p>Be careful when you use the &#8220;merge&#8221; command because, it seems the diskgroup name, or disk name is coded with a fixed length, so if you change the name, and this one is based on a 4 bytes word, rename it to a 4 bytes word.</p>
<p>Off course, using kfed is not supported by Oracle.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=180&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/11/02/dump-asm-file-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle 11.2.0.3 &#8230; released</title>
		<link>http://laurentleturgez.wordpress.com/2011/09/29/oracle-11-2-0-3-released/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/09/29/oracle-11-2-0-3-released/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 14:02:25 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=151</guid>
		<description><![CDATA[Oracle Database Server Release 11.2.0.3 is now out under patch Id 10404530. As the previous patchset, you can use it for a fresh install or to upgrade an existing one. This release is available for linux x86 and x86-64.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=151&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Oracle Database Server Release 11.2.0.3 is now out under patch Id 10404530.</p>
<p>As the previous patchset, you can use it for a fresh install or to upgrade an existing one.</p>
<p>This release is available for linux x86 and x86-64.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=151&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/09/29/oracle-11-2-0-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Some things about Statistics &#8230;</title>
		<link>http://laurentleturgez.wordpress.com/2011/09/26/some_things_about_statistics/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/09/26/some_things_about_statistics/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 16:09:49 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[CBO]]></category>
		<category><![CDATA[Internals]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=121</guid>
		<description><![CDATA[Every Oracle DBA knows how statistics are very important for the CBO and for database performance. Oracle have many kind of statistics : - object statistics : statistics on tables, indexes &#8230; - system statistics: statistics on the system where your database runs : CPU speed, time to perform a single I/O etc. - dictionary [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=121&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Every Oracle DBA knows how statistics are very important for the CBO and for database performance.</p>
<p>Oracle have many kind of statistics :</p>
<p>- object statistics : statistics on tables, indexes &#8230;</p>
<p>- system statistics: statistics on the system where your database runs : CPU speed, time to perform a single I/O etc.</p>
<p>- dictionary statistics : statistics on the dictionary tables, indexes etc. (OBJ$, TAB$ tables &#8230; I_SOURCE1,  I_FILE1 indexes &#8230;)</p>
<p>- Fixed objects statistics : statistics on the fixed tables (X$BH etc. A non exhaustive list and explanation of X$ tables can be found here : <a href="http://yong321.freeshell.org/computer/x$table.html" target="_blank">http://yong321.freeshell.org/computer/x$table.html</a>)</p>
<p>Each statistic is important for the performance of your database and so, it&#8217;s important to know where to find information about them.</p>
<ul>
<li>Object statistics</li>
</ul>
<p>Object statistics are the most known statistics. Information about object statistics can be found in the DBA_ views. For example, LAST_ANALYZED column of the DBA_TABLES, DBA_INDEXES, DBA_TAB_PARTITIONS, DBA_IND_PARTITIONS etc. told us when was last analyzed an object. Other columns like BLOCKS, NUM_ROWS etc. are populated after this analyze.</p>
<ul>
<li>System statistics</li>
</ul>
<div>System statistics informs the CBO about the performance of the system. For example, information collected are CPU Speed, time to perform a single I/O or a multiblock I/O operation etc.</div>
<div>System statistics are available in the table SYS.AUX_STATS$. System stats can be gathered in a &#8220;NOWORKLOAD&#8221; mode (default) or in a &#8220;WORKLOAD&#8221; mode. The No workload mode gathers basic information about the system. WORKLOAD mode gathers more information and give more precise information about the performance of the system.</div>
<div>It&#8217;s recommanded to gather system stats in a workload mode during a representative workload phase. For example, if your system have a representative load every tuesday during 9 AM to 12 AM, you can gather system stats during 3 hours every tuesday.</div>
<div>Ex: Content of the AUX_STATS$ table after a  noworkload statistics gathering:</div>
<div>
<pre>SQL&gt; select * from aux_stats$;

SNAME           PNAME                PVAL1 PVAL2
--------------- --------------- ---------- ------------------
SYSSTATS_INFO   STATUS                     COMPLETED
SYSSTATS_INFO   DSTART                     09-26-2011 11:47
SYSSTATS_INFO   DSTOP                      09-26-2011 11:47
SYSSTATS_INFO   FLAGS                    1
SYSSTATS_MAIN   CPUSPEEDNW         919,606
SYSSTATS_MAIN   IOSEEKTIM             8,17
SYSSTATS_MAIN   IOTFRSPEED       55914,355
SYSSTATS_MAIN   SREADTIM
SYSSTATS_MAIN   MREADTIM
SYSSTATS_MAIN   CPUSPEED
SYSSTATS_MAIN   MBRC
SYSSTATS_MAIN   MAXTHR
SYSSTATS_MAIN   SLAVETHR</pre>
</div>
<div>Ex: Content of the AUX_STATS$ table after a  workload statistics gathering of 5 minutes:</div>
<div>
<pre>SQL&gt; exec dbms_stats.gather_system_stats(gathering_mode=&gt;'INTERVAL',interval=&gt;5);

SQL&gt; select * from aux_stats$;

SNAME           PNAME                PVAL1 PVAL2
--------------- --------------- ---------- ------------------------------
SYSSTATS_INFO   STATUS                     COMPLETED
SYSSTATS_INFO   DSTART                     09-26-2011 11:50
SYSSTATS_INFO   DSTOP                      09-26-2011 11:55
SYSSTATS_INFO   FLAGS                    0
SYSSTATS_MAIN   CPUSPEEDNW         919,606
SYSSTATS_MAIN   IOSEEKTIM             8,17
SYSSTATS_MAIN   IOTFRSPEED       55914,355
SYSSTATS_MAIN   SREADTIM             1,537
SYSSTATS_MAIN   MREADTIM             1,818
SYSSTATS_MAIN   CPUSPEED               920
SYSSTATS_MAIN   MBRC                    19
SYSSTATS_MAIN   MAXTHR
SYSSTATS_MAIN   SLAVETHR</pre>
</div>
<p>For more information about what mean PNAME values, just have a look here : <a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/stats.htm#i41496" target="_blank">http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/stats.htm#i41496</a></p>
<ul>
<li>Dictionary Statistics</li>
</ul>
<div>Dictionary statistics are similar to object statistics, but they are specific to SYS object that describe the dictionary. DBMS_STATS.GATHER_DICTIONARY_STATISTICS is the procedure used to gather statistics on these objects. To verify statistics on it, you can proceed like a classical objects except in the name of the object.</div>
<div>Ex:</div>
<div>
<pre>SQL&gt; select table_name,last_analyzed,blocks,num_rows from dba_tables where table_name in ('OBJ$','TAB$','IND$','FILE$');

TABLE_NAME LAST_ANALYZED                BLOCKS   NUM_ROWS
---------- ------------------------ ---------- ----------
TAB$       26/SEPT./2011 04PM:28:22       1236       2617
OBJ$       26/SEPT./2011 04PM:27:49        862      70094
IND$       26/SEPT./2011 04PM:28:21       1236       4103
FILE$      26/SEPT./2011 04PM:27:46          1          5</pre>
<p>NB : Dictionary statistics are automatically gathered during DBMS_STATS.GATHER_DATABASE_STATS which is launched with the automatic optimizer statistic collection task.</p>
</div>
<ul>
<li>Fixed objects</li>
</ul>
<div>Fixed objects are a little bit particular. Indeed, a fixed table (X$) seems to be a kind of C structure mapped into a table. So, fixed tables exist but not really and are not referenced in the dictionary tables. (more information here : <a href="http://www.oracle-internals.com/?p=11" target="_blank">http://www.oracle-internals.com/?p=11</a>)</div>
<div>To identify statistics on fixed objects, you have to query dictionary with this query. If there&#8217;s no fixed objects statistics gathered, the query will answer 0 line, otherwise you will have one line per fixed object.</div>
<div>
<pre>SQL&gt; exec dbms_stats.gather_fixed_objects_stats;
SQL&gt; select fo.name, analyzetime, ROWCNT,samplesize
  2  from tab_stats$ t, (select OBJECT_ID,NAME from V$FIXED_TABLE) fo
  3  where t.obj#=fo.object_id
  4  order by 2;

NAME                           ANALYZETIME                  ROWCNT SAMPLESIZE
------------------------------ ------------------------ ---------- ----------
X$KGLJSIM                      26/SEPT./2011 05PM:44:27          4          4
X$KGLJMEM                      26/SEPT./2011 05PM:44:27         68         68
X$KGLAU                        26/SEPT./2011 05PM:44:27        800        800
X$KGLLC                        26/SEPT./2011 05PM:44:27         12         12
X$KGLDP                        26/SEPT./2011 05PM:44:27      14976      14976
X$KGLLK                        26/SEPT./2011 05PM:44:28        831        831
X$KGLMEM                       26/SEPT./2011 05PM:44:28         68         68
X$KGLNA1                       26/SEPT./2011 05PM:44:28      38695      38695
X$KGLNA                        26/SEPT./2011 05PM:44:28      38671      38671
X$KGLOB                        26/SEPT./2011 05PM:44:31      21054      21054
X$KGLPN                        26/SEPT./2011 05PM:44:32         38         38
X$KGLST                        26/SEPT./2011 05PM:44:32         68         68
X$KGLSIM                       26/SEPT./2011 05PM:44:32         14         14
X$KGLRD                        26/SEPT./2011 05PM:44:32       8788       8788
X$KGLSN                        26/SEPT./2011 05PM:44:32        173        173
X$KGLTR                        26/SEPT./2011 05PM:44:32       1206       1206
X$KGLXS                        26/SEPT./2011 05PM:44:33      13029      13029
X$KKSCS                        26/SEPT./2011 05PM:44:33       2311       2311
X$KKSAI                        26/SEPT./2011 05PM:44:33          0          0
X$KKSBV                        26/SEPT./2011 05PM:44:33       3116       3116
X$KQLFBC                       26/SEPT./2011 05PM:44:34       3116       3116
.../...</pre>
<p>In a next post, I will show you how system and fixed objects statistics are very important for your database performance.</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=121&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/09/26/some_things_about_statistics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>BBED in Oracle 11g</title>
		<link>http://laurentleturgez.wordpress.com/2011/06/29/bbed-in-oracle-11g/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/06/29/bbed-in-oracle-11g/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 14:43:14 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Internals]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=110</guid>
		<description><![CDATA[If you like playing with oracle internals, maybe you use frequently BBED (Block Editor). In Oracle 11g, BBED becomes unavailable but if you search in the ins_rdbms.mk makefile (located in $ORACLE_HOME/rdbms/lib directory), you will see that the entry is still there. If you want to use it with an Oracle 11g database, you will have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=110&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you like playing with oracle internals, maybe you use frequently BBED (Block Editor). In Oracle 11g, BBED becomes unavailable but if you search in the ins_rdbms.mk makefile (located in $ORACLE_HOME/rdbms/lib directory), you will see that the entry is still there.</p>
<p>If you want to use it with an Oracle 11g database, you will have to get some files from an old Oracle 10g installation and build the binary in your Oracle 11g home.</p>
<p>The operation is detailed in the differents points above:</p>
<p>1- If you have installed Oracle 10g and 11g on the same server, define your two Oracle Home (otherwise you can use scp to copy files across the network)</p>
<pre>export ORA10G_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORA11G_HOME=/u01/app/oracle/product/11.2.0/dbhome_1</pre>
<p>2- Copy the librairies shipped with Oracle 10g but unavailable in the Oracle 11g</p>
<pre>cp $ORA10G_HOME/rdbms/lib/ssbbded.o $ORA11G_HOME/rdbms/lib
cp $ORA10G_HOME/rdbms/lib/sbbdpt.o $ORA11G_HOME/rdbms/lib</pre>
<p>3- Copy the message files shipped with Oracle 10g but unavailable in Oracle 11g</p>
<pre>cp $ORA10G_HOME/rdbms/mesg/bbed* $ORA11G_HOME/rdbms/mesg</pre>
<p>4- Build the bbed executable</p>
<pre>make -f $ORA11G_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORA11G_HOME/bin/bbed $ORA11G_HOME/bin/bbed</pre>
<p>5- Have fun &#8230;</p>
<pre>[oracle@linux1 ~]$ . oraenv
ORACLE_SID = [oracle] ? db112
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@linux1 ~]$ $ORACLE_HOME/bin/bbed
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Thu Jun 9 10:10:49 2011

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

************* !!! For Oracle Internal Use only !!! ***************

BBED&gt;</pre>
<p>Don&#8217;t forget to use the library in the same kernel architecture &#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=110&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/06/29/bbed-in-oracle-11g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Managing database audit Trail in Oracle 11gR2</title>
		<link>http://laurentleturgez.wordpress.com/2011/06/09/managing-database-audit-trail-in-oracle-11gr2/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/06/09/managing-database-audit-trail-in-oracle-11gr2/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 08:36:36 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=104</guid>
		<description><![CDATA[Due to American Security laws, Oracle has changed its audit management rules in Oracle 11g. Now, AUDIT_TRAIL is configured bydefault to &#8216;DB&#8217;. Many operations are now audited by default and stored in the AUD$ table (which is stored by default in the SYSTEM tablespace). Audited operations are available in the DBA_PRIV_AUDIT_OPTS view, and if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=104&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Due to American Security laws, Oracle has changed its audit management rules in Oracle 11g.</p>
<p>Now, AUDIT_TRAIL is configured bydefault to &#8216;DB&#8217;. Many operations are now audited by default and stored in the AUD$ table (which is stored by default in the SYSTEM tablespace).</p>
<p>Audited operations are available in the DBA_PRIV_AUDIT_OPTS view, and if you have a look in it, you will see that &#8220;CREATE SESSION&#8221; operations are audited.</p>
<p>So, if you create your database with &#8216;dbca&#8217;, if you update your database with &#8216;dbua&#8217;, you leave the default configuration, and your SYSTEM Tablespace datafile is in autoextend mode &#8230; you will probably have a huge system datafile soon.</p>
<p>To manage the audit trail, you have different solutions:</p>
<p>- The first one is to disable audit trail: set AUDIT_TRAIL to NONE into your spfile file, shutdown and restart your database.</p>
<p>- The second one is to move your AUD$ to another tablespace :</p>
<pre>SQL&gt; select table_name,tablespace_name from dba_tables where table_name='AUD$';

TABLE_NAME      TABLESPACE_NAME
--------------- ---------------
AUD$            SYSTEM
SQL&gt; exec DBMS_AUDIT_MGMT.set_audit_trail_location(audit_trail_type=&gt;DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD, audit_trail_location_value =&gt; 'AUD_TS');

PL/SQL procedure successfully completed.
SQL&gt; select table_name,tablespace_name from dba_tables where table_name='AUD$';

TABLE_NAME      TABLESPACE_NAME
--------------- ---------------
AUD$            AUD_TS</pre>
<p>- The third one is to manage the properties of the audit trail with the DBMS_AUDIT_MGMT PL/SQL package</p>
<p>If you want to change it, you have to use DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_PROPERTY procedure to configure properties of the audit trail:</p>
<pre>SQL&gt; begin
  2  DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_PROPERTY(audit_trail_type=&gt;DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
  3                                           audit_trail_property=&gt;DBMS_AUDIT_MGMT.DB_DELETE_BATCH_SIZE,
  4                                           audit_trail_property_value=&gt;1000);
  5  end;
  6  /</pre>
<p>Then, you have to initialize the cleanup, and to define the oldest record to leave in the table (Here 30 days):</p>
<pre>SQL&gt; begin
  2  DBMS_AUDIT_MGMT.INIT_CLEANUP(audit_trail_type=&gt; DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
  3                               default_cleanup_interval=&gt;720);
  4
  5  DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(audit_trail_type  =&gt; DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
  6                                             last_archive_time =&gt; SYSTIMESTAMP-30);
  7  end;
  8  /</pre>
<p>Next, we create a job. This job will be executed every 168 hours (7 days).</p>
<pre>SQL&gt; BEGIN
  2  DBMS_AUDIT_MGMT.CREATE_PURGE_JOB(audit_trail_type=&gt; DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
  3                                   audit_trail_purge_interval =&gt; 168,
  4                                   audit_trail_purge_name=&gt; 'PURGE_AUD_JOB',
  5                                   use_last_arch_timestamp =&gt; TRUE);
  6  END;
  7  /
<span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">Note : if USE_LAST_ARCH_TIMESTAMP is set to TRUE, the job will purge only the oldest entries that match to the corresponding retention parameter. You can have a look to the DBA_SCHEDULER_JOBS to have more details about this new job.</span></pre>
<p>Here I gave you an example to purge the DB audit structure (AUD$ and FGA_AUD$ tables), if you have a look to the Oracle documentation, you can use the same procedure to purge OS Audit File, XML File.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=104&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/06/09/managing-database-audit-trail-in-oracle-11gr2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
		<item>
		<title>Proud to work for DIGORA</title>
		<link>http://laurentleturgez.wordpress.com/2011/05/27/proud-to-work-for-digora/</link>
		<comments>http://laurentleturgez.wordpress.com/2011/05/27/proud-to-work-for-digora/#comments</comments>
		<pubDate>Fri, 27 May 2011 07:56:49 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[digora]]></category>

		<guid isPermaLink="false">http://laurentleturgez.wordpress.com/?p=90</guid>
		<description><![CDATA[Today, no technical post, but I would like to say that I&#8217;m very proud to work for a company (DIGORA) which counts 3 Oracle Certified Masters.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=90&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today, no technical post, but I would like to say that I&#8217;m very proud to work for a company (<a title="Digora's website" href="http://www.digora.com" target="_blank">DIGORA</a>) which counts 3 Oracle Certified Masters.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/laurentleturgez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/laurentleturgez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/laurentleturgez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/laurentleturgez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/laurentleturgez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/laurentleturgez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/laurentleturgez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/laurentleturgez.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=laurentleturgez.wordpress.com&amp;blog=19934205&amp;post=90&amp;subd=laurentleturgez&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://laurentleturgez.wordpress.com/2011/05/27/proud-to-work-for-digora/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ab2dc865cf60c14d61935a9c7ac86502?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lolo115</media:title>
		</media:content>
	</item>
	</channel>
</rss>
