FTP Replicator PostgreSQL Operations

Backup

We backup each table to a separate dump file, using the command:-

Backup command
pg_dump.exe –Fc –table=<tablename> --username=postgres –file=<filename>

 

The unix parameter version is required as the windows parameters do not work through the interface for Python.

Restore

We restore using the command:-

Restore command
pg_restore.exe –dbname=<database> --exit-on-error –username=postgres <filename>

 

Only when all tables have been successfully restored do we then go through and remove the backups.

Database

Each table is restored into the same database name that it came from, and this is ‘remembered’ in the control file.