简体   繁体   中英

How to restore PostgreSQL database from dump file

I am trying to restore the backup file to PostgreSQL DB by;

pg_restore -d db_name -U user_name -C backup.dmp

However, I get this error when I executed this command.

pg_restore: [archiver] unsupported version (1.14) in file header

The version of the PostgreSQL DB I'm using is 11.6 (Ubuntu 11.6-1.pgdg18.04+1)

I assumed I need to upgrade PostgreSQL DB so I tried this command on the server.

brew upgrade postgresql

However, I get this error this time..

Error: postgresql not installed

I would appreciate any help or advice. Thank you very much.

It sounds like you are trying to work with a dump file that was created on a Mac, and you are trying to restore it on another machine (or the other way around?). brew is a Mac package manager. The equivalent for Ubuntu is apt . To install Postgres on Ubuntu, please follow the steps on the Ubuntu page of the PostgreSQL website . To upgrade, you should be able to do apt-get upgrade .

You may also not be able to brew upgrade postgresql on your Mac because Postgres may have been installed in another way (you may want to use Spotlight to find out whether your pg_dump lives in some .../Cellar/... folder or a .../Postgres.app/... folder (or some other folder), and perform your upgrade accordingly.

In either case, it seems you are encountering this archiver error message because of a missing security patch

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