Files
DBAdmin/inbox/DataBase/PostgreSQL/database/enable_archive.sql
T
2026-05-18 06:40:19 +00:00

19 lines
509 B
SQL

1. Create directory for archiving:
mkdir -p /Library/PostgreSQL/10/data/archive/
2. Update the postgres.conf file with below values
wal_level = replica
archive_mode = on
max_wal_senders=1
archive_command= 'test ! -f /Library/PostgreSQL/10/data/archive/%f && cp %p /Library/PostgreSQL/10/data/archive/%f'
3. Restart the postgres servers
export PGDATA=/Library/PostgreSQL/10/data
pg_ctl stop
pg_ctl start
3. Check archive status:
postgres=# select name,setting from pg_settings where name like 'archive%';