Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from psql windows:
- ===================
- alter system set archive_mode = 'on';
- alter system set archive_command = 'copy "%p" "C:\\temp\\%f"';
- select pg_reload_conf();
- show archive_command; -- should match path specified above
- create table test(id int);
- insert into test values (1);
- select count(*) from test; -- equals 1
- select pg_switch_wal(); -- NOTE: for an existing database should I copy the prior wal files from pg_wal into my archive dir?
- select now(); -- capture current time for pitr
- truncate table test;
- select pg_switch_wal();
- show data_directory; -- capture path for recovery.conf
- from windows command line:
- ==========================
- sc stop postgresql-x64-11
- (
- echo restore_command = 'copy "%p" "C:\\temp\\%f"'
- echo recovery_target_time = '2019-11-22 10:31:06'
- )>"C:\test\data\recovery.conf"
- sc start postgresql-x64-11
- postgres log:
- =============
- 2019-11-22 10:33:00.845 PST [9724] LOG: database system was shut down at 2019-11-22 10:32:03 PST
- 2019-11-22 10:33:00.845 PST [9724] LOG: starting point-in-time recovery to 2019-11-22 10:31:06-08
- 2019-11-22 10:33:00.881 PST [9724] LOG: consistent recovery state reached at 17/8F000098
- 2019-11-22 10:33:00.881 PST [9724] LOG: invalid record length at 17/8F000098: wanted 24, got 0
- 2019-11-22 10:33:00.881 PST [9724] LOG: redo is not required
- 2019-11-22 10:33:00.890 PST [9224] LOG: database system is ready to accept read only connections
- 2019-11-22 10:33:00.930 PST [9724] LOG: selected new timeline ID: 2
- 2019-11-22 10:33:01.051 PST [9724] LOG: archive recovery complete
- 2019-11-22 10:33:01.315 PST [9224] LOG: database system is ready to accept connections
- from psql windows:
- ==================
- select count(*) from test; -- equals 0, why is the truncate included?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement