Skip to main content
3 of 3
Improve language, formatting, typos and add tags.

PostgreSQL Scheduled Database Backup

For scheduling a daily back up on a postgres database we execute the following command:

0 2 * * * /usr/local/pgsql/bin/pg_dump -Fp -b -U database_name \
          > $HOME/db_backups/database_name-`date +\%Y\%m\%d`.sql \
          2>> $HOME/db_backups/cron.log

After the code executes, the log says "invalid password". Is there a way to specify a password or avoid the requirement when creating a dump?

Also we would like to retrieve the dump and pop it on separate Windows server using pgadmin3. When restoring using pgadmin dbase -> database restore the 'OK' button is disabled and we are unable to restore the database.

AKV
  • 41
  • 1
  • 2