How to Automatically Back-up the PostgreSQL Database

To automatically backup the PassagePoint PostgreSQL database, create a Windows task with the changes below to invoke the PostgreSQL agent to back up the database.

Create a batch file with the line below, and add it to your Window task:

pg_dump -i -h localhost -U postgres -F c -b -v -f "c:\sotest.backup" amber3

postgres is the user name
sotest.backup = file name
amber3 = database name

Be sure to edit your pg_hba.conf file located in c:\postgres\data, in order for this to work correctly, because running the command above will ask you for a password.

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 md5

Change to:

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
#host all all ::1/128 md5