From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul Libbrecht <paul@activemath.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: accidental drop table recoverable?
Date: Mon, 14 Jul 2008 10:47:27 -0400
Message-ID: <8259.1216046847@sss.pgh.pa.us> (raw)
In-Reply-To: <53CDF98F-0AE1-49ED-A2A3-C3B1E2AF2E2E@activemath.org>
References: <53CDF98F-0AE1-49ED-A2A3-C3B1E2AF2E2E@activemath.org>
Paul Libbrecht <paul@activemath.org> writes:
> right now we experienced the loss of backups (due to wrong
> communication) and a list of accidental drop table statements (due to
> wrong database choice).
Ouch.
> We sure have clues how to avoid that in the future but right now we do
> not seem to find the solution to actually rollback this accidental
> drop table.
You can't really "rollback" a DROP TABLE --- that corresponds directly
to a filesystem remove() call, and no amount of fooling around with the
database state will undo that.
If you have filesystem tools that will resurrect the deleted files for
you, you could probably put them back into the database. My inclination
would be not to try to "roll back" anything, but create new tables with
the identical column sets to the old ones (but no indexes) and then
rename the recovered files into place to match the new tables'
relfilenode values. After which, a dump and reload would be prudent to
make sure everything's really kosher. (Actually, copying the data into
newly created tables should be enough for that.)
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, paul@activemath.org
Subject: Re: accidental drop table recoverable?
In-Reply-To: <8259.1216046847@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox