Re-synchronize (Datamerge) Database Logging Files

Re-synchronize (Datamerge) overview.

Datamerge command

Datamerge command example

Datamerge process

Re-synchronize (Datamerge) Overview

The Database Logger uses ODBC database tables to store historical data. For Server redundancy, the same database tables are created on the primary and secondary servers.

Time synchronization works as follows:

One of the redundant servers goes down.

Two ptnr_<timestamp>.log file are generated in the project's \log directory.

One on the primary server

One on the secondary server

With <timestamp> as the date and time the file was created the ptnr_<timestamp>.log records on the:

Server

Clocked time

Secondary

When one of the servers went down and came back up.

Primary

When one of the servers went down and came back up.

Important: If there is no data with the exact time stamp that is at the exact End time stated in the destination database , the Datamerge utility will:

Search for the next latest logged data in the destination and

Merge to that point.

Datamerge will automatically use the found next latest logged data as the END time even though an End time was specified at the command line or via the ptnr* files.

These files are then used to synchronize the databases.

Datamerge Command

On either the primary or secondary server:

  1. Open the project's Workbench.

  2. Click Tools>Command Prompt on the Workbench menu bar.

The Command window opens.

  1. Continue with the datamerge command as follows.

A

Note: The command prompt should display the path to the selected project.

  1. Type the following.

datamerge /?

  1. Press Enter.

B

A description of the DATAMERGE.EXE command displays in the Command window.

C

Enter the datamerge.exe command with optional parameters to merge specific times.

The command format is:

DATAMERGE.EXE [SOURCE DEST TIME1 TIME2]

Where

 

SOURCE

Source server [MASTER | SLAVE]

 

DEST

Name of the destination server [SLAVE | MASTER]

 

TIME1

Start time for merging data [dd-Mmm-yyyy hh:mm:ss]

 

TIME2

End time for merging data [dd-Mmm-yyyy hh:mm:ss]

Important

The month (only the month) has the first letter capitalized.

MASTER and SLAVE must be capitalized.

You have the option to use either MASTER or SLAVE (as KEYWORDS) for the SOURCE and DEST servers.

If no arguments are supplied, the merge occurs from the primary to the secondary and vice-versa using the ptnr_<timestamp>.log files that reside in both primary and secondary log directories.

Datamerge Command Example

Following are examples of the datamerge.exe command.

datamerge MASTER SLAVE 23-Jan-2007 21:00:00 25-Jan-2005 14:00:00

or

datamerge SLAVE MASTER 23-Jan-2007 21:00:00 25-Jan-2005 14:00:00

Datamerge Execution Process

Following is how datamerge.exe is executed from the primary to the secondary server.

As it executes, the datamerge.exe utility:

  1. Reads the ptnr_<timestamp>.log files on the primary and secondary servers.

  2. Determines from the ptnr_<timestamp>.log files in the primary server's \log directory what data needs to be merged from the primary server's database to the secondary server's database.

  3. Executes the merge from primary to secondary.

  4. Determines from the ptnr_<timestamp>.log files in the secondary \log directory what data needs to be merged from the secondary server's database to the primary server's database

  5. Executes the merge from secondary to primary.

A db_merge.log file is generated to report the success or failure of the merge.

 Notes

The process from the secondary to primary server merges the files from the secondary server to the primary server first.

When you run the datamerge.exe utility with specific start and end times, the ptnr_timestamp.log files on the secondary and primary servers are not used.

More information

Primary server failure.