<?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"
	>

<channel>
	<title>Ask The Real Tom</title>
	<atom:link href="http://www.asktherealtom.ch/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.asktherealtom.ch</link>
	<description>I don't need friends, I have Oracle!</description>
	<pubDate>Wed, 25 Aug 2010 08:05:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Oracle ASM Disk Overview</title>
		<link>http://www.asktherealtom.ch/?p=226</link>
		<comments>http://www.asktherealtom.ch/?p=226#comments</comments>
		<pubDate>Fri, 30 Jul 2010 14:38:32 +0000</pubDate>
		<dc:creator>tkalo</dc:creator>
		
		<category><![CDATA[oracle]]></category>

		<category><![CDATA[asm]]></category>

		<category><![CDATA[diskgroups]]></category>

		<category><![CDATA[script]]></category>

		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=226</guid>
		<description><![CDATA[I&#8217;ve wrote a simple SQL script to list all ASM disks with state, size and their diskgroups, if any.
set pages 5000 lines 180
set heading on
set feedback off
set serveroutput on

col LABEL for a28
col DISKGROUP for a9
col STATUS for a9
col TOTAL for a11
col MOUNT_STATE for a11

exec dbms_output.put_line('---');
exec dbms_output.put_line('--- DISK OVERVIEW');
exec dbms_output.put_line('---');

SELECT
        D.LABEL&#124;&#124;' ('&#124;&#124;D.NAME&#124;&#124;')' LABEL,
        (SELECT
          NAME
         FROM
          [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve wrote a simple SQL script to list all ASM disks with state, size and their diskgroups, if any.</p>
<pre>set pages 5000 lines 180
set heading on
set feedback off
set serveroutput on

col LABEL for a28
col DISKGROUP for a9
col STATUS for a9
col TOTAL for a11
col MOUNT_STATE for a11

exec dbms_output.put_line('---');
exec dbms_output.put_line('--- DISK OVERVIEW');
exec dbms_output.put_line('---');

SELECT
        D.LABEL||' ('||D.NAME||')' LABEL,
        (SELECT
          NAME
         FROM
          V$ASM_DISKGROUP
         WHERE
          GROUP_NUMBER=D.GROUP_NUMBER)
        DISKGROUP,
        D.STATE STATUS,
        lpad(D.TOTAL_MB/1024,6)||' GB' TOTAL,
        D.MOUNT_STATUS MOUNT_STATE
FROM
        V$ASM_DISK D
ORDER BY 2;

exec dbms_output.put_line('---');
set feedback on</pre>
<p>The output looks as follow:</p>
<pre>---
--- DISK OVERVIEW
---

LABEL                        DISKGROUP STATUS    TOTAL       MOUNT_STATE
---------------------------- --------- --------- ----------- -----------
ORAASM1 (ORAASM1)            DG1       NORMAL    99.984 GB   CACHED
ORAASM3 (ORAASM3)            DG1       NORMAL    99.984 GB   CACHED
ORAASM5 (ORAASM5)            DG1       NORMAL    99.984 GB   CACHED
ORAASM4 (ORAASM4)            DG1       NORMAL    99.984 GB   CACHED
ORAASM2 (ORAASM2)            FRA1      NORMAL    99.984 GB   CACHED
ORAASM6 ()                             NORMAL         0 GB   CLOSED
---</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=226</wfw:commentRss>
		</item>
		<item>
		<title>MySQL solution: Speed up pattern searches starting with a wildchar (like &#8216;%abc%&#8217;)</title>
		<link>http://www.asktherealtom.ch/?p=217</link>
		<comments>http://www.asktherealtom.ch/?p=217#comments</comments>
		<pubDate>Fri, 30 Jul 2010 09:04:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[fast]]></category>

		<category><![CDATA[i/o tuning]]></category>

		<category><![CDATA[index]]></category>

		<category><![CDATA[like %]]></category>

		<category><![CDATA[like wildchar]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[pattern]]></category>

		<category><![CDATA[slow]]></category>

		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=217</guid>
		<description><![CDATA[Searches on MySQL with expression like &#8221; &#8230; like &#8216;%abc%&#8217;&#8221; can be incredibly slow on large tables.
The problem is, MySQL can not use indices for expression starting with a wildcard &#8220;%&#8221;.
Neither MySQL supports function based indexes.
I will explain a simple solution. But first lets have a look to our problem.
Table size: 2G
Row count: 33&#8242;000
Query response [...]]]></description>
			<content:encoded><![CDATA[<p>Searches on MySQL with expression like &#8221; &#8230; like &#8216;%abc%&#8217;&#8221; can be incredibly slow on large tables.<br />
The problem is, MySQL can not use indices for expression starting with a wildcard &#8220;%&#8221;.<br />
Neither MySQL supports function based indexes.</p>
<p>I will explain a simple solution. But first lets have a look to our problem.<br />
Table size: 2G<br />
Row count: 33&#8242;000<br />
Query response time: ~ 25s<br />
<code><br />
mysql&gt; desc images;<br />
+-------------+-----------------------------------------------------------------------------+------+-----+---------+----------------+<br />
| Field       | Type                                                                        | Null | Key | Default | Extra          |<br />
+-------------+-----------------------------------------------------------------------------+------+-----+---------+----------------+<br />
| imageid     | int(11)                                                                     | NO   | PRI | NULL    | auto_increment |<br />
| filename    | varchar(200)                                                                | YES  | MUL | NULL    |                |<br />
| description | varchar(200)                                                                | YES  |     | NULL    |                |<br />
| data        | longblob                                                                    | YES  |     | NULL    |                |<br />
| type        | enum('coversmall','cover','coverback','screenshot','specialcover','banner') | YES  | MUL | NULL    |                |<br />
+-------------+-----------------------------------------------------------------------------+------+-----+---------+----------------+<br />
5 rows in set (0.00 sec)<br />
</code></p>
<p>The index can not be used</p>
<p><code><br />
mysql&gt; explain select imageid,filename,description,type                from images  where filename like '%call%' order by filename;<br />
+----+-------------+--------+------+---------------+------+---------+------+--------+-----------------------------+<br />
| id | select_type | table  | type | possible_keys | key  | key_len | ref  | rows   | Extra                       |<br />
+----+-------------+--------+------+---------------+------+---------+------+--------+-----------------------------+<br />
|  1 | SIMPLE      | images | ALL  | NULL          | NULL | NULL    | NULL | 371398 | Using where; Using filesort |<br />
+----+-------------+--------+------+---------------+------+---------+------+--------+-----------------------------+<br />
1 row in set (0.00 sec)<br />
</code></p>
<p>Index can be use if the expression does not start with a wild card</p>
<p><code><br />
mysql&gt; explain select imageid,filename,description,type                from images  where filename like 'call%' order by filename;<br />
+----+-------------+--------+-------+---------------------+---------------------+---------+------+------+-------------+<br />
| id | select_type | table  | type  | possible_keys       | key                 | key_len | ref  | rows | Extra       |<br />
+----+-------------+--------+-------+---------------------+---------------------+---------+------+------+-------------+<br />
|  1 | SIMPLE      | images | range | idx_images_filename | idx_images_filename | 603     | NULL |   66 | Using where |<br />
+----+-------------+--------+-------+---------------------+---------------------+---------+------+------+-------------+<br />
1 row in set (0.00 sec)</p>
<p>mysql&gt; explain select imageid,filename,description,type                from images  where filename like 'call%abc' order by filename;<br />
+----+-------------+--------+-------+---------------------+---------------------+---------+------+------+-------------+<br />
| id | select_type | table  | type  | possible_keys       | key                 | key_len | ref  | rows | Extra       |<br />
+----+-------------+--------+-------+---------------------+---------------------+---------+------+------+-------------+<br />
|  1 | SIMPLE      | images | range | idx_images_filename | idx_images_filename | 603     | NULL |   66 | Using where |<br />
+----+-------------+--------+-------+---------------------+---------------------+---------+------+------+-------------+<br />
</code></p>
<p>Since we are searching for the filename, we a new column for the filename. Add a character in front of the string and index the new column.</p>
<p><code><br />
mysql&gt; alter table images add vfilename  varchar(201);</p>
<p>Query OK, 33064 rows affected (3 min 4.73 sec)<br />
Records: 33064  Duplicates: 0  Warnings: 0</p>
<p>update images set vfilename=concat('a',filename);</p>
<p>Query OK, 33064 rows affected (52.40 sec)<br />
Rows matched: 33064  Changed: 33064  Warnings: 0</p>
<p>create index idx_images_vfilename on images (vfilename);</p>
<p></code></p>
<p>Now we change our application so it add always the same character &#8220;a&#8221; in the pattern.<br />
So we can use the index.</p>
<p><code><br />
mysql&gt; explain select imageid,filename,description,type                from images  where vfilename like 'a%abc%' order by filename;<br />
+----+-------------+--------+-------+----------------------+----------------------+---------+------+-------+-----------------------------+<br />
| id | select_type | table  | type  | possible_keys        | key                  | key_len | ref  | rows  | Extra                       |<br />
+----+-------------+--------+-------+----------------------+----------------------+---------+------+-------+-----------------------------+<br />
|  1 | SIMPLE      | images | range | idx_images_vfilename | idx_images_vfilename | 603     | NULL | 75840 | Using where; Using filesort |<br />
+----+-------------+--------+-------+----------------------+----------------------+---------+------+-------+-----------------------------+<br />
1 row in set (0.00 sec)<br />
</code></p>
<p>The perfomance benefit is, that we can do now a index scan (full/range scan) which read much less data than a full table scan.<br />
We reduced i/o, saved our cache and speed up the query by magnitudes!</p>
<p>This is a real ask the real tom solution!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=217</wfw:commentRss>
		</item>
		<item>
		<title>Set lock_sga to true on Linux (SLES)</title>
		<link>http://www.asktherealtom.ch/?p=220</link>
		<comments>http://www.asktherealtom.ch/?p=220#comments</comments>
		<pubDate>Thu, 29 Jul 2010 12:01:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[oracle]]></category>

		<category><![CDATA[lock_sga]]></category>

		<category><![CDATA[ORA-27102: out of memory]]></category>

		<category><![CDATA[ulimit]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=220</guid>
		<description><![CDATA[To lock the SGA into physical memory you have to set the lock_sga parameter to true.
Usually you get following Error message.

SQL> startup
SQL> ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory

The problem it ulimit -l
You have to set it in /etc/security/limits.conf and relogon to the system and restart database.

cat /etc/security/limits.conf
...
oracle soft memlock unlimited
oracle hard memlock [...]]]></description>
			<content:encoded><![CDATA[<p>To lock the SGA into physical memory you have to set the lock_sga parameter to true.</p>
<p>Usually you get following Error message.<br />
<code><br />
SQL> startup<br />
SQL> ORA-27102: out of memory<br />
Linux-x86_64 Error: 12: Cannot allocate memory<br />
</code></p>
<p>The problem it ulimit -l<br />
You have to set it in /etc/security/limits.conf and relogon to the system and restart database.<br />
<code><br />
cat /etc/security/limits.conf<br />
...<br />
oracle soft memlock unlimited<br />
oracle hard memlock unlimited<br />
</code></p>
<p><code><br />
alter system set lock_sga=true scope=spfile;<br />
shutdown immediate<br />
startup<br />
</code></p>
<p>And you SGA stays in physical memory.</p>
<p>If you SGA gets pages out you will encounter following waits.<br />
<code>Wait Event: latch: shared pool</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=220</wfw:commentRss>
		</item>
		<item>
		<title>Enable and Validate Constraints in Parallel (Oracle)</title>
		<link>http://www.asktherealtom.ch/?p=214</link>
		<comments>http://www.asktherealtom.ch/?p=214#comments</comments>
		<pubDate>Wed, 28 Jul 2010 13:51:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[oracle]]></category>

		<category><![CDATA[enable constraint parallel]]></category>

		<category><![CDATA[foreign key constraint]]></category>

		<category><![CDATA[novalidate]]></category>

		<category><![CDATA[parallel]]></category>

		<category><![CDATA[speedup]]></category>

		<category><![CDATA[Validate Constraints in Parallel]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=214</guid>
		<description><![CDATA[Enabling and validating constraints is can take a huge amount of time in big oracle databases.
To speed the validaten up, it can be done in parallel.
This can save you valuable time in release windows.


Enable Constraint with novalidate option
Set parallel degree on the table or on session with force ddl parallel
Enable nable the constraints with validation

Example:

ALTER [...]]]></description>
			<content:encoded><![CDATA[<p>Enabling and validating constraints is can take a huge amount of time in big oracle databases.<br />
To speed the validaten up, it can be done in parallel.<br/><br />
This can save you valuable time in release windows.
</p>
<ol>
<li>Enable Constraint with novalidate option</li>
<li>Set parallel degree on the table or on session with force ddl parallel</li>
<li>Enable nable the constraints with validation</li>
</ol>
<p>Example:<br />
<code><br />
ALTER TABLE T_1 ADD CONSTRAINT NC_1 not null (colname) disabled;<br />
ALTER TABLE T_1 ENABLE NOVALIDATE CONSTRAINT NC_1;<br />
ALTER SESSION FORCE PARALLEL DDL PARALLEL 8;<br />
ALTER TABLE T_1 PARALLEL 8;<br />
ALTER TABLE T_1 ENABLE VALIDATE CONSTRAINT NC_1;<br />
ALTER SESSION DISABLE PARALLEL DDL;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=214</wfw:commentRss>
		</item>
		<item>
		<title>ORA-27102: out of memory Linux-x86_64 Error: 28: No space left on device</title>
		<link>http://www.asktherealtom.ch/?p=207</link>
		<comments>http://www.asktherealtom.ch/?p=207#comments</comments>
		<pubDate>Wed, 28 Jul 2010 07:55:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[oracle]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[Linux-x86_64 Error: 28]]></category>

		<category><![CDATA[No space left on device]]></category>

		<category><![CDATA[ORA-27102: out of memory]]></category>

		<category><![CDATA[shmall]]></category>

		<category><![CDATA[shmmax]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=207</guid>
		<description><![CDATA[Problem:

SQL> startup nomount
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device


There are 64G physical memoray avaliable. 
shmmax is set to 52G
But still its not possibel to start the Oracle instance with more than 30G SGA.

Solution:

kernel.shmall is set to small.


cat /proc/sys/kernel/shmall
8248733
getconf PAGE_SIZE
4096


This means that only 8248733 memory pages can be allocate. 
4096 x 8248733 [...]]]></description>
			<content:encoded><![CDATA[<h2>Problem:</h2>
<p><code><br />
SQL> startup nomount<br />
ORA-27102: out of memory<br />
Linux-x86_64 Error: 28: No space left on device<br />
</code></p>
<p>
There are 64G physical memoray avaliable. <br/><br />
shmmax is set to 52G<br/><br />
But still its not possibel to start the Oracle instance with more than 30G SGA.
</p>
<h2>Solution:</h2>
<p>
kernel.shmall is set to small.
</p>
<p><code><br />
cat /proc/sys/kernel/shmall<br />
8248733<br />
getconf PAGE_SIZE<br />
4096<br />
</code></p>
<p>
This means that only 8248733 memory pages can be allocate. <br/><br />
4096 x 8248733 = 32G<br/><br />
<br/><br />
To allocate 50G we need to set shmall to at least 13107200</p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=207</wfw:commentRss>
		</item>
		<item>
		<title>ORA-56708: Could not find any datafiles with asynchronous i/o capability</title>
		<link>http://www.asktherealtom.ch/?p=201</link>
		<comments>http://www.asktherealtom.ch/?p=201#comments</comments>
		<pubDate>Thu, 15 Jul 2010 07:57:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[oracle]]></category>

		<category><![CDATA[async_io]]></category>

		<category><![CDATA[iocalibrate]]></category>

		<category><![CDATA[ORA-56708]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=201</guid>
		<description><![CDATA[I tried to run IO calibrate to check what the system is able to handle.
But I run into following error (using ASM / ASMlib)

ORA-56708: Could not find any datafiles with asynchronous i/o capability
ORA-06512: at "SYS.DBMS_RMIN", line 456
ORA-06512: at "SYS.DBMS_RESOURCE_MANAGER", line 1285
ORA-06512: at line 6

The ASM files show ASYNC_ON

SELECT name, asynch_io
FROM v$datafile f,v$iostat_file i
WHERE f.file# = [...]]]></description>
			<content:encoded><![CDATA[<p>I tried to run IO calibrate to check what the system is able to handle.<br />
But I run into following error (using ASM / ASMlib)</p>
<p><code><br />
ORA-56708: Could not find any datafiles with asynchronous i/o capability<br />
ORA-06512: at "SYS.DBMS_RMIN", line 456<br />
ORA-06512: at "SYS.DBMS_RESOURCE_MANAGER", line 1285<br />
ORA-06512: at line 6<br />
</code></p>
<p>The ASM files show ASYNC_ON<br />
<code><br />
SELECT name, asynch_io<br />
FROM v$datafile f,v$iostat_file i<br />
WHERE f.file# = i.file_no<br />
AND filetype_name = 'Data File'<br />
/<br />
+DG1/xxxx/datafile/system.260.721649043<br />
ASYNC_ON<br />
....<br />
</code></p>
<p>did not help as well<br />
<code><br />
alter system set filesystemio_options=setall scope=spfile;<br />
shutdown immediate<br />
startup<br />
</code></p>
<p>I guess that the problem is that moste datafiles (smallfiles) are full (max. number of blocks). So the io calibrate tool can not write to this files.</p>
<p>System aio slots:</p>
<pre>To find out the maximum avalable asynch I/O slots:
$ cat /proc/sys/fs/aio-max-nr
65536

To find out how many are being used:
$ cat /proc/sys/fs/aio-nr

increase fs.aio-max-nr if nessesary (or restart some db's)
65536</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=201</wfw:commentRss>
		</item>
		<item>
		<title>commit rate sampler for oracle</title>
		<link>http://www.asktherealtom.ch/?p=199</link>
		<comments>http://www.asktherealtom.ch/?p=199#comments</comments>
		<pubDate>Wed, 14 Jul 2010 10:26:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[11gR2]]></category>

		<category><![CDATA[commit]]></category>

		<category><![CDATA[oracle]]></category>

		<category><![CDATA[pl/sql]]></category>

		<category><![CDATA[rate]]></category>

		<category><![CDATA[sampler]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=199</guid>
		<description><![CDATA[Today a wrote a simple commit sampler for oracle databases. With this simple tool it possible to see the commit rate on the database.
It can be usefull to compre the application perfomance on batch processing system and analyze commit related waits.
@snapcommit  
Example
@snapcommit 1 20
snapcommit.sql

set tab off verify off linesize 299
set termout on serverout on [...]]]></description>
			<content:encoded><![CDATA[<p>Today a wrote a simple commit sampler for oracle databases. With this simple tool it possible to see the commit rate on the database.</p>
<p>It can be usefull to compre the application perfomance on batch processing system and analyze commit related waits.</p>
<p>@snapcommit <timestep in s> <iterations></p>
<p>Example<br />
@snapcommit 1 20</p>
<p>snapcommit.sql<br />
<code><br />
set tab off verify off linesize 299<br />
set termout on serverout on size 1000000 format wrapped</p>
<p>define snap_interval="&#038;1"<br />
define snap_limit="&#038;2"</p>
<p>declare<br />
  cmt_start number;<br />
  cmt_last  number;<br />
  cmt_curr  number;<br />
  cmt_diff  number;</p>
<p>  procedure oprint(p_var varchar2) as<br />
    PRAGMA AUTONOMOUS_TRANSACTION;<br />
  begin<br />
    dbms_output.put_line(p_var);<br />
  end oprint;<br />
begin</p>
<p>  for x in 1..&#038;snap_limit+1<br />
  loop<br />
    cmt_last := cmt_curr;</p>
<p>    select value into cmt_curr from v$sysstat where name='user commits';<br />
    if(x = 1) then<br />
      cmt_start:= cmt_curr;<br />
    else<br />
      cmt_diff := cmt_curr - cmt_last;<br />
      oprint('commits: '||cmt_diff||' in '||&#038;snap_interval||'s' );</p>
<p>    end if;</p>
<p>    dbms_lock.sleep(&#038;snap_interval);<br />
  end loop;<br />
  cmt_diff := cmt_curr - cmt_start;<br />
  dbms_output.put_line('total commits: '||cmt_diff );<br />
end;<br />
/<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=199</wfw:commentRss>
		</item>
		<item>
		<title>access to anydata columns (in DBA_HIST_SQLBIND)</title>
		<link>http://www.asktherealtom.ch/?p=197</link>
		<comments>http://www.asktherealtom.ch/?p=197#comments</comments>
		<pubDate>Fri, 09 Jul 2010 12:10:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[AccessTimestamp]]></category>

		<category><![CDATA[anydata]]></category>

		<category><![CDATA[DBA_HIST_SQLBIND]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=197</guid>
		<description><![CDATA[Just a shorty today:
How do you access the anydata_value from dba_hist_sqlbind?
Solution:
use tha statice converter function of the anydata object type
Example

select SQL_ID,NAME,DATATYPE_STRING,VALUE_STRING,anydata.AccessTimestamp(VALUE_ANYDATA) from DBA_HIST_SQLBIND where sql_id='f17fd6xuvxc7x' and name=':1'

]]></description>
			<content:encoded><![CDATA[<p>Just a shorty today:<br />
How do you access the anydata_value from dba_hist_sqlbind?</p>
<p>Solution:<br />
use tha statice converter function of the anydata object type</p>
<p>Example<br />
<code><br />
select SQL_ID,NAME,DATATYPE_STRING,VALUE_STRING,anydata.AccessTimestamp(VALUE_ANYDATA) from DBA_HIST_SQLBIND where sql_id='f17fd6xuvxc7x' and name=':1'<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=197</wfw:commentRss>
		</item>
		<item>
		<title>Oracle Web Application Trace - Tuning Approach</title>
		<link>http://www.asktherealtom.ch/?p=195</link>
		<comments>http://www.asktherealtom.ch/?p=195#comments</comments>
		<pubDate>Thu, 08 Jul 2010 09:07:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[httpd]]></category>

		<category><![CDATA[modul]]></category>

		<category><![CDATA[oracle]]></category>

		<category><![CDATA[oracle web application]]></category>

		<category><![CDATA[owa]]></category>

		<category><![CDATA[trace]]></category>

		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=195</guid>
		<description><![CDATA[Situation:
The user claims that a oracle web application is slow. The web application is unsing in database java.
Test 1: Determine the slow Part
The webapplication can be run in sqlplus with following pl/sql

set serveroutput on
set timing on
declare
 name owa.vc_arr;
 val owa.vc_arr;
 res owa.vc_arr;
 simple_list__ owa_util.vc_arr;
 complex_list__ owa_util.vc_arr;
 c clob;
begin
    name(1) := '1';
  [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Situation:</strong></p>
<p>The user claims that a oracle web application is slow. The web application is unsing in database java.</p>
<p><strong>Test 1: Determine the slow Part</strong></p>
<p>The webapplication can be run in sqlplus with following pl/sql<br />
<code><br />
set serveroutput on<br />
set timing on<br />
declare<br />
 name owa.vc_arr;<br />
 val owa.vc_arr;<br />
 res owa.vc_arr;<br />
 simple_list__ owa_util.vc_arr;<br />
 complex_list__ owa_util.vc_arr;<br />
 c clob;<br />
begin<br />
    name(1) := '1';<br />
    val(1) := '1';<br />
    OWA.init_cgi_env (0, name, val);<br />
    HTP.init;<br />
--    if ((owa_match.match_pattern('jdb', simple_list__, complex_list__, true))) then<br />
       jdb(1, name, val, res);<br />
--    end if;<br />
    wpg_docload.get_download_file(:doc_info);<br />
    OWA_UTIL.showpage;<br />
end;<br />
/<br />
</code><br />
The result showed that the application is using 4 frames. This means that 1 web request is followed by 4 subsequend requests.<br />
We see as well that the owa functions are not the problem.<br />
<strong></p>
<p>Test 2: Trace the application</strong><br />
To just trace the relevant part, I traced by server and modul name</p>
<p><code><br />
select username,client_identifier,process,module from v$session where module like 'httpd%';</p>
<p>exec DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE('SYS$USERS','httpd@svzpca2 (TNS V1-V3)',  DBMS_MONITOR.ALL_ACTIONS,TRUE,TRUE,NULL);</p>
<p>exec DBMS_MONITOR.SERV_MOD_ACT_TRACE_DISABLE ('SYS$USERS','httpd@svzpca2 (TNS V1-V3)',  DBMS_MONITOR.ALL_ACTIONS,NULL);</p>
<p>cd udump<br />
tkprof<br />
</code></p>
<p>The trace showed one query taken about 10 to 20 seconds per executionn</p>
<p><code></p>
<p>call     count       cpu    elapsed       disk      query    current        rows<br />
------- ------  -------- ---------- ---------- ---------- ----------  ----------<br />
Parse       15      0.00       0.00          0          0          0           0<br />
Execute     15    155.99     152.95          1       4147       8870           0<br />
Fetch       24      0.35       0.38          1       3632          0         134<br />
------- ------  -------- ---------- ---------- ---------- ----------  ----------<br />
total       54    156.34     153.34          2       7779       8870         134</p>
<p>Misses in library cache during parse: 0<br />
Optimizer mode: ALL_ROWS<br />
Parsing user id: 192     (recursive depth: 1)<br />
</code></p>
<p>Now its a simple sql tuning task to solve the problem</p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=195</wfw:commentRss>
		</item>
		<item>
		<title>Partition on an Index Organized Table (IOT)</title>
		<link>http://www.asktherealtom.ch/?p=190</link>
		<comments>http://www.asktherealtom.ch/?p=190#comments</comments>
		<pubDate>Fri, 02 Jul 2010 11:21:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[by has]]></category>

		<category><![CDATA[by range]]></category>

		<category><![CDATA[index organized table]]></category>

		<category><![CDATA[iot]]></category>

		<category><![CDATA[oracle]]></category>

		<category><![CDATA[partition]]></category>

		<guid isPermaLink="false">http://www.asktherealtom.ch/?p=190</guid>
		<description><![CDATA[Today a application developer asket me how he should partition his index organized table.
All query include the primary key, no range, no full scan&#8217;s.
So I told him it doen&#8217;t make sense to partition this table for perfomance reasons.
To profe my statement I did a small Test case.

create table part_range_iot (c1 number, c2 varchar2(20), c3 char(1),
constraint [...]]]></description>
			<content:encoded><![CDATA[<p>Today a application developer asket me how he should partition his index organized table.</p>
<p>All query include the primary key, no range, no full scan&#8217;s.</p>
<p>So I told him it doen&#8217;t make sense to partition this table for perfomance reasons.<br />
To profe my statement I did a small Test case.</p>
<p><code><br />
create table part_range_iot (c1 number, c2 varchar2(20), c3 char(1),<br />
constraint  part_range_iot_pk primary key (c1))<br />
partition by HASH (c1)<br />
PARTITIONS 100<br />
/<br />
begin<br />
for i in 1..999<br />
loop<br />
  insert into part_range_iot values (i,'abcd','y');<br />
end loop;<br />
commit;<br />
end;<br />
/</p>
<p>set autotrace on<br />
set timing on</p>
<p>select * from part_range_iot where c1 = 99;<br />
</code><br />
The output from the query was<br />
<code><br />
Execution Plan<br />
----------------------------------------------------------<br />
Plan hash value: 3787470184</p>
<p>------------------------------------------------------------------------------------------------------------------------<br />
| Id  | Operation                          | Name              | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |<br />
------------------------------------------------------------------------------------------------------------------------<br />
|   0 | SELECT STATEMENT                   |                   |     1 |    28 |     1   (0)| 00:00:01 |       |       |<br />
|   1 |  TABLE ACCESS BY GLOBAL INDEX ROWID| PART_RANGE_IOT    |     1 |    28 |     1   (0)| 00:00:01 |    58 |    58 |<br />
|*  2 |   INDEX UNIQUE SCAN                | PART_RANGE_IOT_PK |     1 |       |     1   (0)| 00:00:01 |       |       |<br />
------------------------------------------------------------------------------------------------------------------------</p>
<p>Predicate Information (identified by operation id):<br />
---------------------------------------------------</p>
<p>   2 - access("C1"=99)</p>
<p>Statistics<br />
----------------------------------------------------------<br />
        104  recursive calls<br />
          0  db block gets<br />
         14  consistent gets<br />
          0  physical reads<br />
</code><br />
So 14 consitent gets were used</p>
<p>The same case without partitioning<br />
<code><br />
create table part_range_iot (c1 number, c2 varchar2(20), c3 char(1),<br />
constraint  part_range_iot_pk primary key (c1))<br />
/</p>
<p>begin<br />
for i in 1..1000<br />
loop<br />
  insert into part_range_iot values (i,'abcd','y');<br />
end loop;<br />
commit;<br />
end;<br />
/</p>
<p>select * from part_range_iot where c1 = 99;<br />
</code></p>
<p>The results on the IOT table without partitions<br />
<code><br />
Execution Plan<br />
----------------------------------------------------------<br />
Plan hash value: 2398071293</p>
<p>-------------------------------------------------------------------------------------------------<br />
| Id  | Operation                   | Name              | Rows  | Bytes | Cost (%CPU)| Time     |<br />
-------------------------------------------------------------------------------------------------<br />
|   0 | SELECT STATEMENT            |                   |     1 |    28 |     1   (0)| 00:00:01 |<br />
|   1 |  TABLE ACCESS BY INDEX ROWID| PART_RANGE_IOT    |     1 |    28 |     1   (0)| 00:00:01 |<br />
|*  2 |   INDEX UNIQUE SCAN         | PART_RANGE_IOT_PK |     1 |       |     1   (0)| 00:00:01 |<br />
-------------------------------------------------------------------------------------------------</p>
<p>Predicate Information (identified by operation id):<br />
---------------------------------------------------</p>
<p>   2 - access("C1"=99)</p>
<p>Statistics<br />
----------------------------------------------------------<br />
         46  recursive calls<br />
          0  db block gets<br />
          8  consistent gets<br />
          0  physical reads<br />
</code><br />
Just 8 consitent reads.</p>
<p>Conclusion:<br />
Partition an IOT on its primary key has just a negative perfomance impact.<br />
The difference is here<br />
TABLE ACCESS BY INDEX ROWID and TABLE ACCESS BY GLOBAL INDEX ROWID.<br />
On the the non partitioned table we have to do just a unique index scan. On the partitioned table we do the same, but we have to find the right partition first.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.asktherealtom.ch/?feed=rss2&amp;p=190</wfw:commentRss>
		</item>
	</channel>
</rss>
