标签:man sql mod 执行 art pwd amp 命令 postgres
修改postgresql.conf
archive_mode =on
%p = path of file to archive
%f = file name only
archive_command =‘cp %p /u01/pgsql/archive/pg_%f‘
重启postgresql
pg_ctl stop
pg_ctl start
查看归档
[postgres@redis01 archive]$ ls -lrt
total 32772
-rw------- 1 postgres postgres 16777216 Sep 22 18:49 pg_000000010000000000000001
-rw------- 1 postgres postgres 16777216 Sep 22 18:50 pg_000000010000000000000002
-rw------- 1 postgres postgres 329 Sep 22 18:50 pg_000000010000000000000002.00000060.backup
[postgres@redis01 archive]$ pwd
/u01/pgsql/archive
command 使用逻辑运算符
每天生成一个归档目录
archive_command = ‘DIR=/u01/pgsql/archive/`date +%F`; sudo test ! -d $DIR && sudo mkdir $DIR; sudo test ! -f $DIR/%f && sudo cp %p $DIR/%f‘
标签:man sql mod 执行 art pwd amp 命令 postgres
原文地址:https://www.cnblogs.com/omsql/p/11568700.html