Pgadmin 4 ошибка при восстановлении

I am using pgAdmin 4 and am trying to restore a .sql file which is a plain backup of the database created with pgAdmin 4. While trying to restore to the relevant database, it gives the following error:

error_image

What’s going wrong?

Thanks!

asked Jul 6, 2020 at 11:10

Arun's user avatar

1

I was able to solve it by using the command:

psql -U username -d database_name -f objects.sql

answered Jul 6, 2020 at 15:09

Arun's user avatar

ArunArun

2,1265 gold badges42 silver badges76 bronze badges

You cannot restore a text format dump with pgAdmin. You have to use psql for it.

Use a custom format dump if you want to restore with pgAdmin.

answered Jul 6, 2020 at 11:12

Laurenz Albe's user avatar

Laurenz AlbeLaurenz Albe

204k17 gold badges195 silver badges250 bronze badges

This solution only works for Windows.

If you want to restore a database in pgadmin but the «restore» option in the UI is not working at all, try using the psql shell instead. First, ensure you have already added the postgres bin folder to the «Path» environment variable (in my case this folder is C:Program FilesPostgreSQL12bin).

Then, open the Windows command interpreter (cmd), go to the folder where you have the .sql file and execute this command:

pg_restore -U userName -d database-1 backupfile.sql

For example:

pg_restore -U sam -d SamDataBase -1 SamDataBaseBackup.sql

(It can ask you for the password of the user so ensure to type it correctly and then click enter)

a_horse_with_no_name's user avatar

answered Jun 14, 2021 at 6:16

Johnny Chacon's user avatar

This solution only works for Windows.

If you want to restore a database in pgadmin but the «restore» option in the UI is not working at all, try using the psql shell instead. First, ensure you have already added the postgres bin folder to the «Path» environment variable (in my case this folder is C:Program FilesPostgreSQL12bin).

Then, open the Windows command interpreter (cmd), go to the folder where you have the .sql file and execute this command:

psql -U postgres dbname < file_restore.sql

answered Jun 13 at 16:27

ChillMouse's user avatar

Asked
2 years, 1 month ago

Viewed
32k times

I am new to PostgreSQL. I installed the software. Almost everything works. Then I tried to follow a tutorial for dvdrental. All instructions for using from command line worked. Then there is instruction for creating a DB using pgAmdin 4, which also worked. The next instruction is to do a restore. This fails. The error message is ‘C:Program FilesPostgreSQL13pgAdmin 4runtimepg_restore.exe’ file not found. Please correct the Binary Path in the Preferences dialog.
The message is correct. pg_restore.exe is not in the runtime folder, the runtime folder does not exist. There is a bin folder and pg_restore.exe is that direction.
I tried various things such as changing «EDB Advanced Server Binary Path», I also created folder runtime and copied everything that was in bin folder to runtime, but it still will not work. This looks like an installation problem. Same message seemed to have appeared for years, but none of those solutions have worked for me. I would appreciate any help.

asked May 14, 2021 at 2:50

M. Saleem Yusuf's user avatar

Yes, the pg_restore.exe is in this location — C:Program FilesPostgreSQL13bin.
Go to File-> Preferences-> Paths->Binary paths

Change PostgreSQL Binary Path to «C:Program FilesPostgreSQL13bin»

enter image description here

rjose's user avatar

answered Jun 7, 2021 at 9:39

gokul ebstein's user avatar

1

I was able to fix (or patch) the problem by coping files.

  1. Searched for pg_restore.exe from folder ‘C:Program FilesPostgreSQL13’. I found the file in ‘C:Program FilesPostgreSQL13bin’.
  2. Then I copied all the files from ‘C:Program FilesPostgreSQL13bin’ folder to ‘C:Program FilesPostgreSQL13pgAdmin 4runtime’ where the error message says file is missing. Note: After install, there was no runtime folder. I had to create it.
    The error went away and restore seems to work. I am not sure this is the right solution, but for now, it works.

answered May 14, 2021 at 5:42

M. Saleem Yusuf's user avatar

  1. Goto: C:Program FilesPostgreSQL13pgAdmin 4web

  2. Open config_distro file

  3. Change default binary path for of pg to bin of PostgreSQL server’s bin folder

    Orignal:

 DEFAULT_BINARY_PATHS = { 
   'pg':   '$DIR/../runtime', 
   'ppas': '' 
} 

To

DEFAULT_BINARY_PATHS = { 
   'pg':   '$DIR/../../bin', 
   'ppas': '' 
} 

tinlyx's user avatar

tinlyx

3,1979 gold badges39 silver badges63 bronze badges

answered Jul 12, 2021 at 9:52

dhaval thumar's user avatar

1

Утилита pg_restore предназначена для восстановления базы данных Postgres Pro из архива, созданного командой pg_dump в любом из не текстовых форматов

https://postgrespro.ru/docs/postgrespro/10/app-pgr…

У вас дамп в SQL (текстовый формат).
Нет под рукой pgAdmin4 (да покарает Аллах его создателя), но там где-то должна быть кнопка типа «запустить SQL скрипт», либо «открыть SQL консоль» — оттуда надо восстанавливать.
Ну или запустите консоль и в ней команду, которую пишет pgAdmin с заменой pg_restore.exe на psql.exe, и перед путем к файлу поставьте <. Примерно:

C:Program Files...psql.exe --host ... --dbname "demo" < "C:\Users\...\....SQL"

Не плохо бы разобраться с кодировкой, что бы понять что ему не так.
У пользователя postgres нет пароля?
Попробуйте сначала создать пустую базу demo, а потом восстановить в нее данные из скачанного дампа.

i am using pgAdmin 4, and i need to restore database and get this error :
I let the number of job is empty and role name is ‘postgres’

pg_restore: connecting to database for restore
pg_restore: creating SCHEMA "public"
pg_restore: creating COMMENT "SCHEMA public"
pg_restore: creating SCHEMA "tiger"
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 8; 2615 18151 SCHEMA tiger postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  schema "tiger" already exists
    Command was: CREATE SCHEMA tiger;



pg_restore: creating EXTENSION "fuzzystrmatch"
pg_restore: creating COMMENT "EXTENSION fuzzystrmatch"
pg_restore: creating EXTENSION "postgis"
pg_restore: creating COMMENT "EXTENSION postgis"
pg_restore: creating EXTENSION "postgis_tiger_geocoder"
pg_restore: creating COMMENT "EXTENSION postgis_tiger_geocoder"
pg_restore: creating SCHEMA "topology"
pg_restore: [archiver (db)] Error from TOC entry 7; 2615 17881 SCHEMA topology postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  schema "topology" already exists
    Command was: CREATE SCHEMA topology;

Here,I got no error, but in the last line, the error is appear

pg_restore: creating EXTENSION "plpgsql"
pg_restore: creating COMMENT "EXTENSION plpgsql"
pg_restore: creating EXTENSION "address_standardizer"
pg_restore: creating COMMENT "EXTENSION address_standardizer"
pg_restore: creating EXTENSION "ogr_fdw"
pg_restore: creating COMMENT "EXTENSION ogr_fdw"
pg_restore: creating EXTENSION "pgrouting"
pg_restore: creating COMMENT "EXTENSION pgrouting"
pg_restore: creating EXTENSION "pointcloud"
pg_restore: creating COMMENT "EXTENSION pointcloud"
pg_restore: creating EXTENSION "pointcloud_postgis"
pg_restore: creating COMMENT "EXTENSION pointcloud_postgis"
pg_restore: creating EXTENSION "postgis_sfcgal"
pg_restore: creating COMMENT "EXTENSION postgis_sfcgal"
pg_restore: creating EXTENSION "postgis_topology"
pg_restore: creating COMMENT "EXTENSION postgis_topology"
pg_restore: creating TABLE "public.angkot"
pg_restore: creating TABLE "public.det_fasilitas"
pg_restore: creating TABLE "public.det_kegiatan"
pg_restore: creating TABLE "public.det_khatib"
pg_restore: creating TABLE "public.detail_angkot"
pg_restore: creating TABLE "public.fasilitas"
pg_restore: creating TABLE "public.hotel_region"
pg_restore: creating SEQUENCE "public.hotel_region_gid_seq"
pg_restore: creating SEQUENCE OWNED BY "public.hotel_region_gid_seq"
pg_restore: creating SEQUENCE "public.id_keg_seq"
pg_restore: creating TABLE "public.industri_kecil"
pg_restore: creating TABLE "public.jenis_kegiatan"
pg_restore: creating TABLE "public.kategori"
pg_restore: creating TABLE "public.kategori_rm"
pg_restore: creating TABLE "public.kecamatan"
pg_restore: creating TABLE "public.kegiatan"
pg_restore: creating TABLE "public.kondisi_fasilitas"
pg_restore: creating TABLE "public.rm"
pg_restore: creating SEQUENCE "public.kuliner_region_gid_seq"
pg_restore: creating SEQUENCE OWNED BY "public.kuliner_region_gid_seq"
pg_restore: creating TABLE "public.login"
pg_restore: creating SEQUENCE "public.masjid_sq"
pg_restore: creating TABLE "public.mesjid"
pg_restore: creating TABLE "public.objek_wisata"
pg_restore: creating TABLE "public.ustad"
pg_restore: creating DEFAULT "public.gid"
pg_restore: creating DEFAULT "public.gid"
pg_restore: processing data for table "public.angkot"
pg_restore: processing data for table "public.det_fasilitas"
pg_restore: processing data for table "public.det_kegiatan"
pg_restore: processing data for table "public.det_khatib"
pg_restore: processing data for table "public.detail_angkot"
pg_restore: processing data for table "public.fasilitas"
pg_restore: processing data for table "public.hotel_region"
pg_restore: executing SEQUENCE SET hotel_region_gid_seq
pg_restore: executing SEQUENCE SET id_keg_seq

Well, still running wel

pg_restore: processing data for table "public.industri_kecil"
pg_restore: processing data for table "public.jenis_kegiatan"
pg_restore: processing data for table "public.kategori"
pg_restore: processing data for table "public.kategori_rm"
pg_restore: processing data for table "public.kecamatan"
pg_restore: processing data for table "public.kegiatan"
pg_restore: processing data for table "public.kondisi_fasilitas"
pg_restore: executing SEQUENCE SET kuliner_region_gid_seq
pg_restore: processing data for table "public.login"
pg_restore: executing SEQUENCE SET masjid_sq
pg_restore: processing data for table "public.mesjid"
pg_restore: processing data for table "public.objek_wisata"
pg_restore: processing data for table "public.pointcloud_formats"
pg_restore: processing data for table "public.rm"
pg_restore: processing data for table "public.spatial_ref_sys"
pg_restore: processing data for table "public.ustad"
pg_restore: processing data for table "tiger.geocode_settings"
pg_restore: processing data for table "tiger.pagc_gaz"
pg_restore: processing data for table "tiger.pagc_lex"
pg_restore: processing data for table "tiger.pagc_rules"
pg_restore: processing data for table "topology.topology"
pg_restore: processing data for table "topology.layer"
pg_restore: creating CONSTRAINT "public.det_kegiatan_pkey"
pg_restore: creating CONSTRAINT "public.hotel_region_pkey"
pg_restore: creating CONSTRAINT "public.id"
pg_restore: creating CONSTRAINT "public.id_angkot"
pg_restore: creating CONSTRAINT "public.id_detail_angkot"
pg_restore: creating CONSTRAINT "public.id_fasilitas"
pg_restore: creating CONSTRAINT "public.id_jenis_keg"
pg_restore: creating CONSTRAINT "public.id_kategori"
pg_restore: creating CONSTRAINT "public.id_keg"
pg_restore: creating CONSTRAINT "public.id_khatib"
pg_restore: creating CONSTRAINT "public.id_kondisi"
pg_restore: creating CONSTRAINT "public.id_masjid"
pg_restore: creating CONSTRAINT "public.industri_kecil_region_pkey"
pg_restore: creating CONSTRAINT "public.kecamatan_pkey"
pg_restore: creating CONSTRAINT "public.kuliner_region_pkey"
pg_restore: creating CONSTRAINT "public.objek_wisata_pk"
pg_restore: creating CONSTRAINT "public.tgl_khatib"
pg_restore: creating CONSTRAINT "public.username"
pg_restore: creating INDEX "public.hotel_region_geom_idx"
pg_restore: creating INDEX "public.industri_kecil_region_geom_idx"
pg_restore: creating INDEX "public.kecamatan_region_geom_gist"
pg_restore: creating INDEX "public.kuliner_region_geom_idx"
pg_restore: creating INDEX "public.mesjid_region_geom_idx"
pg_restore: creating FK CONSTRAINT "public.angkot_id"
pg_restore: creating FK CONSTRAINT "public.id"
pg_restore: creating FK CONSTRAINT "public.id_fasilitas"
pg_restore: creating FK CONSTRAINT "public.id_jenis_kegiatan"
pg_restore: creating FK CONSTRAINT "public.id_kat"
pg_restore: creating FK CONSTRAINT "public.id_kategori"
pg_restore: creating FK CONSTRAINT "public.id_keg"
pg_restore: creating FK CONSTRAINT "public.id_khatib"
pg_restore: creating FK CONSTRAINT "public.id_kondisi"
pg_restore: creating FK CONSTRAINT "public.id_masjid"
pg_restore: creating FK CONSTRAINT "public.id_masjid"
pg_restore: creating FK CONSTRAINT "public.id_masjid"
pg_restore: creating FK CONSTRAINT "public.id_ustad"
pg_restore: creating FK CONSTRAINT "public.username"
pg_restore: creating ACL "public"

Here is the error

WARNING: errors ignored on restore: 2

The status is Failed with exit code is 1
How to solve that ?
Thanks

Ошибка при восстановлении БД

20.05.2018, 15:29. Показов 27099. Ответов 1

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

Добрый день, у меня такая проблема скинули бэкап бд, пытаюсь ее восстановить у себя через PgAdmin4.2 создал пустую Бд, при восстановлении в нее файла выдает ошибку «Failed (exit code: 1).»

В подробностях к ней такой комм «pg_restore: [archiver] unsupported version (1.13) in file header» .

У меня стоит версия postgres 10.1.

Как можно исправить ошибку ?



0



  • Pg datatypemismatch ошибка столбец нельзя автоматически привести к типу integer
  • Peugeot partner ошибка p0008
  • Peugeot partner ошибка abs
  • Peugeot partner tepee коды ошибок
  • Peugeot boxer ошибка p2291