Thread: Backup failed using pg_dump from command promt

Backup failed using pg_dump from command promt

From
JORGE MALDONADO
Date:
Hi,

I have a DB in a Windows Server 2008 R2 and I want to automate the backup process using a batch file with a script which should run based on a task in the Task Scheduler. The dump command is as follows:

pg_dump -E win1252 -f d:/backups/myBackup.backup -F p -n schemaName -h localhost -U postgres -w dbName

Also, I have included the password information in the pgpass.conf file located at c:\Users\UserName\AppData\Roaming\postgresql folder with the following format:

localhost:5432:dbName:userName:password

If I manually run the batch file that contains the script I get a message saying that "the connection to the database failed: fe_sendauth: no password supplied".

What am I missing?

With respect,
Jorge Maldonado

Re: Backup failed using pg_dump from command promt

From
Vince RIVES
Date:
Not sure if someone answered this question.

When using pgadminIII to run a backup, I  saw the following command:
C:/Program Files/PostgreSQL/9.4/bin\pg_dump.exe --host localhost --port 5432 --username "postgres" --no-password  --format custom --blobs --verbose --file "C:\testpostgresbk.backup" "postgres"

Hope this helps,
Vince


Date: Wed, 30 Sep 2015 10:38:04 -0500
Subject: [NOVICE] Backup failed using pg_dump from command promt
From: jorgemal1960@gmail.com
To: pgsql-novice@postgresql.org

Hi,

I have a DB in a Windows Server 2008 R2 and I want to automate the backup process using a batch file with a script which should run based on a task in the Task Scheduler. The dump command is as follows:

pg_dump -E win1252 -f d:/backups/myBackup.backup -F p -n schemaName -h localhost -U postgres -w dbName

Also, I have included the password information in the pgpass.conf file located at c:\Users\UserName\AppData\Roaming\postgresql folder with the following format:

localhost:5432:dbName:userName:password

If I manually run the batch file that contains the script I get a message saying that "the connection to the database failed: fe_sendauth: no password supplied".

What am I missing?

With respect,
Jorge Maldonado

Re: Backup failed using pg_dump from command promt

From
Ken Benson
Date:

Before your dump command - add this line:

 

SET PGPASSFILE="c:\Users\UserName\AppData\Roaming\postgresql\pgpass.conf"

 

 

 

Writes,

 

Ken Benson

 

From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Vince RIVES
Sent: Friday, October 02, 2015 6:29 PM
To: JORGE MALDONADO <jorgemal1960@gmail.com>; pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Backup failed using pg_dump from command promt

 

Not sure if someone answered this question.

 

When using pgadminIII to run a backup, I  saw the following command:

C:/Program Files/PostgreSQL/9.4/bin\pg_dump.exe --host localhost --port 5432 --username "postgres" --no-password  --format custom --blobs --verbose --file "C:\testpostgresbk.backup" "postgres"

 

Hope this helps,

Vince


Date: Wed, 30 Sep 2015 10:38:04 -0500
Subject: [NOVICE] Backup failed using pg_dump from command promt
From: jorgemal1960@gmail.com
To: pgsql-novice@postgresql.org

Hi,

 

I have a DB in a Windows Server 2008 R2 and I want to automate the backup process using a batch file with a script which should run based on a task in the Task Scheduler. The dump command is as follows:

 

pg_dump -E win1252 -f d:/backups/myBackup.backup -F p -n schemaName -h localhost -U postgres -w dbName

 

Also, I have included the password information in the pgpass.conf file located at c:\Users\UserName\AppData\Roaming\postgresql folder with the following format:

 

localhost:5432:dbName:userName:password

 

If I manually run the batch file that contains the script I get a message saying that "the connection to the database failed: fe_sendauth: no password supplied".

 

What am I missing?

 

With respect,

Jorge Maldonado