Ask Your Question
1

How can I overcome the "command not found" error message when I attempt to upgrade postgresql from version 9.4 to version 12 using pg_upgrade?

asked 2023-06-30 22:36:49 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-30 22:55:01 +0000

woof gravatar image

Here are some steps you can take to troubleshoot the "command not found" error when attempting to upgrade PostgreSQL using pg_upgrade:

  1. Check the location of the pgupgrade binary: The pgupgrade binary should be located in the PostgreSQL bin directory. If it's not, you can add the directory to your PATH variable or use the full path to the binary when running the command.

  2. Check that PostgreSQL 12 is installed: Make sure that you have installed PostgreSQL 12 on your system. You can check this by running the command "psql --version". If PostgreSQL 12 is not installed, you can download it from the official PostgreSQL website and install it.

  3. Check the syntax of the pgupgrade command: Make sure you are using the correct syntax for the pgupgrade command. The command should be of the form:

pgupgrade -b [OLDBINDIR] -B [NEWBINDIR] -d [OLDDATADIR] -D [NEWDATADIR] -o "[OLDOPTIONS]" -O "[NEW_OPTIONS]"

Where [OLDBINDIR] and [NEWBINDIR] are the paths to the bin directories of the old and new PostgreSQL versions, respectively, [OLDDATADIR] and [NEWDATADIR] are the paths to the data directories of the old and new PostgreSQL versions, respectively, and [OLDOPTIONS] and [NEWOPTIONS] are any additional command-line options you want to pass to the old and new PostgreSQL versions, respectively.

  1. Check file permissions: Ensure that you have permission to read and write to the PostgreSQL data directory. The user running the pg_upgrade command should have permission to write to the new data directory.

  2. Check for PostgreSQL running processes: Ensure there are no running PostgreSQL processes or services. You should stop any running PostgreSQL processes before running the pg_upgrade command.

  3. Check for conflicting installations: If you have multiple installations of PostgreSQL on your system, make sure you are using the correct binaries and data directories for the version you want to upgrade.

  4. Check for other errors or warnings: Review the output of the pg_upgrade command carefully for any other errors or warnings. Address any issues before attempting the upgrade again.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-30 22:36:49 +0000

Seen: 21 times

Last updated: Jun 30 '23