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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 4, 2019 at 9:52 PM Guillaume Lelarge <guillaume@xxxxxxxxxxxx> 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





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux