Thread: make abackup using CMD

make abackup using CMD

From
"Ahmed Mohammed Darwish"
Date:
<div class="Section1"><p class="MsoNormal">Dears,<p class="MsoNormal"> <p class="MsoNormal">I need a help for the
followingcase:<p class="MsoNormal"> <p class="MsoNormal">I want to make auto backup for the database using Dos Command
line, I made the following CMD line <p class="MsoNormal"> <p class="MsoNormal">pg-dumpall -h localhost -Upostgres >
allinone.bak<pclass="MsoNormal"> <p class="MsoNormal">but I found every time I have to enter password. So , how can I
includethe password parameter in the above statement so that I can schedule this patch to take a backup 4 times daily
withoutentering the password every time.<p class="MsoNormal"> <p class="MsoNormal">Thank you in advance for your
support.<pclass="MsoNormal"> <p class="MsoNormal"> </div><p>This electronic communication is intended by the sender
onlyfor the access and use by the addressee and may contain confidential information. It is your responsibility to
ensurethis e-mail and any attachments are virus free. If you have received it by mistake please notify the sender by
returne-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole
orin part is strictly prohibited. National Air Services (NAS Holding) is a Closed Joint Stock Company, organized under
thelaws of the Kingdom of Saudi Arabia, having its mailing address as P.O. Box 305161 Riyadh 11361 KSA  

Re: make abackup using CMD

From
Raymond O'Donnell
Date:
On 09/02/2013 16:13, Ahmed Mohammed Darwish wrote:
> Dears,
> 
> I need a help for the following case:
> 
> I want to make auto backup for the database using Dos Command line , I
> made the following CMD line
> 
> pg-dumpall -h localhost -Upostgres > allinone.bak
> 
> but I found every time I have to enter password. So , how can I include
> the password parameter in the above statement so that I can schedule
> this patch to take a backup 4 times daily without entering the password
> every time.

You can't include the password on the command line; you can instead use
an environment variable[1] or a .pgpass file[2].

HTH,

Ray.

[1] http://www.postgresql.org/docs/9.2/static/libpq-envars.html
[2] http://www.postgresql.org/docs/9.2/static/libpq-pgpass.html


-- 
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie



Re: make abackup using CMD

From
"David Blaymires"
Date:
Use a .pgpass file. Specifically, you are nominating Postgres as the user so there needs to be a .pgpass file in the Postgres user's home folder.  So on more recent versions, in /Users/postgres/AppData/Roaming/Postgres/. Note: the databases in the pgpass file must be set to * otherwise you won't have the rights to back up all the databases. 

If you are doing this o n a regular basis, or want this to happen automatically each day then you should look at pgAgent and set up jobs in that.  It works very well.

Regards
David Blaymires 

Sent from my iPad

On 10/02/2013, at 3:25 AM, "Ahmed Mohammed Darwish" <ADarwish@nasaviation.com> wrote:

Dears,

 

I need a help for the following case:

 

I want to make auto backup for the database using Dos Command line , I made the following CMD line

 

pg-dumpall -h localhost -Upostgres > allinone.bak

 

but I found every time I have to enter password. So , how can I include the password parameter in the above statement so that I can schedule this patch to take a backup 4 times daily without entering the password every time.

 

Thank you in advance for your support.

 

 

This electronic communication is intended by the sender only for the access and use by the addressee and may contain confidential information. It is your responsibility to ensure this e-mail and any attachments are virus free. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. National Air Services (NAS Holding) is a Closed Joint Stock Company, organized under the laws of the Kingdom of Saudi Arabia, having its mailing address as P.O. Box 305161 Riyadh 11361 KSA

Re: make abackup using CMD

From
"Ahmed Mohammed Darwish"
Date:

Thank you David for your support ,

 

How to setup jops in PGagent? as I am new user with Postgres.

 

 

 

From: David Blaymires [mailto:david.blaymires@instinctsystems.com.au]
Sent: Sunday, February 10, 2013 7:43 AM
To: Ahmed Mohammed Darwish
Cc: pgadmin-support@postgresql.org
Subject: Re: [pgadmin-support] make abackup using CMD

 

Use a .pgpass file. Specifically, you are nominating Postgres as the user so there needs to be a .pgpass file in the Postgres user's home folder.  So on more recent versions, in /Users/postgres/AppData/Roaming/Postgres/. Note: the databases in the pgpass file must be set to * otherwise you won't have the rights to back up all the databases. 

 

If you are doing this o n a regular basis, or want this to happen automatically each day then you should look at pgAgent and set up jobs in that.  It works very well.

 

Regards

David Blaymires 

Sent from my iPad


On 10/02/2013, at 3:25 AM, "Ahmed Mohammed Darwish" <ADarwish@nasaviation.com> wrote:

Dears,

 

I need a help for the following case:

 

I want to make auto backup for the database using Dos Command line , I made the following CMD line

 

pg-dumpall -h localhost -Upostgres > allinone.bak

 

but I found every time I have to enter password. So , how can I include the password parameter in the above statement so that I can schedule this patch to take a backup 4 times daily without entering the password every time.

 

Thank you in advance for your support.

 

 

This electronic communication is intended by the sender only for the access and use by the addressee and may contain confidential information. It is your responsibility to ensure this e-mail and any attachments are virus free. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. National Air Services (NAS Holding) is a Closed Joint Stock Company, organized under the laws of the Kingdom of Saudi Arabia, having its mailing address as P.O. Box 305161 Riyadh 11361 KSA

This electronic communication is intended by the sender only for the access and use by the addressee and may contain confidential information. It is your responsibility to ensure this e-mail and any attachments are virus free. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. National Air Services (NAS Holding) is a Closed Joint Stock Company, organized under the laws of the Kingdom of Saudi Arabia, having its mailing address as P.O. Box 305161 Riyadh 11361 KSA