在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
简介类似oracle 的 rman, 用于 postgres的备份与恢复 下载https://github.com/ossc-db/pg_rman/tree/V1.3.9 安装tar zxvf pg_rman*.tar.gz chown postgres.postgres -R pg_rman* su - postgres cd xxx/pg_rman* make && make install 使用开启归档 [postgres@node_206 /postgresql/pgsql/archive_log]$tail -3 /postgresql/pgsql/data/postgresql.conf #for pg_Rman archive_mode = on # enables archiving; off, on, or always archive_command = 'test ! -f /postgresql/pgsql/archive_log/%f && cp %p /postgresql/pgsql/archive_log/%f' 重启 PG pg_ctl restart -m fast 初始化 pg_rman init -B /postgresql/pgsql/pg_rman_backups 全量备份 pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups 实例[postgres@node_206 /postgresql/pgsql]$pg_rman init -B /postgresql/pgsql/pg_rman_backups/ INFO: ARCLOG_PATH is set to '/postgresql/pgsql/archive_log' INFO: SRVLOG_PATH is set to '/postgresql/pgsql/pg_log' [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$vim ~/.bash_profile [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$source !$ source ~/.bash_profile [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | (5 rows) postgres=# \c test You are now connected to database "test" as user "postgres". test=# select * from test; id | crt_time ----+---------------------------- 1 | 2020-11-17 23:23:31.407616 2 | 2020-11-17 23:23:31.407728 3 | 2020-11-17 23:23:31.407731 4 | 2020-11-17 23:23:31.407732 5 | 2020-11-17 23:23:31.407732 6 | 2020-11-17 23:23:31.407733 7 | 2020-11-17 23:23:31.407733 8 | 2020-11-17 23:23:31.407734 9 | 2020-11-17 23:23:31.407734 10 | 2020-11-17 23:23:31.407735 (10 rows) test=# insert into test (id) select n from generate_series(11,20) n; INSERT 0 10 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:30:25" backup and archive log files by CRC INFO: backup "2020-11-17 23:30:25" is valid [postgres@node_206 /postgresql/pgsql]$pg_rman show ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path) [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:30:25 2020-11-17 23:30:27 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \c test You are now connected to database "test" as user "postgres". test=# insert into test (id) select n from generate_series(21,30) n; INSERT 0 10 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=incremental -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:31:08" backup and archive log files by CRC INFO: backup "2020-11-17 23:31:08" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:31:08 2020-11-17 23:31:10 INCR 33MB 6 OK 2020-11-17 23:30:25 2020-11-17 23:30:27 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \c test You are now connected to database "test" as user "postgres". test=# drop table test; DROP TABLE test=# \q [postgres@node_206 /postgresql/pgsql]$pg_ctl stop -m fast waiting for server to shut down.... done server stopped [postgres@node_206 /postgresql/pgsql]$pg_ctl start waiting for server to start....2020-11-17 10:32:09.637 EST [58824] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 10:32:09.637 EST [58824] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 10:32:09.637 EST [58824] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 10:32:09.637 EST [58824] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:32:09.637 EST [58824] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 10:32:09.637 EST [58824] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:32:09.643 EST [58824] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 10:32:09.643 EST [58824] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 10:32:09.688 EST [58824] LOG: 00000: redirecting log output to logging collector process 2020-11-17 10:32:09.688 EST [58824] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 10:32:09.688 EST [58824] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$psql -d test psql (12.3) Type "help" for help. test=# insert into test (id ) select n from generate_series(21,30) n; ERROR: relation "test" does not exist LINE 1: insert into test (id ) select n from generate_series(21,30) ... ^ test=# insert into test (id ) select n from generate_series(21,30) n; ERROR: relation "test" does not exist LINE 1: insert into test (id ) select n from generate_series(21,30) ... ^ test=# \d test Did not find any relation named "test". test=# \q [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$repmgr cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ----+----------+---------+---------------+------------+----------+----------+----------+------------------------------------------------------------- 1 | node_206 | primary | * running | | default | 100 | 6 | host=node_206 user=repmgr dbname=repmgr connect_timeout=2 2 | node_205 | standby | ? unreachable | ? node_206 | default | 100 | | host=node_205 user=repmgr dbname=repmgr connect_timeout=2 WARNING: following issues were detected - unable to connect to node "node_205" (ID: 2) - node "node_205" (ID: 2) is registered as an active standby but is unreachable HINT: execute with --verbose option to see connection error messages [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:31:08 2020-11-17 23:31:10 INCR 33MB 6 OK 2020-11-17 23:30:25 2020-11-17 23:30:27 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --restore-target-time='2020-11-17 23:30:25' pg_rman: unrecognized option '--restore-target-time=2020-11-17 23:30:25' ERROR: option is not specified HINT: Try "pg_rman --help" for more information. [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:30:25' ERROR: PostgreSQL server is running HINT: Please stop PostgreSQL server before executing restore. [postgres@node_206 /postgresql/pgsql]$pg_ctl stop -m fast waiting for server to shut down.... done server stopped [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:30:25' ERROR: cannot do restore DETAIL: There is no valid full backup which can be used for given recovery condition. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:30:25' ERROR: cannot do restore DETAIL: There is no valid full backup which can be used for given recovery condition. [postgres@node_206 /postgresql/pgsql]$pg_ctl start waiting for server to start....2020-11-17 10:34:02.558 EST [58862] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 10:34:02.558 EST [58862] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 10:34:02.559 EST [58862] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 10:34:02.559 EST [58862] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:34:02.559 EST [58862] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 10:34:02.559 EST [58862] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:34:02.565 EST [58862] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 10:34:02.565 EST [58862] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 10:34:02.608 EST [58862] LOG: 00000: redirecting log output to logging collector process 2020-11-17 10:34:02.608 EST [58862] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 10:34:02.608 EST [58862] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:31:08 2020-11-17 23:31:10 INCR 33MB 6 OK 2020-11-17 23:30:25 2020-11-17 23:30:27 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups [postgres@node_206 /postgresql/pgsql]$pg_ctl stop waiting for server to shut down.... done server stopped [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:30:25' ERROR: cannot do restore DETAIL: There is no valid full backup which can be used for given recovery condition. [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_ctl start waiting for server to start....2020-11-17 10:34:22.842 EST [58881] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 10:34:22.842 EST [58881] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 10:34:22.842 EST [58881] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 10:34:22.842 EST [58881] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:34:22.842 EST [58881] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 10:34:22.842 EST [58881] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:34:22.846 EST [58881] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 10:34:22.846 EST [58881] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 10:34:22.888 EST [58881] LOG: 00000: redirecting log output to logging collector process 2020-11-17 10:34:22.888 EST [58881] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 10:34:22.888 EST [58881] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:34:26" backup and archive log files by CRC INFO: backup "2020-11-17 23:34:26" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:34:26 2020-11-17 23:34:28 FULL 114MB 6 OK 2020-11-17 23:31:08 2020-11-17 23:31:10 INCR 33MB 6 OK 2020-11-17 23:30:25 2020-11-17 23:30:27 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | (5 rows) postgres=# \c test You are now connected to database "test" as user "postgres". test=# \dt Did not find any relations. test=# create table test(id int); CREATE TABLE test=# drop table test(id int); ERROR: syntax error at or near "(" LINE 1: drop table test(id int); ^ test=# test=# \q [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | (5 rows) postgres=# \c test You are now connected to database "test" as user "postgres". test=# \dt Did not find any relations. test=# create table test(id int); CREATE TABLE test=# drop table test(id int); ERROR: syntax error at or near "(" LINE 1: drop table test(id int); ^ test=# test=# \q [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | (5 rows) postgres=# \c test You are now connected to database "test" as user "postgres". test=# \dt Did not find any relations. test=# create table test(id int); CREATE TABLE test=# drop table test(id int); ERROR: syntax error at or near "(" LINE 1: drop table test(id int); ^ test=# test=# \q [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$pg_ctl restart -m fast waiting for server to shut down.... done server stopped waiting for server to start....2020-11-17 10:36:41.191 EST [58933] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 10:36:41.191 EST [58933] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 10:36:41.192 EST [58933] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 10:36:41.192 EST [58933] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:36:41.192 EST [58933] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 10:36:41.192 EST [58933] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:36:41.197 EST [58933] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 10:36:41.197 EST [58933] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 10:36:41.229 EST [58933] LOG: 00000: redirecting log output to logging collector process 2020-11-17 10:36:41.229 EST [58933] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 10:36:41.229 EST [58933] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ll total 28 drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:36 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 17 23:36 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:36 pg_log drwxrwxr-x. 5 postgres postgres 104 Nov 17 23:30 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$rm -rf archive_log/* [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$rm -rf pg_rman_backups/* [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 17 23:36 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 17 23:36 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:36 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 23:36 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$pwd /postgresql/pgsql [postgres@node_206 /postgresql/pgsql]$ls archive_log backups bin data include lib pg_log pg_rman_backups share [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 17 23:36 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 17 23:36 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:36 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 23:36 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$pwd /postgresql/pgsql [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 17 23:36 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 17 23:36 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:36 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 23:36 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$pwd /postgresql/pgsql [postgres@node_206 /postgresql/pgsql]$ls archive_log backups bin data include lib pg_log pg_rman_backups share [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 17 23:36 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 17 23:36 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:36 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 23:36 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$pwd /postgresql/pgsql [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$tail -3 $PGDATA/postgresql.conf #for pg_Rman archive_mode = on # enables archiving; off, on, or always archive_command = 'test ! -f /postgresql/pgsql/archive_log/%f && cp %p /postgresql/pgsql/archive_log/%f' [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_ctl restart -m fast waiting for server to shut down.... done server stopped waiting for server to start....2020-11-17 10:45:13.636 EST [59035] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 10:45:13.636 EST [59035] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 10:45:13.638 EST [59035] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 10:45:13.638 EST [59035] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:45:13.638 EST [59035] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 10:45:13.638 EST [59035] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:45:13.644 EST [59035] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 10:45:13.644 EST [59035] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 10:45:13.696 EST [59035] LOG: 00000: redirecting log output to logging collector process 2020-11-17 10:45:13.696 EST [59035] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 10:45:13.696 EST [59035] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 17 23:36 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 17 23:45 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 17 23:45 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 23:36 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$pg_rman init -B /postgresql/pgsql/pg_rman_backups/ INFO: ARCLOG_PATH is set to '/postgresql/pgsql/archive_log' INFO: SRVLOG_PATH is set to '/postgresql/pgsql/pg_log' [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | (5 rows) postgres=# \c test You are now connected to database "test" as user "postgres". test=# \dt List of relations Schema | Name | Type | Owner --------+------+-------+---------- public | test | table | postgres (1 row) test=# drop table test test-# ; DROP TABLE test=# create table test(id int, crt_time timestamp); CREATE TABLE test=# insert into test(id) select n from generate_series(1,100) n; INSERT 0 100 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:46:22" backup and archive log files by CRC INFO: backup "2020-11-17 23:46:22" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \c test You are now connected to database "test" as user "postgres". test=# select * from test; id | crt_time -----+---------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | (100 rows) test=# test=# test=# test=# test=# test=# test=# test=# test=# test=# insert into test (id) select n from generate_series(101,110) n; INSERT 0 10 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=incremental -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:47:09" backup and archive log files by CRC INFO: backup "2020-11-17 23:47:09" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:47:09 2020-11-17 23:47:12 INCR 33MB 6 OK 2020-11-17 23:46:22 2020-11-17 23:46:24 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql -d test psql (12.3) Type "help" for help. test=# create table test2( like test ); CREATE TABLE test=# insert into test2(id) select n from generate_serires(1,100) n; ERROR: function generate_serires(integer, integer) does not exist LINE 1: insert into test2(id) select n from generate_serires(1,100) ... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. test=# test=# insert into test2(id) select n from generate_series(1,100) n; INSERT 0 100 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:49:32" backup and archive log files by CRC INFO: backup "2020-11-17 23:49:32" is valid [postgres@node_206 /postgresql/pgsql]$psql -d test psql (12.3) Type "help" for help. test=# insert into test(id) select n from generate_series(101,100) n; INSERT 0 0 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=incremental -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:49:59" backup and archive log files by CRC INFO: backup "2020-11-17 23:49:59" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:49:59 2020-11-17 23:50:01 INCR 33MB 6 OK 2020-11-17 23:49:32 2020-11-17 23:49:35 FULL 64MB 6 OK 2020-11-17 23:47:09 2020-11-17 23:47:12 INCR 33MB 6 OK 2020-11-17 23:46:22 2020-11-17 23:46:24 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman delete 2020-11-17 23:47:09 -B /postgresql/pgsql/pg_rman_backups/ WARNING: cannot delete backup with start time "2020-11-17 23:47:09" DETAIL: This is the incremental backup necessary for successful recovery. WARNING: cannot delete backup with start time "2020-11-17 23:46:22" DETAIL: This is the latest full backup necessary for successful recovery. [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:49:59 2020-11-17 23:50:01 INCR 33MB 6 OK 2020-11-17 23:49:32 2020-11-17 23:49:35 FULL 64MB 6 OK 2020-11-17 23:47:09 2020-11-17 23:47:12 INCR 33MB 6 OK 2020-11-17 23:46:22 2020-11-17 23:46:24 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$pg_rman delete -f 2020-11-17 23:47:09 -B /postgresql/pgsql/pg_rman_backups/ WARNING: using force option will make some of the remaining backups unusable DETAIL: Any remaining incremental backups that are older than the oldest available full backup cannot be restored. INFO: delete the backup with start time: "2020-11-17 23:47:09" INFO: delete the backup with start time: "2020-11-17 23:46:22" [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/ total 8 drwx------. 6 postgres postgres 62 Nov 17 23:49 20201117 drwx------. 4 postgres postgres 34 Nov 17 23:45 backup -rw-rw-r--. 1 postgres postgres 84 Nov 17 23:45 pg_rman.ini -rw-rw-r--. 1 postgres postgres 40 Nov 17 23:45 system_identifier drwx------. 2 postgres postgres 6 Nov 17 23:45 timeline_history [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117/ total 0 drwx------. 2 postgres postgres 89 Nov 17 23:50 234622 drwx------. 2 postgres postgres 89 Nov 17 23:50 234709 drwx------. 5 postgres postgres 133 Nov 17 23:49 234932 drwx------. 5 postgres postgres 133 Nov 17 23:50 234959 [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117/234622/ total 112 -rw-rw-r--. 1 postgres postgres 433 Nov 17 23:50 backup.ini -rw-rw-r--. 1 postgres postgres 226 Nov 17 23:46 file_arclog.txt -rw-rw-r--. 1 postgres postgres 99521 Nov 17 23:46 file_database.txt -rwx------. 1 postgres postgres 764 Nov 17 23:46 mkdirs.sh [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117/2347 ls: cannot access pg_rman_backups/20201117/2347: No such file or directory [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117/234709/ total 124 -rw-rw-r--. 1 postgres postgres 438 Nov 17 23:50 backup.ini -rw-rw-r--. 1 postgres postgres 468 Nov 17 23:47 file_arclog.txt -rw-rw-r--. 1 postgres postgres 113305 Nov 17 23:47 file_database.txt -rwx------. 1 postgres postgres 764 Nov 17 23:47 mkdirs.sh [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117/234932/ total 116 drwx------. 2 postgres postgres 118 Nov 17 23:49 arclog -rw-rw-r--. 1 postgres postgres 428 Nov 17 23:49 backup.ini drwx------. 19 postgres postgres 4096 Nov 17 23:49 database -rw-rw-r--. 1 postgres postgres 708 Nov 17 23:49 file_arclog.txt -rw-rw-r--. 1 postgres postgres 99583 Nov 17 23:49 file_database.txt -rwx------. 1 postgres postgres 764 Nov 17 23:49 mkdirs.sh drwx------. 2 postgres postgres 6 Nov 17 23:49 srvlog [postgres@node_206 /postgresql/pgsql]$pg_rman purge ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path) [postgres@node_206 /postgresql/pgsql]$pg_rman purge -B /postgresql/pgsql/pg_rman_backups/ INFO: DELETED backup "2020-11-17 23:47:09" is purged INFO: DELETED backup "2020-11-17 23:46:22" is purged [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117/234622/ ls: cannot access pg_rman_backups/20201117/234622/: No such file or directory [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/20201117 total 0 drwx------. 5 postgres postgres 133 Nov 17 23:49 234932 drwx------. 5 postgres postgres 133 Nov 17 23:50 234959 [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:49:59 2020-11-17 23:50:01 INCR 33MB 6 OK 2020-11-17 23:49:32 2020-11-17 23:49:35 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# drop database test; DROP DATABASE postgres=# \q [postgres@node_206 /postgresql/pgsql]$pg_ctl stop -m fast waiting for server to shut down.... done server stopped [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:49:32' ERROR: cannot do restore DETAIL: There is no valid full backup which can be used for given recovery condition. [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups ERROR: could not connect to database postgres: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_ctl start waiting for server to start....2020-11-17 10:53:41.927 EST [59212] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 10:53:41.927 EST [59212] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 10:53:41.928 EST [59212] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 10:53:41.928 EST [59212] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:53:41.928 EST [59212] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 10:53:41.928 EST [59212] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 10:53:41.929 EST [59212] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 10:53:41.929 EST [59212] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 10:53:41.977 EST [59212] LOG: 00000: redirecting log output to logging collector process 2020-11-17 10:53:41.977 EST [59212] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 10:53:41.977 EST [59212] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:53:43" backup and archive log files by CRC INFO: backup "2020-11-17 23:53:43" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:53:43 2020-11-17 23:53:45 FULL 75MB 6 OK 2020-11-17 23:53:39 2020-11-17 23:53:39 FULL 0B 0 ERROR 2020-11-17 23:49:59 2020-11-17 23:50:01 INCR 33MB 6 OK 2020-11-17 23:49:32 2020-11-17 23:49:35 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql -d test psql: error: could not connect to server: FATAL: database "test" does not exist [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# create database test; CREATE DATABASE postgres=# \c test You are now connected to database "test" as user "postgres". test=# create table test2(id int, crt_time timestamp ); CREATE TABLE test=# insert into test2(id) select n from generate_series(1,100) n; INSERT 0 100 test=# test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-17 23:58:53" backup and archive log files by CRC INFO: backup "2020-11-17 23:58:53" is valid [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:58:53 2020-11-17 23:58:55 FULL 64MB 6 OK 2020-11-17 23:53:43 2020-11-17 23:53:45 FULL 75MB 6 OK 2020-11-17 23:53:39 2020-11-17 23:53:39 FULL 0B 0 ERROR 2020-11-17 23:49:59 2020-11-17 23:50:01 INCR 33MB 6 OK 2020-11-17 23:49:32 2020-11-17 23:49:35 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman delete -f 2020-11-17 23:53:39 -B /postgresql/pgsql/pg_rman_backups/ WARNING: using force option will make some of the remaining backups unusable DETAIL: Any remaining incremental backups that are older than the oldest available full backup cannot be restored. INFO: delete the backup with start time: "2020-11-17 23:53:39" INFO: delete the backup with start time: "2020-11-17 23:49:59" INFO: delete the backup with start time: "2020-11-17 23:49:32" [postgres@node_206 /postgresql/pgsql]$pg_rman purge -B /postgresql/pgsql/pg_rman_backups/ INFO: DELETED backup "2020-11-17 23:53:39" is purged INFO: DELETED backup "2020-11-17 23:49:59" is purged INFO: DELETED backup "2020-11-17 23:49:32" is purged [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:58:53 2020-11-17 23:58:55 FULL 64MB 6 OK 2020-11-17 23:53:43 2020-11-17 23:53:45 FULL 75MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \c test You are now connected to database "test" as user "postgres". test=# \dt List of relations Schema | Name | Type | Owner --------+-------+-------+---------- public | test2 | table | postgres (1 row) test=# \c postgres You are now connected to database "postgres" as user "postgres". postgres=# drop database test; DROP DATABASE postgres=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-17 23:58:53 2020-11-17 23:58:55 FULL 64MB 6 OK 2020-11-17 23:53:43 2020-11-17 23:53:45 FULL 75MB 6 OK [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:58:53' ERROR: PostgreSQL server is running HINT: Please stop PostgreSQL server before executing restore. [postgres@node_206 /postgresql/pgsql]$pg_ctl stop -m fast waiting for server to shut down.... done server stopped [postgres@node_206 /postgresql/pgsql]$pg_rman restore -B /postgresql/pgsql/pg_rman_backups/ --recovery-target-time='2020-11-17 23:58:53' INFO: the recovery target timeline ID is not given INFO: use timeline ID of current database cluster as recovery target: 6 INFO: calculating timeline branches to be used to recovery target point INFO: searching latest full backup which can be used as restore start point INFO: found the full backup can be used as base in recovery: "2020-11-17 23:53:43" INFO: copying online WAL files and server log files INFO: clearing restore destination INFO: validate: "2020-11-17 23:53:43" backup and archive log files by SIZE INFO: backup "2020-11-17 23:53:43" is valid INFO: restoring database files from the full mode backup "2020-11-17 23:53:43" INFO: searching incremental backup to be restored INFO: searching backup which contained archived WAL files to be restored INFO: backup "2020-11-17 23:53:43" is valid INFO: restoring WAL files from backup "2020-11-17 23:53:43" INFO: backup "2020-11-17 23:58:53" is valid INFO: restoring WAL files from backup "2020-11-17 23:58:53" INFO: restoring online WAL files and server log files INFO: add recovery related options to postgresql.conf INFO: generating recovery.signal INFO: restore complete HINT: Recovery will start automatically when the PostgreSQL server is started. [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups ERROR: could not connect to database postgres: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? [postgres@node_206 /postgresql/pgsql]$pg_ctl start waiting for server to start....2020-11-17 11:00:30.910 EST [59357] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 11:00:30.910 EST [59357] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 11:00:30.910 EST [59357] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 11:00:30.910 EST [59357] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:00:30.910 EST [59357] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 11:00:30.910 EST [59357] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:00:30.914 EST [59357] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 11:00:30.914 EST [59357] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 11:00:30.965 EST [59357] LOG: 00000: redirecting log output to logging collector process 2020-11-17 11:00:30.965 EST [59357] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 11:00:30.965 EST [59357] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files ERROR: query failed: ERROR: recovery is in progress HINT: pg_walfile_name_offset() cannot be executed during recovery. query was: SELECT * from pg_walfile_name_offset(pg_start_backup($1, $2, $3)) [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$rm -f data/recovery.signal [postgres@node_206 /postgresql/pgsql]$pg_ctl restart -m fast waiting for server to shut down.... done server stopped waiting for server to start....2020-11-17 11:00:51.204 EST [59374] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 11:00:51.204 EST [59374] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 11:00:51.205 EST [59374] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 11:00:51.205 EST [59374] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:00:51.205 EST [59374] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 11:00:51.205 EST [59374] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:00:51.210 EST [59374] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 11:00:51.210 EST [59374] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 11:00:51.270 EST [59374] LOG: 00000: redirecting log output to logging collector process 2020-11-17 11:00:51.270 EST [59374] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 11:00:51.270 EST [59374] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-18 00:00:53" backup and archive log files by CRC INFO: backup "2020-11-18 00:00:53" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:00:53 2020-11-18 00:00:55 FULL 159MB 6 OK 2020-11-18 00:00:34 2020-11-18 00:00:34 FULL 0B 0 ERROR 2020-11-18 00:00:26 2020-11-18 00:00:26 FULL 0B 0 ERROR 2020-11-17 23:58:53 2020-11-17 23:58:55 FULL 64MB 6 OK 2020-11-17 23:53:43 2020-11-17 23:53:45 FULL 75MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) postgres=# \c test FATAL: database "test" does not exist Previous connection kept postgres=# \q [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:00:53 2020-11-18 00:00:55 FULL 159MB 6 OK 2020-11-18 00:00:34 2020-11-18 00:00:34 FULL 0B 0 ERROR 2020-11-18 00:00:26 2020-11-18 00:00:26 FULL 0B 0 ERROR 2020-11-17 23:58:53 2020-11-17 23:58:55 FULL 64MB 6 OK 2020-11-17 23:53:43 2020-11-17 23:53:45 FULL 75MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) postgres=# \c test FATAL: database "test" does not exist Previous connection kept postgres=# \q [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_ctl restart -m fast waiting for server to shut down.... done server stopped waiting for server to start....2020-11-17 11:01:30.816 EST [59423] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 11:01:30.816 EST [59423] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 11:01:30.822 EST [59423] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 11:01:30.822 EST [59423] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:01:30.822 EST [59423] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 11:01:30.822 EST [59423] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:01:30.837 EST [59423] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 11:01:30.837 EST [59423] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 11:01:30.877 EST [59423] LOG: 00000: redirecting log output to logging collector process 2020-11-17 11:01:30.877 EST [59423] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 11:01:30.877 EST [59423] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$ll total 28 drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 18 00:01 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 pg_log drwxrwxr-x. 6 postgres postgres 120 Nov 18 00:00 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$rm -rf archive_log/* pg_rman_backups/* [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 18 00:01 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 18 00:01 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 18 00:01 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ls archive_log backups bin data include lib pg_log pg_rman_backups share [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 18 00:01 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 18 00:01 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 18 00:01 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/ total 0 [postgres@node_206 /postgresql/pgsql]$ll archive_log/ total 0 [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 18 00:01 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 18 00:01 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 18 00:01 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ls archive_log backups bin data include lib pg_log pg_rman_backups share [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 18 00:01 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 18 00:01 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 18 00:01 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$ll pg_rman_backups/ total 0 [postgres@node_206 /postgresql/pgsql]$ll archive_log/ total 0 [postgres@node_206 /postgresql/pgsql]$ll total 24 drwxr-xr-x. 2 postgres postgres 6 Nov 18 00:01 archive_log drwxrwxr-x. 2 postgres postgres 6 Nov 17 15:51 backups drwxr-xr-x. 2 postgres postgres 4096 Nov 17 16:43 bin drwx------. 19 postgres postgres 4096 Nov 18 00:01 data drwxr-xr-x. 6 postgres postgres 4096 Nov 15 16:14 include drwxr-xr-x. 4 postgres postgres 4096 Nov 17 06:37 lib drwxr-xr-x. 2 postgres postgres 4096 Nov 18 00:01 pg_log drwxrwxr-x. 2 postgres postgres 6 Nov 18 00:01 pg_rman_backups drwxr-xr-x. 8 postgres postgres 4096 Nov 15 16:14 share [postgres@node_206 /postgresql/pgsql]$vim $PGDATA/postgresql.conf [postgres@node_206 /postgresql/pgsql]$pg_ctl restart waiting for server to shut down.... done server stopped waiting for server to start....2020-11-17 11:08:26.228 EST [59464] LOG: 00000: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit 2020-11-17 11:08:26.228 EST [59464] LOCATION: PostmasterMain, postmaster.c:998 2020-11-17 11:08:26.233 EST [59464] LOG: 00000: listening on IPv4 address "0.0.0.0", port 5432 2020-11-17 11:08:26.233 EST [59464] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:08:26.233 EST [59464] LOG: 00000: listening on IPv6 address "::", port 5432 2020-11-17 11:08:26.233 EST [59464] LOCATION: StreamServerPort, pqcomm.c:593 2020-11-17 11:08:26.236 EST [59464] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-11-17 11:08:26.236 EST [59464] LOCATION: StreamServerPort, pqcomm.c:587 2020-11-17 11:08:26.293 EST [59464] LOG: 00000: redirecting log output to logging collector process 2020-11-17 11:08:26.293 EST [59464] HINT: Future log output will appear in directory "/postgresql/pgsql/pg_log". 2020-11-17 11:08:26.293 EST [59464] LOCATION: SysLogger_Start, syslogger.c:675 done server started [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pwd /postgresql/pgsql [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) postgres=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman init -B /postgresql/pgsql/pg_rman_backups/ INFO: ARCLOG_PATH is set to '/postgresql/pgsql/archive_log' INFO: SRVLOG_PATH is set to '/postgresql/pgsql/pg_log' [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# create database test; CREATE DATABASE postgres=# \c test You are now connected to database "test" as user "postgres". test=# create table test(id int, crt_time timestamp default clock_timestamp()); CREATE TABLE test=# insert into test (id) select n from generate_series(1,100) n; INSERT 0 100 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-18 00:09:40" backup and archive log files by CRC INFO: backup "2020-11-18 00:09:40" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql -d test psql (12.3) Type "help" for help. test=# insert into test (id) select n from generate_series(101,110) n; INSERT 0 10 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=incremental -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:10:03 2020-11-18 00:10:05 INCR 33MB 6 DONE 2020-11-18 00:09:40 2020-11-18 00:09:42 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-18 00:10:03" backup and archive log files by CRC INFO: backup "2020-11-18 00:10:03" is valid [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:10:03 2020-11-18 00:10:05 INCR 33MB 6 OK 2020-11-18 00:09:40 2020-11-18 00:09:42 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql -d test psql (12.3) Type "help" for help. test=# create table test2(like test); CREATE TABLE test=# insert into test2 (id) select n from generate_series(1,100) n; INSERT 0 100 test=# \q [postgres@node_206 /postgresql/pgsql]$pg_rman backup --backup-mode=full -B /postgresql/pgsql/pg_rman_backups INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:10:49 2020-11-18 00:10:51 FULL 64MB 6 DONE 2020-11-18 00:10:03 2020-11-18 00:10:05 INCR 33MB 6 OK 2020-11-18 00:09:40 2020-11-18 00:09:42 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$pg_rman validate -B /postgresql/pgsql/pg_rman_backups INFO: validate: "2020-11-18 00:10:49" backup and archive log files by CRC INFO: backup "2020-11-18 00:10:49" is valid [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:10:49 2020-11-18 00:10:51 FULL 64MB 6 OK 2020-11-18 00:10:03 2020-11-18 00:10:05 INCR 33MB 6 OK 2020-11-18 00:09:40 2020-11-18 00:09:42 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman delete -f 2020-11-18 00:10:03 ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path) [postgres@node_206 /postgresql/pgsql]$pg_rman delete -f 2020-11-18 00:10:03 -B /postgresql/pgsql/pg_rman_backups/ WARNING: using force option will make some of the remaining backups unusable DETAIL: Any remaining incremental backups that are older than the oldest available full backup cannot be restored. INFO: delete the backup with start time: "2020-11-18 00:10:03" INFO: delete the backup with start time: "2020-11-18 00:09:40" [postgres@node_206 /postgresql/pgsql]$pg_rman purge -B /postgresql/pgsql/pg_rman_backups/ INFO: DELETED backup "2020-11-18 00:10:03" is purged INFO: DELETED backup "2020-11-18 00:09:40" is purged [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$pg_rman show -B /postgresql/pgsql/pg_rman_backups/ ===================================================================== StartTime EndTime Mode Size TLI Status ===================================================================== 2020-11-18 00:10:49 2020-11-18 00:10:51 FULL 64MB 6 OK [postgres@node_206 /postgresql/pgsql]$ [postgres@node_206 /postgresql/pgsql]$psql psql (12.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | repmgr | repmgr | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 |
请发表评论