Re: pg_restore and the -C flag

Поиск
Список
Период
Сортировка
От John Scalia
Тема Re: pg_restore and the -C flag
Дата
Msg-id E0AF71C5-DF4C-4E68-BE49-EFCC837DA7A6@gmail.com
обсуждение исходный текст
Ответ на Re: pg_restore and the -C flag  (Keith <keith@keithf4.com>)
Список pgsql-admin
Thanks, Keith. I reread the documentation, and I guess that earlier, I wasn’t awake enough to comprehend it. It’s all working now.

Sent from my iPhone

On Jul 17, 2019, at 9:19 AM, Keith <keith@keithf4.com> wrote:



On Wed, Jul 17, 2019 at 8:43 AM John Scalia <jayknowsunix@gmail.com> wrote:
Hi all,

From what I’m reading on www.postgresql.org, the -C option for pg_restore is supposed to create the database before restoring into it, but here’s my command line:

pg_restore -p 5432 -C -d restored_db recovery.dmp

The dmp file was created with pg_dump using

pg_dump -p 5432 -F c orig_db > recovery.dmp.

Pg_restore errors saying the database does not exist. Yes, I know that port 5432 is the default, but not all of our databases are.  So, do I have any options wrong with either utility? Or why is this happening? I’m just trying to document a recovery procedure and testing my documentation.

Jay

Sent from my iPhone


I suspect the name your feeding to -d is the one you're trying to create? You still have to tell pg_restore to connect to a database that actually exists so it can log in to create one. So try passing "postgres" to the -d option. Or connect as you usually do with psql and run \l to see what databases already exist and connect to one of those.

Keith

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

Предыдущее
От: Keith
Дата:
Сообщение: Re: pg_restore and the -C flag
Следующее
От: "Srikar Vankadaru"
Дата:
Сообщение: Performance tuning/Response times in Postgres 11.2