public inbox for [email protected]
help / color / mirror / Atom feedReview my steps for rollback to restore point
2+ messages / 2 participants
[nested] [flat]
* Review my steps for rollback to restore point
@ 2025-03-04 08:56 chandan Kumar <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: chandan Kumar @ 2025-03-04 08:56 UTC (permalink / raw)
To: [email protected]
Hello,
I hope you are doing fine. I need your expertise on below case study.
My current production environment is 2 node streaming replication hosted on
Ubuntu VM 's on Azure. I have performed below steps on primary database.
1- Take Base backup
2- Create a restore point using pg_create_restore_point()
3- executed some DDL statement (CREATE VIEW,ADD INDEX,DROP INDEX)
4- Perform rollback using restore point
To rollback, you must stop PostgreSQL, restore the last full backup, and
apply WAL files until the restore point:
1. Stop PostgreSQL Service
2. Restore from Full Backup (Using pg_basebackup)
3. Modify recovery.conf (or postgresql.conf for newer versions)
o Set recovery target name:
recovery_target_name =
'before_ddl_changes'
recovery_target_action =
'pause'
o Set restore_command to replay WAL logs:
restore_command = 'cp
/path/to/wal_archive/%f %p'
4. Start PostgreSQL
sudo systemctl start postgresql
5. Verify Recovery Status
SELECT pg_is_in_recovery();
After verification, finalize recovery:
touch /var/lib/postgresql/data/recovery.signal
or
rm /var/lib/postgresql/data/recovery.conf
Then restart PostgreSQL.
6. Reestablish replication
Could you please help if my steps are correct ? Can we achieve rollback
from any other approach without restoring basebackup?
--
*With warm regards*
* Chandan*
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Review my steps for rollback to restore point
@ 2025-03-04 09:42 Laurenz Albe <[email protected]>
parent: chandan Kumar <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Laurenz Albe @ 2025-03-04 09:42 UTC (permalink / raw)
To: chandan Kumar <[email protected]>; [email protected]
On Tue, 2025-03-04 at 14:26 +0530, chandan Kumar wrote:
> Hello,
> I hope you are doing fine. I need your expertise on below case study.
> My current production environment is 2 node streaming replication hosted on
> Ubuntu VM 's on Azure. I have performed below steps on primary database.
> 1- Take Base backup
> 2- Create a restore point using pg_create_restore_point()
> 3- executed some DDL statement (CREATE VIEW,ADD INDEX,DROP INDEX)
> 4- Perform rollback using restore point
> To rollback, you must stop PostgreSQL, restore the last full backup, and apply
> WAL files until the restore point:
> 1. Stop PostgreSQL Service
> 2. Restore from Full Backup (Using pg_basebackup)
> 3. Modify recovery.conf (or postgresql.conf for newer versions)
> o Set recovery target name:
> recovery_target_name = 'before_ddl_changes'
> recovery_target_action = 'pause'
> o Set restore_command to replay WAL logs:
> restore_command = 'cp /path/to/wal_archive/%f %p'
> 4. Start PostgreSQL
> sudo systemctl start postgresql
> 5. Verify Recovery Status
> SELECT pg_is_in_recovery();
> After verification, finalize recovery:
> touch /var/lib/postgresql/data/recovery.signal
> or
> rm /var/lib/postgresql/data/recovery.conf
> Then restart PostgreSQL.
> 6. Reestablish replication
>
> Could you please help if my steps are correct ? Can we achieve rollback from any
> other approach without restoring basebackup?
You have to create /var/lib/postgresql/data/recovery.signal *before* you
start the server. Forget about "recovery.conf", that was before v12.
You can set "recovery_target_action = 'promote'".
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-03-04 09:42 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04 08:56 Review my steps for rollback to restore point chandan Kumar <[email protected]>
2025-03-04 09:42 ` Laurenz Albe <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox