Extract transaction from WAL

Started by Jill Jadeover 6 years ago4 messagesgeneral
Jump to latest
#1Jill Jade
jill779ks@gmail.com

Hello everyone,

I am new to Postgres and I have a query.

I have updated a table which I should not have.

Is there a way to extract the transactions from the WAL and get back the
previous data?

Is there a tool that can help to get back the transactions?

Thanks in advance.

Regards,
Jill

#2Michael Loftis
mloftis@wgops.com
In reply to: Jill Jade (#1)
Re: Extract transaction from WAL

On Thu, Nov 21, 2019 at 04:56 Jill Jade <jill779ks@gmail.com> wrote:

Hello everyone,

I am new to Postgres and I have a query.

I have updated a table which I should not have.

Is there a way to extract the transactions from the WAL and get back the
previous data?

Is there a tool that can help to get back the transactions?

The normal way is to use a backup along with point in time recovery. But
this requires you’ve setup backups and are archiving WALs F/ex with
pgbackrest. You restore the last full backup from before the incident and
play back to a time stamp or transaction ID. Either to the original server
or elsewhere...in this case I would probably restore elsewhere and extract
the data I needed using tools like pg_dump to restore the selected data.

I’m personally unaware of other methods which may exist.

Thanks in advance.

Regards,
Jill

--

"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler

#3Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Jill Jade (#1)
Re: Extract transaction from WAL

On Thu, 2019-11-21 at 12:11 +0400, Jill Jade wrote:

I am new to Postgres and I have a query.

I have updated a table which I should not have.

Is there a way to extract the transactions from the WAL and get back the previous data?

Is there a tool that can help to get back the transactions?

This information is not contained in the WAL.

You'll have to restore a backup.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

#4Marc Millas
marc.millas@mokadb.com
In reply to: Michael Loftis (#2)
Re: Extract transaction from WAL

Hi,
funny enough, this pb looks similar to mine.
the point is: how to guess: what is the "data I need" ??

Looks like we are looking for a way to ask postgres: which transactions
have occurred between this and that.
Obviously, if we can have, online, both the db after the PITR and the db
"corrupted" we can try to create a dblink from one to the other and, then
try to extract the "differences".

but this is not always possible. hence the question about wals.
or ?

regards,

Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

On Thu, Nov 21, 2019 at 3:24 PM Michael Loftis <mloftis@wgops.com> wrote:

Show quoted text

On Thu, Nov 21, 2019 at 04:56 Jill Jade <jill779ks@gmail.com> wrote:

Hello everyone,

I am new to Postgres and I have a query.

I have updated a table which I should not have.

Is there a way to extract the transactions from the WAL and get back the
previous data?

Is there a tool that can help to get back the transactions?

The normal way is to use a backup along with point in time recovery. But
this requires you’ve setup backups and are archiving WALs F/ex with
pgbackrest. You restore the last full backup from before the incident and
play back to a time stamp or transaction ID. Either to the original server
or elsewhere...in this case I would probably restore elsewhere and extract
the data I needed using tools like pg_dump to restore the selected data.

I’m personally unaware of other methods which may exist.

Thanks in advance.

Regards,
Jill

--

"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler