Odoo 10 数据库备份及恢复总结

本文详细介绍了Odoo 10中PostgreSQL数据库的备份和恢复过程,包括pg_dump和pg_dumpall工具的使用,以及在备份过程中可能遇到的问题和解决办法。此外,还提到了Odoo的数据库管理功能,如复制和恢复,并提供了备份策略建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数据库备份的时候难免会出现一些小问题,本篇文章主要讲解一下odoo的PostgreSQL数据库的备份恢复以及操作:

备份策略:阶段性备份+特定事件备份。周期性自动备份+手动检查+自动通知。
官方参考:https://www.odoo.com/forum/help-1/question/how-to-setup-a-regular-postgresql-database-backup-4728

非并行备份及恢复
使用PostgreSQL的pg_dump和pg_dumpall来备份数据,这两种备份工具都不支持并行备份。
所有备份文件都保存到Master节点,而不是segment节点。一般情况不使用pg_dump,它适用于PostgreSQL迁移到Greenplum。

1、pg_dump
可以在本地及远程进行备份,只需要表的读权限即可备份。pg_dump创建的备份是一致的,在pg_dump运行时数据库产生快照,不阻塞数据库的DML操作,但是会阻塞需要排他锁的操作,如alter table等。特别注意的是,pg_dump一次只能备份一个单独的数据库,且不能备份角色和表空间信息(因为这些信息是cluster-wide,而不是在某个数据库中(per-database))。 

命令参数:

$ pg_dump --help

pg_dump dumps a database as a text file or to other formats.

 

Usage:

  pg_dump [OPTION]... [DBNAME]

 

General options:

  -f, --file=FILENAME      output file name

  -F, --format=c|t|p       output file format (custom, tar, plain text)

  -i, --ignore-version     proceed even when server version mismatches

                           pg_dump version

  -v, --verbose            verbose mode

  -Z, --compress=0-9       compression level for compressed formats

  --help                   show this help, then exit

  --version                output version information, then exit

 

Options controlling the output content:

  -a, --data-only             dump only the data, not the schema

  -b, --blobs                 include large objects in dump

  -c, --clean                 clean (drop) schema prior to create

  -C, --create                include commands to create database in dump

  -d, --inserts            dump data as INSERT, rather than COPY, commands

  -D, --column-inserts     dump data as INSERT commands with column names

  -E, --encoding=ENCODING     dump the data in encoding ENCODING

  -n, --schema=SCHEMA         dump the named schema(s) only

  -N, --exclude-schema=SCHEMA do NOT dump the named schema(s)

  -o, --oids                  include OIDs in dump

  -O, --no-owner              skip restoration of object ownership

                              in plain text format

  -s, --schema-only           dump only the schema, no data

  -S, --superuser=NAME        specify the superuser user name to use in

                              plain text format

  -t, --table=TABLE           dump only matching table(s) (or views or sequences)

  -T, --exclude-table=TABLE   do NOT dump matching table(s) (or views or sequences)

  -x, --no-privileges         do not dump privileges (grant/revoke)

  --disable-dollar-quoting    disable dollar quoting, use SQL standard quoting

  --disable-triggers          disable triggers duri
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值