简体   繁体   中英

Issue running Postgresql 9.6 backup (pg_dump/pg_dumpall)

I have a postgreSQL 9.6 installation on Ubuntu 16.04, provided by the EnterpriseDB. I've been connecting to the local server and using it for a number of months. I figured I should backup the server at this point, so I tried using the pg_dump command as follows:

  1. cd to postgres bin at /opt/PostgreSQL/9.6/bin
  2. Run pg_dump via sudo pg_dumpall > /sata_ssd2/pgdump/0419.bkp

This gives an error: Error: You must install at least one postgresql-client-<version> package. I tried installing via: sudo apt-get install postgresql-client-9.6 but that package does not seem to exist.

I also tried to run pg_dump and pg_dumpall via pgAdmin4. It first made me fill in the binary paths for EDB Advanced Server Binary Path and PostgreSQL Binary Path; I put in opt/PostgreSQL/9.6/bin/ , which is where the pg_dump executable is. When I tried to run the backups, I got the error: 'ascii' codec can't decode byte 0xe1 in position 1: ordinal not in range(128) . I found an answer to this elsewhere that recommended changing from client_encoding = SQLascii to client_encoding = utf8 in postgresql.conf, but this did not help.

Does anyone have any advice on where to go from here?

In a unix/linux system the current directory . is not on the PATH and not searched for binaries.

If you want to run the command pg_basebackup in /opt/PostgreSQL/9.6/bin/ , you run /opt/PostgreSQL/9.6/bin/pg_basebackup .

If you did want to run the command pg_basebackup that you knew was in the current directory you could write ./pg_basebackup instead. But just using the full path rather than cd ing unnecessarily is better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM