Use second-pass replication
- Last Updated: May 15, 2020
- 3 minute read
Use second-pass replication to perform audit data warehouse tasks, and 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, regardless 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, SECOND_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
To set up second-pass replication:
- Create a copy of the Pro2 setup directory and rename it, appending it with
SecondPass. For example, if your setup is in the folder Pro2v61, copy paste that folder and rename it to Pro2v61_SecondPass.Note: Copy all folders from the Pro2 setup directory to the second-pass folder except for thedbandPro2Lanfolders. - Create a new folder named db in the newly created second-pass folder. This db folder is created for the target database.
- Open a Proenv window and enter
cd C:\Pro2 second-pass folder\dbto navigate to thedbfolder, for example,cd C:\Pro2v61_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 numberfor example,Proserve secondtgt -S 6677. - 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 after the load is complete.
- Navigate to
C:\Pro2 second pass folder\bprepl\scriptsfolder, for example,C:\Pro2v61_SecondPass\bprepl\scripts. - 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, for example,
C:\Pro2v61_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:/Pro2v61_SecondPass/bprepl/scripts folder, and modify the replication database section to point to the Pro2 setup.Note: This is not the second-pass directory. Use the Pro2 setup directory. - Save the contents of the
replProc.pffile. - Edit the
sports2020.pffile, and modify the target databases section to point to the database in the Pro2 setup directory. Save the contents of thesports2020.pffile.
- From C:/Pro2v61_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_4SECOND_PASS.ptotmpl_replproc_WAN_TgtDb.p. - For a LAN setup, rename the file tmpl_replproc_4SECOND_PASS.p to tmpl_replproc_pro2pro.p.
- For a WAN setup, rename the file
- From C:\Pro2v61_SecondPass, open the
predefs.i, file and change the value
for
SECOND_PASStoYES. - Navigate to the Pro2 web interface, and select
Properties. Edit the
WRI_TRIG_TEMPLATEto reflecttplt_repltrig-raw.pas Value. Click Save. - Navigate back to the Properties tab. Edit the
DEL_TRIG_TEMPLATEto reflecttplt_repltrig-raw.pas the Value. Click Save. - From the \Pro2v61_secondpass\bprepl\scripts folder, double click the
batchgen_GEN_PROCS.batfile to generate code.