<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-AU link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='color:#1F497D'>This example thanks to Thien.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>auditdb mydb -b13-may-2018:07:00 -e14-may-2018:07:00
-table=gl_batch_detail -file <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#44546A'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#44546A'>This will create a file (
‘gl_batch_detail.trl’ ) that contains all the transactions related to
‘gl_batch_detail’ table<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#44546A'>Then run this SQL<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#44546A'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>/*create audit structure table for output file from auditdb.
Keep this table handy for future use*/<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>create table aud_structure<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> (datetemp ingresdate not
null with default,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> username char(32) not null
with default,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> operation char(8) not null
with default,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> tranid1 integer not null
with default,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> tranid2 integer not null
with default,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> table_id1 integer not null
with default,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'> table_id2 integer not null
with default) \g<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>create table gl_batch_detail_audit <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>as select a.*, b.* from aud_structure a, gl_batch_detail b <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>where 1 = 2 \g<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>copy table gl_batch_detail_audit () from 'gl_batch_detail.trl'
\g<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>select top 20 * from gl_batch_detail_audit \g<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>+-----------------+---------+--------+-------+----------+---------+---------+--------+--------+-------+------+----------------<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|datetemp
|username |operatio|tranid1|tranid2
|table_id1|table_id2|batch_no|entry_no|sort_no|source|source_doc
<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>+-----------------+---------+--------+-------+----------+---------+---------+--------+--------+-------+------+----------------<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 08:43:02|ingres |append |
21365|1548644761|
775| 0|
10880|
1| 1|JNL |2148
<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 08:43:02|ingres |append |
21365|1548644761|
775| 0|
10880|
1| 2|JNL
|2148 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 08:45:08|ingres |append |
21365|1548644976| 775|
0| 10881|
1| 1|JNL
|2149 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 08:45:08|ingres |append |
21365|1548644976|
775| 0|
10881|
1| 2|JNL
|2149 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:16:35|ingres |append |
21365|1548662386| 775|
0| 10882|
1| 1|REC
|2225 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:16:35|ingres |append |
21365|1548662386|
775| 0|
10882|
1| 2|REC
|2225 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:18:37|ingres |append |
21365|1548663014| 775|
0| 10883|
1| 1|TRB
|7426 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:18:37|ingres |append |
21365|1548663014|
775| 0|
10883|
1| 2|TRB
|7426 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:19:23|ingres |append |
21365|1548663202| 775|
0| 10884|
1| 1|TRB
|7427 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:19:23|ingres |append |
21365|1548663202|
775| 0|
10884|
1| 2|TRB
|7427 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:53:54|ingres |append |
21365|1548670694| 775|
0| 10885|
1| 1|REC
|2226 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 10:53:54|ingres |append |
21365|1548670694|
775| 0|
10885|
1| 2|REC
|2226 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 11:04:05|ingres |append |
21365|1548672816|
775| 0|
10886|
1| 1|TRB
|7429 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 11:04:05|ingres |append |
21365|1548672816|
775| 0|
10886|
1| 2|TRB
|7429 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 11:07:24|ingres |append |
21365|1548673302|
775| 0|
10887|
1| 1|TRB
|7430 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 11:07:24|ingres |append |
21365|1548673302|
775| 0|
10887|
1| 2|TRB
|7430 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 11:07:42|ingres |append |
21365|1548673531|
775| 0|
10888|
1| 1|TRB
|7431 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 11:07:42|ingres |append |
21365|1548673531|
775| 0|
10888|
1| 2|TRB
|7431 <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 22:15:58|ingres |append |
21365|1548747649|
775| 0|
10889|
1| 1|SNV |353J-328-FGYE8A <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>|13/04/18 22:15:58|ingres |append |
21365|1548747649|
775| 0|
10889|
1| 2|SNV |353J-328-FGYE8A <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>+-----------------+---------+--------+-------+----------+---------+---------+--------+--------+--------+-----+----------------<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'>(20 rows)<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Paul<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> info-ingres-bounces@lists.planetingres.org
[mailto:info-ingres-bounces@lists.planetingres.org] <b>On Behalf Of </b>Alex
Hanshaw<br>
<b>Sent:</b> Friday, 18 May 2018 2:14 AM<br>
<b>To:</b> Mark; info-ingres@lists.planetingres.org<br>
<b>Subject:</b> Re: [Info-ingres] Weird problem in Ingres 10<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-GB>See:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><a
href="http://docs.actian.com/ingres/11.0/index.html#page/DatabaseAdmin%2FHow_to_Load_an_Audit_Trail_as_a_Table.htm">http://docs.actian.com/ingres/11.0/index.html#page/DatabaseAdmin%2FHow_to_Load_an_Audit_Trail_as_a_Table.htm</a><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>The example is based on the columns in the
example table. You’ll need to define the target table based on the audited
table.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Alex<o:p></o:p></span></p>
</div>
</body>
</html>