1.确认当前归档模式
postgres=# show archive_mode;
archive_mode
--------------
off
2.设置参数
alter system set archive_mode=on;
alter system set archive_dest=/gaussdb/gs_arch;
alter system set archive_timeout=1800;
\! mkdir -p /gaussdb/gs_arch;
3.确认参数
postgres=# select name,setting from pg_settings where name like '%archive_%';
name | setting
---------------------------+------------------
archive_command |
archive_dest | /gaussdb/gs_arch
archive_mode | on
archive_timeout | 1800
max_standby_archive_delay | 3000
4、验证归档日志
begin
for i in 1..1000 loop
insert into emp select * from emp;
commit;
end loop;
end;
/
查看归档情况:
[omm@dbserver1 gs_arch]$ ls -ltr /gaussdb/gs_arch/*
total 2932736
-rw------- 1 omm dbgrp 16777216 Nov 23 18:52 00000001000000000000000B
-rw------- 1 omm dbgrp 16777216 Nov 23 18:52 00000001000000000000000C
-rw------- 1 omm dbgrp 16777216 Nov 23 18:52 00000001000000000000000D
-rw------- 1 omm dbgrp 16777216 Nov 23 18:52 00000001000000000000000E
-rw------- 1 omm dbgrp 16777216 Nov 23 18:52 00000001000000000000000F
。。。