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

<channel>
	<title>AppCrawler</title>
	<atom:link href="http://appcrawler.com/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://appcrawler.com/wordpress</link>
	<description>Tying data to business excellence</description>
	<lastBuildDate>Wed, 16 May 2012 02:23:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Simple example of C# program accessing Oracle</title>
		<link>http://appcrawler.com/wordpress/2012/05/15/simple-example-of-c-program-accessing-oracle/</link>
		<comments>http://appcrawler.com/wordpress/2012/05/15/simple-example-of-c-program-accessing-oracle/#comments</comments>
		<pubDate>Wed, 16 May 2012 02:23:09 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2212</guid>
		<description><![CDATA[Nothing big, just a placeholder for an example of what is in the subject line. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 //C:\Users\showard&#62;C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe /r:&#34;C:\oracle\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll&#34; checkConn.cs &#160; using System; using Oracle.DataAccess.Client; &#160; public class checkConn &#123; public static void Main&#40;String &#91;&#93;args&#41;&#123; [...]]]></description>
			<content:encoded><![CDATA[<p>Nothing big, just a placeholder for an example of what is in the subject line.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//C:\Users\showard&gt;C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe  /r:&quot;C:\oracle\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll&quot; checkConn.cs</span>
&nbsp;
using System<span style="color: #339933;">;</span>
using Oracle.<span style="color: #202020;">DataAccess</span>.<span style="color: #202020;">Client</span><span style="color: #339933;">;</span> 
&nbsp;
public class checkConn <span style="color: #009900;">&#123;</span>
  public <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> Main<span style="color: #009900;">&#40;</span>String <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>args<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    OracleConnection conn <span style="color: #339933;">=</span> new OracleConnection<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;User Id=biztalk;Password=********;Data Source=fn9dev&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    OracleDataReader rdr<span style="color: #339933;">;</span>
    try <span style="color: #009900;">&#123;</span>
      conn.<span style="color: #202020;">Open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      OracleCommand cmd <span style="color: #339933;">=</span> new OracleCommand<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;select sysdate from dual&quot;</span><span style="color: #339933;">,</span> conn<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      rdr <span style="color: #339933;">=</span> cmd.<span style="color: #202020;">ExecuteReader</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>rdr.<span style="color: #202020;">Read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        Console.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Server time is &quot;</span> <span style="color: #339933;">+</span> rdr<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      conn.<span style="color: #202020;">Dispose</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    catch<span style="color: #009900;">&#40;</span>Exception e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      Console.<span style="color: #202020;">WriteLine</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/05/15/simple-example-of-c-program-accessing-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which tables have changes in a GoldenGate trail file?</title>
		<link>http://appcrawler.com/wordpress/2012/05/07/which-tables-have-changes-in-a-goldengate-trail-file/</link>
		<comments>http://appcrawler.com/wordpress/2012/05/07/which-tables-have-changes-in-a-goldengate-trail-file/#comments</comments>
		<pubDate>Mon, 07 May 2012 13:02:26 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2232</guid>
		<description><![CDATA[I use the following to identify which tables have changes recorded in a trail file, as well as how many changes each table has&#8230; 1 2 3 4 5 CMHLDECOMDB01:oracle:cmhecomd1:/u01/app/oracle/acfsmounts/ggate/oracle2/dirdat&#62;strings -a r1000009 &#124; grep ATGDB &#124; sort &#124; uniq -c 6 ATGDB_CORE.DAS_ID_GENERATOR 21873 ATGDB_CORE.DCSPP_ORD_ABANDON 10937 ATGDB_CORE.DCS_USER_ABANDONED CMHLDECOMDB01:oracle:cmhecomd1:/u01/app/oracle/acfsmounts/ggate/oracle2/dirdat&#62;]]></description>
			<content:encoded><![CDATA[<p>I use the following to identify which tables have changes recorded in a trail file, as well as how many changes each table has&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">CMHLDECOMDB01:oracle:cmhecomd1:/u01/app/oracle/acfsmounts/ggate/oracle2/dirdat&gt;strings -a r1000009 | grep ATGDB | sort | uniq -c
      6 ATGDB_CORE.DAS_ID_GENERATOR
  21873 ATGDB_CORE.DCSPP_ORD_ABANDON
  10937 ATGDB_CORE.DCS_USER_ABANDONED
CMHLDECOMDB01:oracle:cmhecomd1:/u01/app/oracle/acfsmounts/ggate/oracle2/dirdat&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/05/07/which-tables-have-changes-in-a-goldengate-trail-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ACFS install on CentOS</title>
		<link>http://appcrawler.com/wordpress/2012/04/25/acfs-install-on-centos/</link>
		<comments>http://appcrawler.com/wordpress/2012/04/25/acfs-install-on-centos/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 19:29:30 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[RAC]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2195</guid>
		<description><![CDATA[I run CentOS on a test cluster, and every time I patch it with a PSU or whatever, my ACFS installation is trashed as CentOS is not officially supported. To fix this, change the following section in $GRID_HOME/lib/osds_acfslib.pm&#8230; if ((defined($release)) &#38;&#38; # Redhat or OEL if defined (($release =~ /^redhat-release/) &#124;&#124; # straight RH ($release [...]]]></description>
			<content:encoded><![CDATA[<p>I run CentOS on a test cluster, and every time I patch it with a PSU or whatever, my ACFS installation is trashed as CentOS is not officially supported.  </p>
<p>To fix this, change the following section in $GRID_HOME/lib/osds_acfslib.pm&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">  if ((defined($release)) &amp;&amp;                     # Redhat or OEL if defined
      (($release =~ /^redhat-release/) ||        # straight RH
       ($release =~ /^enterprise-release/) ||    # Oracle Enterprise Linux
       ($release =~ /^oraclelinux-release/)))    # Oracle Linux
  {</pre></div></div>

<p>&#8230;to&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">  if ((defined($release)) &amp;&amp;                     # Redhat or OEL if defined
      (($release =~ /^redhat-release/) ||        # straight RH
       ($release =~ /^enterprise-release/) ||    # Oracle Enterprise Linux
       ($release =~ /^centos-release/) ||        # CentOS hack
       ($release =~ /^oraclelinux-release/)))    # Oracle Linux
  {</pre></div></div>

<p>&#8230;then re-run the ACFS install as root and you should be good to go.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@expressdb1 ~]# /u01/app/11.2.0/grid/bin/acfsroot install
ACFS-9300: ADVM/ACFS distribution files found.
ACFS-9312: Existing ADVM/ACFS installation detected.
ACFS-9314: Removing previous ADVM/ACFS installation.
ACFS-9315: Previous ADVM/ACFS components successfully removed.
ACFS-9307: Installing requested ADVM/ACFS software.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9321: Creating udev for ADVM/ACFS.
ACFS-9323: Creating module dependencies - this may take some time.
ACFS-9154: Loading 'oracleoks.ko' driver.
ACFS-9154: Loading 'oracleadvm.ko' driver.
ACFS-9154: Loading 'oracleacfs.ko' driver.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'.
ACFS-9156: Detecting control device '/dev/ofsctl'.
ACFS-9309: ADVM/ACFS installation correctness verified.
[root@expressdb1 ~]# exit
logout
expressdb1:oracle:+ASM1:/u01/app/11.2.0/grid/lib# crs_start ora.registry.acfs
Attempting to start `ora.registry.acfs` on member `expressdb1`
Start of `ora.registry.acfs` on member `expressdb1` succeeded.
expressdb1:oracle:+ASM1:/u01/app/11.2.0/grid/lib#</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/04/25/acfs-install-on-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using DBMS_LOGMNR with GoldenGate logdump</title>
		<link>http://appcrawler.com/wordpress/2012/04/23/using-logminer-with-goldengate-logdump/</link>
		<comments>http://appcrawler.com/wordpress/2012/04/23/using-logminer-with-goldengate-logdump/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 15:25:07 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2181</guid>
		<description><![CDATA[I honestly don&#8217;t know if we will ever use this, but I thought it was useful enough to document. One of the things I struggled with early in our GoldenGate testing was what an RBA was. The term was flipped around in the documentation, sometimes with an EXT on the front (EXTRBA), sometimes not. Regardless, [...]]]></description>
			<content:encoded><![CDATA[<p>I honestly don&#8217;t know if we will ever use this, but I thought it was useful enough to document.  </p>
<p>One of the things I struggled with early in our GoldenGate testing was what an RBA was.  The term was flipped around in the documentation, sometimes with an EXT on the front (EXTRBA), sometimes not.  Regardless, it was confusing to me because Oracle also uses the term RBA for &#8220;Redo Byte Address&#8221;.  </p>
<p>The bottom line is that an RBA in GoldenGate is simply the current read position of the source data, whatever that may be.</p>
<p>For a &#8220;regular&#8221; extract, it would be the &#8220;normal&#8221; Oracle RBA, or exact position in the redo log from which the Goldengate process is extracting Oracle database transactions for replication.  For a datapump extract, it is the byte position (or read checkpoint) in the proprietary GoldenGate trail file that is being written by the &#8220;regular&#8221; extract process.  For a replicat, it would be the byte position (or read checkpoint) in the proprietary GoldenGate trail file that is being written by the datapump extract process on the source.</p>
<p>If for whatever reason, you need to tie the position in a &#8220;regular&#8221; trail file to what is in the Oracle database, you can do what is below.</p>
<p>Get the transaction of interest in the trail file using the GoldenGate logdump utility&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Logdump 539 &gt;n
___________________________________________________________________
Hdr-Ind    :     E  (x45)     Partition  :     .  (x04)
UndoFlag   :     .  (x00)     BeforeAfter:     A  (x41)
RecLength  :   142  (x008e)   IO Time    : 2012/04/23 10:10:46.000.000
IOType     :     5  (x05)     OrigNode   :   255  (xff)
TransInd   :     .  (x03)     FormatType :     R  (x52)
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00)
AuditRBA   :        113       AuditPos   : 25834512
Continued  :     N  (x00)     RecCount   :     1  (x01)
&nbsp;
2012/04/23 10:10:46.000.000 Insert               Len   142 RBA 2733
Name: ATL.ORDER_DETAILS
After  Image:                                             Partition 4   G  s
 0000 0028 0000 0024 3333 3335 3965 6166 2d65 3465 | ...(...$33359eaf-e4e
 302d 3462 6636 2d39 3431 342d 3438 6438 3337 3666 | 0-4bf6-9414-48d8376f
 6338 3337 0001 0028 0000 0024 3635 3730 6161 6437 | c837...(...$6570aad7
 2d33 6337 382d 3430 6361 2d61 3639 322d 3335 6431 | -3c78-40ca-a692-35d1
 3430 3465 3062 6333 0002 0028 0000 0024 6333 6437 | 404e0bc3...(...$c3d7
 6561 6332 2d33 3138 362d 3436 6135 2d38 3433 652d | eac2-3186-46a5-843e-
 6333 6336 6135 3534 6439 3661 0003 0006 0000 0002 | c3c6a554d96a........
&nbsp;
GGS tokens:
TokenID x52 'R' ORAROWID         Info x00  Length   20
 4141 4145 5030 4141 4641 4141 424d 5741 4165 0001 | AAAEP0AAFAAABMWAAe..
TokenID x4c 'L' LOGCSN           Info x00  Length    7
 3636 3539 3638 34                                 | 6659684
TokenID x36 '6' TRANID           Info x00  Length    9
 3331 2e31 372e 3539 37                            | 31.17.597
&nbsp;
Logdump 540 &gt;</pre></div></div>

<p>We then take the sequence (AuditRBA) and Oracle RBA (AuditPos) for this change and find it in the archived redo log using DBMS_LOGMNR.  Please note that a redo block in Oracle is 512 bytes (in Linux, at least), so we multiply the RBABLK column for a given change by 512 and add the &#8220;trailing&#8221; RBABYTE, or number of bytes into that block, at which the change is recorded.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> name <span style="color: #993333; font-weight: bold;">FROM</span> v$archived_log <span style="color: #993333; font-weight: bold;">WHERE</span> sequence<span style="color: #808080; font-style: italic;"># = 113;</span>
&nbsp;
NAME
<span style="color: #808080; font-style: italic;">--------------------------------------------------------------------------------</span>
<span style="color: #66cc66;">+</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color: #66cc66;">/</span>express<span style="color: #66cc66;">/</span>archivelog<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2012</span>_04_23<span style="color: #66cc66;">/</span>thread_1_seq_113<span style="color: #66cc66;">.</span>475<span style="color: #66cc66;">.</span>781351919
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> exec dbms_logmnr<span style="color: #66cc66;">.</span>add_logfile<span style="color: #66cc66;">&#40;</span>logfilename <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'+DATA/express/archivelog/2012_04_23/thread_1_seq_113.475.781351919'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
PL<span style="color: #66cc66;">/</span>SQL procedure successfully completed<span style="color: #66cc66;">.</span>
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> exec dbms_logmnr<span style="color: #66cc66;">.</span>dict_from_online_catalog <span style="color: #66cc66;">+</span> dbms_logmnr<span style="color: #66cc66;">.</span>no_rowid_in_stmt<span style="color: #66cc66;">&#41;</span>;
&nbsp;
PL<span style="color: #66cc66;">/</span>SQL procedure successfully completed<span style="color: #66cc66;">.</span>
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> scn <span style="color: #993333; font-weight: bold;">FROM</span> v$logmnr_contents <span style="color: #993333; font-weight: bold;">WHERE</span> rbablk <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">512</span> <span style="color: #66cc66;">+</span> rbabyte <span style="color: #66cc66;">=</span>  <span style="color: #cc66cc;">25834512</span>;
&nbsp;
       SCN
<span style="color: #808080; font-style: italic;">----------</span>
   <span style="color: #cc66cc;">6659681</span>
   <span style="color: #cc66cc;">6659681</span>
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>It is interesting to note that the SCN recorded in the trail file is for the commit on the transaction.  The transaction itself was recorded with an SCN three whole numbers lower.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> sql_redo <span style="color: #993333; font-weight: bold;">FROM</span> v$logmnr_contents <span style="color: #993333; font-weight: bold;">WHERE</span> scn <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">6659681</span>;
&nbsp;
SQL_REDO
<span style="color: #808080; font-style: italic;">--------------------------------------------------------------------------------</span>
<span style="color: #993333; font-weight: bold;">SET</span> transaction <span style="color: #993333; font-weight: bold;">READ</span> <span style="color: #993333; font-weight: bold;">WRITE</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">&quot;ATL&quot;</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">&quot;ORDER_DETAILS&quot;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ID&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;ORDER_ID&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;PRODUCT_ID&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;QUANTITY&quot;</span><span style="color: #66cc66;">&#41;</span> value
s <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'33359eaf-e4e0-4bf6-9414-48d8376fc837'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'6570aad7-3c78-40ca-a692-35d1404e0bc3'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'c3d7eac2-3186-46a5-843e-c3c6a554d96a'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'63'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> sql_redo <span style="color: #993333; font-weight: bold;">FROM</span> v$logmnr_contents <span style="color: #993333; font-weight: bold;">WHERE</span> scn <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">6659684</span>;
&nbsp;
SQL_REDO
<span style="color: #808080; font-style: italic;">--------------------------------------------------------------------------------</span>
commit;
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/04/23/using-logminer-with-goldengate-logdump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How often does GoldenGate checkpoint?</title>
		<link>http://appcrawler.com/wordpress/2012/04/11/how-often-does-goldengate-checkpoint/</link>
		<comments>http://appcrawler.com/wordpress/2012/04/11/how-often-does-goldengate-checkpoint/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 22:29:53 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2158</guid>
		<description><![CDATA[While running a 10046 trace against a replicat session, I saw UPDATE statements against the checkpoint table. While this isn&#8217;t unexpected, as I had configured the replicat to use a checkpoint table, I was curious to see how often it did. in other words, is it every 3 seconds, or every 100 rows, etc. I [...]]]></description>
			<content:encoded><![CDATA[<p>While running a 10046 trace against a replicat session, I saw UPDATE statements against the checkpoint table.  While this isn&#8217;t unexpected, as I had configured the replicat to use a checkpoint table, I was curious to see how often it did.  in other words, is it every 3 seconds, or every 100 rows, etc.</p>
<p>I wasn&#8217;t surprised, as it is never that simple, to find it somewhat random.  To verify, I ran a test with several thousand INSERTs per minute against two tables, ORDERS and ORDER_DETAILS.  I then extracted the CURSOR # in the 10046 trace for each statement, and ran the following awk against the trace file.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">expressdb1:oracle:express1:/u01/app/oracle/diag/rdbms/express/express1/trace# cat a.awk
{
  if ($0 ~ &quot;EXEC #47821729564056&quot; || $0 ~ &quot;EXEC #47821729706488&quot;) {
    j++
    found=1
  }
  else if($0 ~ &quot;XCTEND rlbk=0, rd_only=0&quot; &amp;&amp; found=1) {
    split($0,t,&quot;,&quot;)
    split(t[3],s,&quot;=&quot;)
    PROCESSED++
    if (last &gt; 0 &amp;&amp; (PROCESSED &lt;= 10 || PROCESSED &gt;= 100)) {
      printf(&quot;Inserted %i rows in %.1f seconds before checkpointing\n&quot;,j,(s[2]-last) / 1000000)
    }
    j=0
    last=s[2]
  }
}
expressdb1:oracle:express1:/u01/app/oracle/diag/rdbms/express/express1/trace# awk -f a.awk express1_ora_23158.trc
Inserted 701 rows in 1.3 seconds before checkpointing
Inserted 236 rows in 2.9 seconds before checkpointing
Inserted 399 rows in 10.1 seconds before checkpointing
Inserted 22 rows in 1.7 seconds before checkpointing
Inserted 75 rows in 3.3 seconds before checkpointing
Inserted 458 rows in 4.1 seconds before checkpointing
Inserted 107 rows in 1.2 seconds before checkpointing
Inserted 339 rows in 7.2 seconds before checkpointing
Inserted 164 rows in 5.0 seconds before checkpointing
Inserted 263 rows in 5.4 seconds before checkpointing
Inserted 89 rows in 3.1 seconds before checkpointing
Inserted 121 rows in 5.5 seconds before checkpointing
Inserted 160 rows in 2.0 seconds before checkpointing
Inserted 363 rows in 4.3 seconds before checkpointing
Inserted 107 rows in 13.6 seconds before checkpointing
Inserted 303 rows in 1.8 seconds before checkpointing
Inserted 120 rows in 2.4 seconds before checkpointing
Inserted 118 rows in 1.3 seconds before checkpointing
Inserted 204 rows in 2.3 seconds before checkpointing
Inserted 333 rows in 6.1 seconds before checkpointing
Inserted 64 rows in 4.3 seconds before checkpointing
Inserted 198 rows in 9.9 seconds before checkpointing
Inserted 6 rows in 7.0 seconds before checkpointing
expressdb1:oracle:express1:/u01/app/oracle/diag/rdbms/express/express1/trace#</pre></div></div>

<p>When I did the math, I found the time between checkpoints was as low as about a second, and as high as 13 seconds.  The median and average was about two seconds.  The INSERT execution counts between checkpoints, as you can see above, are all over the map.</p>
<p>No real information, but I thought it was interesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/04/11/how-often-does-goldengate-checkpoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically creating GoldenGate confliction detection filters</title>
		<link>http://appcrawler.com/wordpress/2012/04/11/programmatically-creating-goldengate-confliction-detection-filters/</link>
		<comments>http://appcrawler.com/wordpress/2012/04/11/programmatically-creating-goldengate-confliction-detection-filters/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 16:01:41 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=1998</guid>
		<description><![CDATA[EDIT: 2012/05/01 I changed the PL/SQL code below, as I found that creating a filter per column eventually exhausts the hardcoded limit on the number of filters you can have for a table (20). I changed it to do a count of records where each and every column&#8217;s before value matches each and every columns [...]]]></description>
			<content:encoded><![CDATA[<p><b>EDIT:  2012/05/01 I changed the PL/SQL code below, as I found that creating a filter per column eventually exhausts the hardcoded limit on the number of filters you can have for a table (20).  I changed it to do a count of records where each and every column&#8217;s before value matches each and every columns current value in the target.  I am having issues with line length when I do this, so this may be updated again.</b></p>
<p>Out of the box, Golden Gate will not detect any conflicts in which the target data is different than what the source is prior to submission.  If a row doesn&#8217;t exist that is sbumitted for update from the source, that will throw an ORA-01403.  If you try to insert a row into the target for which the primary key value already exists in the target, and ORA-00001 will be thrown by the database, as you would expect.</p>
<p>However, assume you have a row in the source such as&#8230;</p>
<p>PRODUCT_ID               10<br />
INVENTORY_QUANTITY 100</p>
<p>&#8230;that is then updated to&#8230;</p>
<p>PRODUCT_ID               10<br />
INVENTORY_QUANTITY 90</p>
<p>&#8230;and the target has an update made directly to it like&#8230;</p>
<p>PRODUCT_ID               10<br />
INVENTORY_QUANTITY 40</p>
<p>When the update to 90 is sent to the replicat on the target, GoldenGate will not throw any exceptions, and will update the INVENTORY_QUANTITY to 90.</p>
<p>Monday morning, the guys in the warehouse are trying to ship product that doesn&#8217;t exist in the inventory system.  It might go something like, &#8220;hey, we are missing 50 units.&#8221;  Ouch&#8230;</p>
<p>What is below will programmatically create filters for checking prior to update to ensure there wasn&#8217;t an update on the target about which we didn&#8217;t know.  We didn&#8217;t want to implement all kinds of conflict handlers as we are in the midst of an ATG implementation, and don&#8217;t understand the data well enough to make those decisions in advance.  This will simply trap an issue if it exists and abend.  That is acceptable to us in the short run for two reasons:</p>
<li>We don&#8217;t want to accept the risk of making an incorrect business data decision and doing more harm than good
<li>We are practicing conflict avoidance by creating sticky session profiles at the network layer that tie an account to a particular data center.  As such, we don&#8217;t expect a *lot* of conflicts.
<p>What is below simply creates select of all columns other than the primary key where the value = what it was on the source before the update.  If a matching &#8220;pre-version&#8221; row is not found on the target, an exception is thrown.</p>
<p>The beautiful thing about this is that GoldenGate does not execute the &#8220;filter&#8221; SQL for every update.  It must be smart enough to check the incoming values and what it is in the target before updating.  I know this because I ran a 10046 trace against the replicat process, and the select for the &#8220;filter&#8221; was only parsed, never executed during a test with thousands of updates.  However, as soon as I forced in a conflicting update that was considered for processing by the replicat, the select filter was executed and the replicat process abended (because the check didn&#8217;t pass).</p>
<p>As such, you don&#8217;t have to worry about the overhead of the filter.  I think that is what is meant by an extraction map, it just maintains it in memory.</p>

<div class="wp_syntax"><div class="code"><pre class="plsql" style="font-family:monospace;"><span style="color: #00F;">SET</span> serveroutput <span style="color: #00F;">ON</span> size unlimited
spool conflict<span style="color: #00F;">.</span><span style="color: #00F;">OUT</span>
<span style="color: #00F;">SET</span> lines <span style="color: #800;">1000</span> trims <span style="color: #00F;">ON</span>
<span style="color: #00F;">SET</span> echo off
<span style="color: #00F;">SET</span> feedback off
<span style="color: #00F;">DECLARE</span>
  <span style="color: #080; font-style: italic;">/*
  Simple anonymous block that will read the dictionary for a given schema and output rules that will detect conflicts
    if after an update all column values other than the primary key have changed since the update was issued on the
    source.
  */</span>
  skip <span style="color: #00F;">NUMBER</span> <span style="color: #00F;">:=</span> <span style="color: #800;">0</span><span style="color: #00F;">;</span>
  p_source <span style="color: #00F;">VARCHAR2</span><span style="color: #00F;">&#40;</span><span style="color: #800;">30</span><span style="color: #00F;">&#41;</span> <span style="color: #00F;">:=</span> <span style="color: #F00;">'ATGDB_EXPRESS_CORE'</span><span style="color: #00F;">;</span>
  p_target <span style="color: #00F;">VARCHAR2</span><span style="color: #00F;">&#40;</span><span style="color: #800;">30</span><span style="color: #00F;">&#41;</span> <span style="color: #00F;">:=</span> <span style="color: #F00;">'ATGDB_EXPRESS_CORE_REP'</span><span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #00F;">TYPE</span> t_columns <span style="color: #00F;">IS</span> <span style="color: #00F;">TABLE</span> <span style="color: #00F;">OF</span> <span style="color: #00F;">VARCHAR2</span><span style="color: #00F;">&#40;</span><span style="color: #800;">30</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
  colns t_columns <span style="color: #00F;">:=</span> t_columns<span style="color: #00F;">&#40;</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #00F;">TYPE</span> t_keys <span style="color: #00F;">IS</span> <span style="color: #00F;">TABLE</span> <span style="color: #00F;">OF</span> <span style="color: #00F;">VARCHAR2</span><span style="color: #00F;">&#40;</span><span style="color: #800;">30</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
  keys t_keys <span style="color: #00F;">:=</span> t_keys<span style="color: #00F;">&#40;</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
&nbsp;
  <span style="color: #00F;">PROCEDURE</span> get_columns<span style="color: #00F;">&#40;</span>p_table <span style="color: #00F;">IN</span> <span style="color: #00F;">VARCHAR2</span><span style="color: #00F;">&#41;</span> <span style="color: #00F;">IS</span>
    i <span style="color: #00F;">NUMBER</span> <span style="color: #00F;">:=</span> <span style="color: #800;">0</span><span style="color: #00F;">;</span>
    l_skip <span style="color: #00F;">NUMBER</span> <span style="color: #00F;">:=</span> <span style="color: #800;">0</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">BEGIN</span>
    <span style="color: #00F;">FOR</span> col <span style="color: #00F;">IN</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> column_name
                  <span style="color: #00F;">FROM</span> dba_cons_columns dcc
                  <span style="color: #00F;">WHERE</span> table_name <span style="color: #00F;">=</span> p_table
                    <span style="color: #00F;">AND</span> owner <span style="color: #00F;">=</span> p_source
                    <span style="color: #00F;">AND</span> <span style="color: #00F;">EXISTS</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> <span style="color: #800;">1</span>
                                  <span style="color: #00F;">FROM</span> dba_constraints dc
                                  <span style="color: #00F;">WHERE</span> owner <span style="color: #00F;">=</span> p_source
                                    <span style="color: #00F;">AND</span> dc<span style="color: #00F;">.</span>table_name <span style="color: #00F;">=</span> dcc<span style="color: #00F;">.</span>table_name
                                    <span style="color: #00F;">AND</span> dc<span style="color: #00F;">.</span>constraint_name <span style="color: #00F;">=</span> dcc<span style="color: #00F;">.</span>constraint_name
                                    <span style="color: #00F;">AND</span> dc<span style="color: #00F;">.</span>owner <span style="color: #00F;">=</span> dcc<span style="color: #00F;">.</span>owner
                                    <span style="color: #00F;">AND</span> constraint_type <span style="color: #00F;">=</span> <span style="color: #F00;">'P'</span><span style="color: #00F;">&#41;</span>
                  <span style="color: #00F;">ORDER</span> <span style="color: #00F;">BY</span> position
                <span style="color: #00F;">&#41;</span> <span style="color: #00F;">LOOP</span>
      keys<span style="color: #00F;">.</span>extend<span style="color: #00F;">&#40;</span><span style="color: #800;">1</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
      i <span style="color: #00F;">:=</span> i <span style="color: #00F;">+</span> <span style="color: #800;">1</span><span style="color: #00F;">;</span>
      keys<span style="color: #00F;">&#40;</span>i<span style="color: #00F;">&#41;</span> <span style="color: #00F;">:=</span> col<span style="color: #00F;">.</span>column_name<span style="color: #00F;">;</span>
    <span style="color: #00F;">END</span> <span style="color: #00F;">LOOP</span><span style="color: #00F;">;</span>
    i <span style="color: #00F;">:=</span> <span style="color: #800;">0</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">FOR</span> col <span style="color: #00F;">IN</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> column_name <span style="color: #00F;">FROM</span> dba_tab_columns <span style="color: #00F;">WHERE</span> table_name <span style="color: #00F;">=</span> p_table <span style="color: #00F;">AND</span> owner <span style="color: #00F;">=</span> p_source<span style="color: #00F;">&#41;</span> <span style="color: #00F;">LOOP</span>
      <span style="color: #00F;">FOR</span> j <span style="color: #00F;">IN</span> 1<span style="color: #00F;">..</span>keys<span style="color: #00F;">.</span><span style="color: #000;">COUNT</span> <span style="color: #00F;">LOOP</span>
        <span style="color: #00F;">IF</span> keys<span style="color: #00F;">&#40;</span>j<span style="color: #00F;">&#41;</span> <span style="color: #00F;">=</span> col<span style="color: #00F;">.</span>column_name <span style="color: #00F;">THEN</span>
          l_skip <span style="color: #00F;">:=</span> <span style="color: #800;">1</span><span style="color: #00F;">;</span>
          <span style="color: #00F;">EXIT</span><span style="color: #00F;">;</span>
        <span style="color: #00F;">END</span> <span style="color: #00F;">IF</span><span style="color: #00F;">;</span>
      <span style="color: #00F;">END</span> <span style="color: #00F;">LOOP</span><span style="color: #00F;">;</span>
      <span style="color: #00F;">IF</span> l_skip <span style="color: #00F;">=</span> <span style="color: #800;">0</span> <span style="color: #00F;">THEN</span>
        colns<span style="color: #00F;">.</span>extend<span style="color: #00F;">&#40;</span><span style="color: #800;">1</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
        i <span style="color: #00F;">:=</span> i <span style="color: #00F;">+</span> <span style="color: #800;">1</span><span style="color: #00F;">;</span>
        colns<span style="color: #00F;">&#40;</span>i<span style="color: #00F;">&#41;</span> <span style="color: #00F;">:=</span> col<span style="color: #00F;">.</span>column_name<span style="color: #00F;">;</span>
      <span style="color: #00F;">END</span> <span style="color: #00F;">IF</span><span style="color: #00F;">;</span>
      l_skip <span style="color: #00F;">:=</span> <span style="color: #800;">0</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">END</span> <span style="color: #00F;">LOOP</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">END</span><span style="color: #00F;">;</span>
<span style="color: #00F;">BEGIN</span>
  <span style="color: #00F;">FOR</span> tab <span style="color: #00F;">IN</span> <span style="color: #00F;">&#40;</span><span style="color: #00F;">SELECT</span> table_name <span style="color: #00F;">FROM</span> dba_tables <span style="color: #00F;">WHERE</span> owner <span style="color: #00F;">=</span> p_source<span style="color: #00F;">&#41;</span> <span style="color: #00F;">LOOP</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put_line<span style="color: #00F;">&#40;</span><span style="color: #F00;">'map '</span> <span style="color: #00F;">||</span> p_source <span style="color: #00F;">||</span> <span style="color: #F00;">'.'</span> <span style="color: #00F;">||</span> tab<span style="color: #00F;">.</span>table_name <span style="color: #00F;">||</span> <span style="color: #F00;">', target '</span> <span style="color: #00F;">||</span> p_target <span style="color: #00F;">||</span> <span style="color: #F00;">'.'</span> <span style="color: #00F;">||</span> tab<span style="color: #00F;">.</span>table_name <span style="color: #00F;">||</span> <span style="color: #F00;">', &amp;'</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put_line<span style="color: #00F;">&#40;</span><span style="color: #F00;">'sqlexec (id '</span> <span style="color: #00F;">||</span> tab<span style="color: #00F;">.</span>table_name <span style="color: #00F;">||</span> <span style="color: #F00;">'_check, on update, beforefilter, &amp; '</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    get_columns<span style="color: #00F;">&#40;</span>tab<span style="color: #00F;">.</span>table_name<span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put<span style="color: #00F;">&#40;</span><span style="color: #F00;">'query &quot;select count(*) cnt from '</span> <span style="color: #00F;">||</span> p_target <span style="color: #00F;">||</span> <span style="color: #F00;">'.'</span> <span style="color: #00F;">||</span> tab<span style="color: #00F;">.</span>table_name <span style="color: #00F;">||</span> <span style="color: #F00;">' where '</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">FOR</span> j <span style="color: #00F;">IN</span> 1<span style="color: #00F;">..</span>colns<span style="color: #00F;">.</span><span style="color: #000;">COUNT</span> <span style="color: #00F;">LOOP</span>
      <span style="color: #00F;">IF</span> j <span style="color: #00F;">=</span> <span style="color: #800;">1</span> <span style="color: #00F;">THEN</span>
        <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put<span style="color: #00F;">&#40;</span>colns<span style="color: #00F;">&#40;</span>j<span style="color: #00F;">&#41;</span> <span style="color: #00F;">||</span> <span style="color: #F00;">' = :p'</span> <span style="color: #00F;">||</span> j<span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
      <span style="color: #00F;">ELSE</span>
        <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put<span style="color: #00F;">&#40;</span><span style="color: #F00;">' and '</span> <span style="color: #00F;">||</span> colns<span style="color: #00F;">&#40;</span>j<span style="color: #00F;">&#41;</span> <span style="color: #00F;">||</span> <span style="color: #F00;">' = :p'</span> <span style="color: #00F;">||</span> j<span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
      <span style="color: #00F;">END</span> <span style="color: #00F;">IF</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">END</span> <span style="color: #00F;">LOOP</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">FOR</span> j <span style="color: #00F;">IN</span> 1<span style="color: #00F;">..</span>colns<span style="color: #00F;">.</span><span style="color: #000;">COUNT</span> <span style="color: #00F;">LOOP</span>
      <span style="color: #00F;">IF</span> j <span style="color: #00F;">=</span> <span style="color: #800;">1</span> <span style="color: #00F;">THEN</span>
        <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put<span style="color: #00F;">&#40;</span><span style="color: #F00;">'&quot;, &amp; '</span> <span style="color: #00F;">||</span> <span style="color: #000;">CHR</span><span style="color: #00F;">&#40;</span><span style="color: #800;">10</span><span style="color: #00F;">&#41;</span> <span style="color: #00F;">||</span> <span style="color: #F00;">'params (p'</span> <span style="color: #00F;">||</span> j <span style="color: #00F;">||</span> <span style="color: #F00;">' = '</span> <span style="color: #00F;">||</span> colns<span style="color: #00F;">&#40;</span>j<span style="color: #00F;">&#41;</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
      <span style="color: #00F;">ELSE</span>
        <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put<span style="color: #00F;">&#40;</span><span style="color: #F00;">',p'</span> <span style="color: #00F;">||</span> j <span style="color: #00F;">||</span> <span style="color: #F00;">' = '</span> <span style="color: #00F;">||</span> colns<span style="color: #00F;">&#40;</span>j<span style="color: #00F;">&#41;</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
      <span style="color: #00F;">END</span> <span style="color: #00F;">IF</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">END</span> <span style="color: #00F;">LOOP</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put_line<span style="color: #00F;">&#40;</span><span style="color: #F00;">')), &amp;'</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put_line<span style="color: #00F;">&#40;</span><span style="color: #F00;">'filter (on update, '</span> <span style="color: #00F;">||</span> tab<span style="color: #00F;">.</span>table_name <span style="color: #00F;">||</span> <span style="color: #F00;">'_check.cnt &gt;  0, raiseerror 9999);'</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    <span style="color: #00F;">DBMS_OUTPUT</span><span style="color: #00F;">.</span>put_line<span style="color: #00F;">&#40;</span><span style="color: #000;">CHR</span><span style="color: #00F;">&#40;</span><span style="color: #800;">10</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">&#41;</span><span style="color: #00F;">;</span>
    keys<span style="color: #00F;">.</span><span style="color: #00F;">DELETE</span><span style="color: #00F;">;</span>
    colns<span style="color: #00F;">.</span><span style="color: #00F;">DELETE</span><span style="color: #00F;">;</span>
  <span style="color: #00F;">END</span> <span style="color: #00F;">LOOP</span><span style="color: #00F;">;</span>
<span style="color: #00F;">END</span><span style="color: #00F;">;</span>
<span style="color: #00F;">/</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/04/11/programmatically-creating-goldengate-confliction-detection-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print thread dump for a single thread</title>
		<link>http://appcrawler.com/wordpress/2012/04/09/print-thread-dump-for-single-thread/</link>
		<comments>http://appcrawler.com/wordpress/2012/04/09/print-thread-dump-for-single-thread/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 16:27:31 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Shell scripting]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2113</guid>
		<description><![CDATA[We had an issue where a single thread was using all the CPU. We wanted to check it at the command line while troubleshooting. We used what is below&#8230; [atg@CMHLDECOMAP01 ~]$ jstack 3000 &#124; awk '{if ($1 == &#34;\&#34;Thread-9\&#34;&#34;) {i = 1;print $0} else if (i == 1 &#38;&#38; $0 != &#34;&#34;) {print $0} else [...]]]></description>
			<content:encoded><![CDATA[<p>We had an issue where a single thread was using all the CPU.  We wanted to check it at the command line while troubleshooting.  We  used what is below&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[atg@CMHLDECOMAP01 ~]$ jstack 3000 | awk '{if ($1 == &quot;\&quot;Thread-9\&quot;&quot;) {i = 1;print $0} else if (i == 1 &amp;&amp; $0 != &quot;&quot;) {print $0} else if (i == 1 &amp;&amp; $0 == &quot;&quot;) {exit}}'
&quot;Thread-9&quot; daemon prio=10 tid=0x000000000c849800 nid=0xbd7 runnable [0x0000000041595000]
   java.lang.Thread.State: RUNNABLE
        at org.apache.log4j.Category.getEffectiveLevel(Category.java:439)
        at org.apache.log4j.Category.isDebugEnabled(Category.java:733)
        at com.arjuna.common.internal.util.logging.jakarta.Log4JLogger.isDebugEnabled(Log4JLogger.java:317)
        at com.arjuna.common.internal.util.logging.jakarta.JakartaRelevelingLogger.isDebugEnabled(JakartaRelevelingLogger.java:73)
        at com.arjuna.common.internal.util.logging.LogNoi18nImpl.isDebugEnabled(LogNoi18nImpl.java:108)
        at com.arjuna.ats.arjuna.coordinator.TransactionReaper.check(TransactionReaper.java:169)
        at com.arjuna.ats.internal.arjuna.coordinator.ReaperThread.run(ReaperThread.java:122)
[atg@CMHLDECOMAP01 ~]$</pre></div></div>

<p>This will print the call stack of that given thread, and that given thread only.</p>
]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/04/09/print-thread-dump-for-single-thread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GoldenGate simple conflict resolution example</title>
		<link>http://appcrawler.com/wordpress/2012/04/07/goldengate-simple-conflict-resolution-example/</link>
		<comments>http://appcrawler.com/wordpress/2012/04/07/goldengate-simple-conflict-resolution-example/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 13:27:53 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2098</guid>
		<description><![CDATA[I found it incredibly difficult to find a simple working example of an inventory type system where a user at SITE A updates the inventory for &#8216;Bowl&#8217;, while at SITE B another user updates the inventory at the exact same time. Normally, without conflict detection and resolution, each update would be replicated to the other [...]]]></description>
			<content:encoded><![CDATA[<p>I found it incredibly difficult to find a simple working example of an inventory type system where a user at SITE A updates the inventory for &#8216;Bowl&#8217;, while at SITE B another user updates the inventory at the exact same time.  Normally, without conflict detection and resolution, each update would be replicated to the other database, at which point you would have out of sync data.  In other words, update SITE A to 20, and SITE B to 30.  After each change is replicated, you have inventory of 30 at SITE A, and 20 at SITE B.</p>
<p>Assume we start with what is below at each site&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> inventory<span style="color: #66cc66;">&#40;</span>id number <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">,</span> quantity number<span style="color: #66cc66;">&#41;</span>;
begin
  <span style="color: #993333; font-weight: bold;">FOR</span> i <span style="color: #993333; font-weight: bold;">IN</span> 1<span style="color: #66cc66;">..</span>10 loop
    <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> inventory <span style="color: #993333; font-weight: bold;">VALUES</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">,</span> i <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
    commit;
  end loop;
end;
<span style="color: #66cc66;">/</span></pre></div></div>

<p>I found it easy to detect this conflict with what is below in the replicat parameter file at each site, changing the schema names.  In other words, flip the CMH and ATL in the SITE B replicat file from what it is at SITE A (we have two different schemas in the same database for testing)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">map CMH.INVENTORY, target ATL.INVENTORY, &amp;
sqlexec (id INVENTORY_check, on update, beforefilter, &amp;
query &quot;select QUANTITY from ATL.INVENTORY where ID = :p1&quot;, params (p1 = ID)), &amp;
filter (on update, before.QUANTITY = INVENTORY_check.QUANTITY, raiseerror 9999);</pre></div></div>

<p>If a row with the expected &#8220;before&#8221; update quantity was not found at the replicat site, the replicat process would abend, which is good (for now).</p>
<p>You would see something like what is below</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">2012-04-03 21:33:22  WARNING OGG-01432  Oracle GoldenGate Delivery for Oracle, atlrep.prm:  Aborted grouped transaction on 'ATL.INVENTORY', Filter not passed.
2012-04-03 21:33:22  WARNING OGG-01003  Oracle GoldenGate Delivery for Oracle, atlrep.prm:  Repositioning to rba 10304 in seqno 6.
2012-04-03 21:33:22  WARNING OGG-01155  Oracle GoldenGate Delivery for Oracle, atlrep.prm:  Filter not passed: user error 20000 mapping CMH.INVENTORY to ATL.INVENTORY.
2012-04-03 21:33:22  WARNING OGG-01003  Oracle GoldenGate Delivery for Oracle, atlrep.prm:  Repositioning to rba 10304 in seqno 6.
2012-04-03 21:33:22  ERROR   OGG-01296  Oracle GoldenGate Delivery for Oracle, atlrep.prm:  Error mapping from CMH.INVENTORY to ATL.INVENTORY.
2012-04-03 21:33:22  ERROR   OGG-01668  Oracle GoldenGate Delivery for Oracle, atlrep.prm:  PROCESS ABENDING</pre></div></div>

<p>However, all I ever found was how to calculate what the quantity should be (the actual math) if it were to be handled correctly by a conflict resolution process.  I could never find the actual syntax to actually set up the conflict resolution rule!!</p>
<p>As a result, I decided to use a COLMAP, which both detects the conflict, and applies the fix if needed.  This is shown below.  Please note that if you use this, you don&#8217;t need the MAP entry I have above for conflict detection.  This replaces it.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">map CMH.INVENTORY, target ATL.INVENTORY, &amp;
sqlexec (id INVENTORY_check, on update, &amp;
query &quot;select quantity from ATL.inventory where ID = :p1&quot;, params (p1 = ID)), &amp;
COLMAP (usedefaults, &amp;
        quantity = @if (before.quantity &lt;&gt; inventory_check.quantity, &amp;
             @compute(quantity - (before.quantity - inventory_check.quantity)), &amp;
             quantity)
       );</pre></div></div>

<p>All this does is apply the values found in the replicat trail file for all columns with the exception of quantity.  For this column, it determines if the pre-update version in the target replicat database is the same as the pre-update value was in the source extract database.  If it is, it just replicates the inventory value provided in the trail file.  If it doesn&#8217;t match (a conflicting update occurred at the target between the update at the source and the time the target tried to process it from the replicat), it dynamically calculates what total inventory should be based on the fact the net of the two transactions should increment or decrement inventory by the combined amounts.  This replaces what is found in the replicat trail file.  As noted, this both detects the conflict and handles it.</p>
<p>Our next post will show how to handle something like this using a stored procedure.</p>
<p>I hope this helps someone!</p>
<p>EDIT:</p>
<p>Technically, you don&#8217;t even have to check if the values match.  You could run the update and just assume the values don&#8217;t match, as the update statement will do the correct thing, anyway.</p>
<p>You can use what is below:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">map CMH.INVENTORY, target ATL.INVENTORY, &amp;
sqlexec (id INVENTORY_check, on update, &amp;
query &quot;select quantity from ATL.inventory where ID = :p1&quot;, params (p1 = ID)), &amp;
COLMAP (usedefaults, &amp;
        quantity = @compute(quantity - (before.quantity - inventory_check.quantity))
       );</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/04/07/goldengate-simple-conflict-resolution-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ORA-12516 &#8211; Possible causes</title>
		<link>http://appcrawler.com/wordpress/2012/03/28/ora-12516-possible-causes/</link>
		<comments>http://appcrawler.com/wordpress/2012/03/28/ora-12516-possible-causes/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 17:04:15 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2077</guid>
		<description><![CDATA[At least one is when your processes parameter in the database instance(s) has/have been exceeded. java.sql.SQLException: Listener refused the connection with the following error: ORA-12516, TNS:listener could not find available handler with matching protocol stack &#160; at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:451) at oracle.jdbc.driver.PhysicalConnection.&#60;init&#62;(PhysicalConnection.java:535) at oracle.jdbc.driver.T4CConnection.&#60;init&#62;(T4CConnection.java:218) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528) at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:401) at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:288) at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:205) at stressRetail.run(stressRetail.java:82) at [...]]]></description>
			<content:encoded><![CDATA[<p>At least one is when your processes parameter in the database instance(s) has/have been exceeded.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">java.sql.SQLException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack
&nbsp;
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:451)
        at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:535)
        at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:218)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
        at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:401)
        at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:288)
        at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:205)
        at stressRetail.run(stressRetail.java:82)
        at java.lang.Thread.run(Unknown Source)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/03/28/ora-12516-possible-causes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java date difference in milliseconds</title>
		<link>http://appcrawler.com/wordpress/2012/03/28/java-date-difference-in-milliseconds/</link>
		<comments>http://appcrawler.com/wordpress/2012/03/28/java-date-difference-in-milliseconds/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 13:52:20 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://appcrawler.com/wordpress/?p=2068</guid>
		<description><![CDATA[Every time I need to do math on a date in java, I end up googling it. While that isn&#8217;t the worst way to do things (hey, it&#8217;s probably how you found this ), I wanted something I *knew* would be there. I know there are libraries out there for this, but I usually want [...]]]></description>
			<content:encoded><![CDATA[<p>Every time I need to do math on a date in java, I end up googling it.  While that isn&#8217;t the worst way to do things (hey, it&#8217;s probably how you found this <img src='http://appcrawler.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), I wanted something I *knew* would be there.  I know there are libraries out there for this, but I usually want something very simple like, &#8220;run this in a loop for 60 seconds&#8221;.  Here is what I use&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">long</span> START_TIME <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">util</span>.<span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">util</span>.<span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> START_TIME <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">60000</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//do something</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I don&#8217;t know how efficient the getTime() method is, but this works.  You could also use System.currentTimeMillis()&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">long</span> START_TIME <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">util</span>.<span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> START_TIME <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">60000</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//do something</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>My guess is this is more efficient.  One of these days I will test it.</p>
]]></content:encoded>
			<wfw:commentRss>http://appcrawler.com/wordpress/2012/03/28/java-date-difference-in-milliseconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

