From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | byrnejb(at)harte-lyne(dot)ca |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: overwrote THE 'postgres' database - how to recover |
Date: | 2019-09-04 19:52:13 |
Message-ID: | CAECtzeU6K-CH9D+8Pjo5W4EhcYMJeGqTjZTMegDY283=pHfGEw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Le mer. 4 sept. 2019 à 18:51, James B. Byrne <byrnejb(at)harte-lyne(dot)ca> a
écrit :
> I was experimenting with creating a copy of an existing database from
> a pg_dump sql backup file. I made an misake in failing to delimit an
> environment variable and in consequence I issued this command as user
> postgres:
>
> I should have used:
>
> gunzip < "$APP_DBNAME".pgsql.gz | pg_restore --create --clean
> --user=postgres --dbname="$APP_DBNAME"_copy && vacuumdb
> --user=postgres --full --analyze "$APP_DBNAME"_copy
>
> But, instead I did this:
>
> gunzip < $APP_DBNAME.pgsql.gz | pg_restore --create --clean
> --user=postgres --dbname=$APP_DBNAME_copy && vacuumdb
> --user=postgres --full --analyze $APP_DBNAME_copy
>
> which resulted in this:
>
> 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.
--
Guillaume.
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Steben | 2019-09-04 20:15:04 | Version 11 partitioning: Constraint exclusion vs Partition Pruning |
Previous Message | James B. Byrne | 2019-09-04 16:51:04 | overwrote THE 'postgres' database - how to recover |