Use second pass replication
- Last Updated: March 30, 2020
- 3 minute read
- OpenEdge
- Version 12.2
Use second pass replication to perform audit data warehouse tasks,track changes to a table during a time interval for any or all fields.
Second pass replication creates a copy of the source table in the second pass database and inserts a record into this table each time there is a change in the source table (for UPDATE, DELETE, INSERT).
A new record is created in the target (or staging) table every time there is a
change in the table irrespective of whether the change happens to the same field. The
replicated table holds a new record for every change in the source table. A new
property, AUDIT_PASS is added to the predefs.i file. This property supports second pass
Replication and the default value of this parameter is set to NO. To start Second Pass
Replication for a setup, this property should be set to YES for that specific setup.
Set up second pass replication
Use the following procedure to o set up second pass replication:
- Create a copy of the Pro2 setup in directory and rename it to
append it with SecondPass. For example, if your setup is in the folder Pro2v60, copy paste that folder and rename it to
Pro2v60_SecondPass.Note: Copy all folders from the Pro2 setup in the appended second pass folder except db and Pro2Lan folders.
- Create a new folder named db in newly created second pass folder. This db folder is created for the target database.
- Open Proenv window and
enter
cd C:\<Pro2 second pass folder>\dbto navigate to the db folder. For example,cd C:\Pro2v60_SecondPass\db - Create an empty target database from the Proenv window. Enter
Prodb <target database name> empty. For example,Prodb secondtgt empty. - Start the target database from the Proenv window. Enter
Proserve <target database name> -S <port number>. For example,Proserve secondtgt -S 6677. - Now load the schema in the target database. In the Proenv window enter
Prowin <target database name>. For example,Prowin secondtgt. The Procedure Editor window appears. - Navigate to . The Data Administration window appears.
- Navigate to . The Load Data Definitions window appears.
- Select the schema file as the input file. For example,
Sports-tgt.df. Click OK. A success message appears on screen once the load is complete. - Navigate to
C:\<Pro2 second pass folder>\bprepl\scripts(C:\Pro2v60_SecondPass\bprepl\scripts)folder. Right click the Pro2 - Editor tool and select Properties. The Pro2 - Editor Properties window appears. - On the Shortcut tab, edit the Start in field to reflect the <Pro2 second pass folder> folder. For example,
C:\Pro2v60_SecondPass. - Edit the Pro2_env.bat file to set the value of the Pro2 setup location to the Second Pass directory.
- Open the
replProc.pffile from C:/Pro2v60_SecondPass/bprepl/scripts folder and modify the replication database section to point to the Pro2 setup.Note: This is not the second pass directory but the Pro2 setup directory. - Save the contents of the
replProc.pffile. - Similarly, edit the
sports2020.pffile and modify the target databases section to point to the database in the Pro2 setup. Save the contents of thesports2020.pffile.
- From C:/Pro2v60_SecondPass/bprepl/repl_tmpl, rename the process
library template name in Second Pass setup directory.
- For a WAN setup, rename the file
tmpl_replproc_WAN_4audit.ptotmpl_replproc_WAN_<TgtDb>.p. - For a LAN setup, rename the file tmpl_replproc_4audit.p to tmpl_replproc_pro2pro.p.
- For a WAN setup, rename the file
- From C:\Pro2v60_SecondPass, open the predefs.i file and change the value for
AUDIT_PASSto YES. - Navigate to the Pro2 web user interface, and select Properties.
Edit the
WRI_TRIG_TEMPLATEto reflecttplt_repltrig-raw.pas Value. Click Save. - Navigate to the Pro2 web user interface, and select Properties.
Edit the
DEL_TRIG_TEMPLATEto reflecttplt_repltrig-raw.pas Value. Click Save. - From the \Pro2v60_secondpass\bprepl\scripts folder, double click the
batchgen_GEN_PROCS.batfile to generate code.