Re: overwrote THE 'postgres' database - how to recover

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема Re: overwrote THE 'postgres' database - how to recover
Дата
Msg-id CAKoxK+7w1gWuKu2X6ti83x32q4Yj85B6MLvtgJwXi4ocV8Ae7g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: overwrote THE 'postgres' database - how to recover  (Guillaume Lelarge <guillaume@lelarge.info>)
Список pgsql-admin
On Wed, Sep 4, 2019 at 9:52 PM Guillaume Lelarge <guillaume@lelarge.info> wrote:
>> gunzip < hll_redmine.pgsql.gz  |  pg_restore --create --clean
>> --user=postgres --dbname=  &&  vacuumdb --user=postgres --full
>> --analyze
>>
>> Which caused the postgres database to be overwritten with
>> hll_redmine.pgsql.gz.  Is there an easy way to get this back or do I
>> have to reinitialise the whole thing?
>>
>
> Well, you can connect to some database (but not postgres), drop the postgres one, and create it again.

I would connect to template1, alter database postgres rename to
<whatever> and then create a new postgres database.
It is interesting to see that pg_restore defaults to username database
even if there's a dbname command line option. I didn't know that (and
I'm not sure is something "cool").

Luca



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

Предыдущее
От: Mark Steben
Дата:
Сообщение: Version 11 partitioning: Constraint exclusion vs Partition Pruning
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Version 11 partitioning: Constraint exclusion vs PartitionPruning