Using the PostgreSQL psql Utility to Load Initial-State Data

#### Search Results

Search

# Using the PostgreSQL psql Utility to Load Initial-State Data

You can use the PostgreSQL psql utility to process and load initial-state data into a PostgreSQL database.

Note
The PostgreSQL psql utility can only be used with the Event Replicator Target Adapter to load initial-state data; it cannot be used for transactional data.

This document covers the following topics:

- Prerequisites

- Enabling PostgreSQL SQL Initial-State Processing using psql

- Processing Output

## Prerequisites

The following prerequisite must be met before the PostgreSQL psql utility can be used to load initial-state data to a PostgreSQL database, via the Event Replicator Target Adapter.

- The PostgreSQL utility "psql" (psql.exe on Windows, psql on Linux) must be installed on the same machine as the Event Replicator Target Adapter.

## Enabling PostgreSQL SQL Initial-State Processing using psql

To enable PostgreSQL initial-state processing using psql:

1. Using the Administration tool, configure a target definition for your PostgreSQL database. For more information, read Configuring Target Definitions for Event Replicator Target Adapter.

2. Using the Administration tool, create a specific target processing option definition for your PostgreSQL database. For this definition you must:

   - Select the Use Loader check box (check it).

   - Provide a value for the Path field, identifying the full path of the PostgreSQL psql executable.

   - Save the target processing option definition with the same name as the target definition you created in Step 1.

     For more information about these options, read Specifying Target Database Processing Option Definitions.

   - When all processing options are specified, start initial-state processing, directing the output to the Event Replicator Target Adapter Adapter via a GFFT you created (using the Data Mapping Tool or the Adabas Event Replicator Subsystem) for the PostgreSQL database.

     For more information on this, read Requesting Initial-State Data.

     The Event Replicator Target Adapter will collect the initial-state records and send them to the psql utiltiy to be loaded to your PostgreSQL database.

## Processing Output

The output from this processing includes:

- Output files containing the output from the psql utility.

- psql utility log files.

- Data files containing the initial-state data received by the Event Replicator Target Adapter prior to being processed by the PostgreSQL psql utility.

All output files are written to the \logs subdirectory of your Event Replicator Target Adapter installation

This section covers the following topics:

- Log Files

- Processing Files

### Log Files

The PostgreSQL psql log files are stored in files that have names in the format xxxx_yymmdd_hhmmss.log, where xxxx is the table name, yymmdd is the date of the log file, and hhmmss is the time the log file was last written to. A similarly names file with the extention .out contain the actual output of the psql utility.

In the event of errors received during processing of initial-state data using the psql utility, please examine these files for hints as to the cause of the error.

### Processing Files

A single processing file for each table with the extension .sql is created by the Event Replicator Target Adapter to feed into the psql utiltiy. This files can take a good deal of space, so make sure that there is enough space to accommodate it and be sure to manually delete it when initial-state processing has completed successfully. This file contains not only the data loaded into the table(s), but also the actual psql commands passed to the utility.

The format of the processing file name is xxxx_yymmdd_hhmmss.sql, where xxxx is the table name, yymmdd is the date of the file, and hhmmss is the time the sql data file was last written to.

### On this page

- Prerequisites
- Enabling PostgreSQL SQL Initial-State Processing using psql
- Processing Output