pg_restore

Поиск
Список
Период
Сортировка
От rammohan ganapavarapu
Тема pg_restore
Дата
Msg-id CALm_VjjLrrWiA92HainW3pdQLRMfBQ4qE2tnd-55A7WUorgyGw@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_restore  (Ron <ronljohnsonjr@gmail.com>)
Список pgsql-admin
Hi,

I have a custome database called mudb along with default databases in my postgresql cluster, i am trying to restore mydb from a custom format pg_dump file, what is the procedure to do it?

psql -t -h localhost  -U ${RUN_USER}  -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'mydb' AND pid <> pg_backend_pid();"

pg_restore" -h localhost  -U ${RUN_USER}  -d mydb -j "${JOBS}" -x -O -C -c --if-exist -v pgdump.dump 

But i am getting below error:

pg_restore: connecting to database for restore
pg_restore: dropping DATABASE mydb
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 4312; 1262 16384 DATABASE mydb mydb
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot drop the currently open database
    Command was: DROP DATABASE IF EXISTS mydb;

So what is the best way to restore? I am using 9.6 version.

Thanks,
Ram




В списке pgsql-admin по дате отправления:

Предыдущее
От: Prince Pathria
Дата:
Сообщение: Re: BDR OR MASTER SLAVE REPLICATION WITH REPMGR IS SUITABLE FOR LARGEONLINE APPLICATION
Следующее
От: Ron
Дата:
Сообщение: Re: pg_restore