Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:monitoring:zabbix:database:postgresql:partitioning [2020/04/01 18:14] – [Dump the entire Zabbix DB] jlucas | linux:monitoring:zabbix:database:postgresql:partitioning [2020/04/02 15:20] (current) – [Dump individual Zabbix database tables for testing] jlucas | ||
---|---|---|---|
Line 49: | Line 49: | ||
pg_dump -U postgres postgres | psql -U zabbix zabbix | pg_dump -U postgres postgres | psql -U zabbix zabbix | ||
- | =====Dump individual Zabbix database tables for testing===== | + | ====Dump individual Zabbix database tables for testing==== |
+ | The following use of pg_dump and pg_restore performs a data-only backup using the custom-form output option and using INSERTs instead of COPY statements: | ||
pg_dump -U zabbix -a --inserts -t history_str -Fc zabbix | gzip -1 > / | pg_dump -U zabbix -a --inserts -t history_str -Fc zabbix | gzip -1 > / | ||
+ | Once the backup is done, drop all data from the table: | ||
+ | psql -U zabbix -c ' | ||
+ | |||
+ | Now restore the data to the table: | ||
+ | gunzip -c zabdb.zabbix.history_str.Pg.gz | pg_restore -U zabbix -d zabbix |