pgsql: pgdump authentication

 

create  .pg_pass file on the root folder of the user that will run the pgsql command for example. /root or /user

 

touch /root/.pgpass

 

chmod 600 .pgpass

 

add the credentialas user and password that will be user on postgres

for example:

localhost:5432:sap_db:user:pass

*:*:*:user:pass

 

The format of the command is:

pg_dump -h 127.0.0.1 -U $USER -Fc $DATABASE > /home/scripts/idempiere.sql

 

another backup format is:

pg_dump -h 127.0.0.1 -U [user] -Fc -f [source_db].pgdump -d [database]

 

to restore

pg_restore -U [database]-d [target_database]  [source_db].pgdump

Leave a Reply

Your email address will not be published. Required fields are marked *