pg_restore[connection-option...] [option...] [filename] 描述 pg_restore是一个用来从pg_dump创建的非文本格式归档恢复PostgreSQL数据库的工具。它将发出必要的命令把该数据库重建成它被保存时的状态。这些归档文件还允许pg_restore选择恢复哪些内容或者在恢复前对恢复项重排序。这些归档文件被设计为可以在不同的...
t tar 备份是一个tar归档。3,-Fc:指定备份文件格式,pg_restore会自动判断格式,可以不用指定文件格式4,-c:此选项为恢复指定“clean”模式。它告诉 pg_restore 在重新创建数据库对象(表、函数等)之前删除它们。这可以确保恢复的数据库处于干净状态,并与备份文件的结构相匹配。--plain格式备份无法通过pg_restore还原...
Options controlling the restore: -a, --data-only restore only the data, no schema -c, --clean clean (drop) database objects before recreating -C, --create create the target database -e, --exit-on-error exit on error, default is to continue -I, --index=NAME restore named index -j...
默认情况下,pg_restore将把row_security设置为 off 来确保所有数据都被恢复到表中。注意当前这个选项还要求转储处于INSERT格式,因为COPY FROM不支持行安全性。 –if-exists:使用条件命令(即增加一个IF EXISTS子句)删除数据库对象。只有指定了–clean时,这个选项才有效。 –no-comments:不输出恢复注释的命令。 –no-...
-c, --clean 在重新创建之前,先清除(删除)数据库对象 -C, --create 在转储中包括命令,以便创建数据库 -E, --encoding=ENCODING 转储以ENCODING形式编码的数据 -n, --schema=SCHEMA 只转储指定名称的模式 -N, --exclude-schema=SCHEMA 不转储已命名的模式 ...
pg_dump、pg_restore实践 常见选项 -a --data-only 只转储数据,而不转储模式(数据定义)。表数据、大对象和序列值都会被转储。 -c --clean 在输出创建数据库对象的命令之前输出清除(删除)它们的命令 (除非也指定了--if-exists,如果任何对象不存在于 目的数据库中,恢复可能会产生一些伤害性的错误消息)。
逻辑恢复--pg_restore 将数据库脚本文件恢复到数据库中,脚本文件可以为压缩格式。该脚本文件可以为pg_dump导出格式,也可以为自定义文件,下面实例为dvdrental示例数据库导入样例。 # -d 表示将脚本导入那个数据库中;# 前期条件为该数据库必须存在(可以通过create database创建)# -U 表示使用数据库用户名pg_restore...
-c, --clean 在重新创建之前,先清除(删除)数据库对象 -C, --create 创建目标数据库 -e, --exit-on-error 发生错误退出, 默认为继续 -I, --index=NAME 恢复指定名称的索引 -j, --jobs=NUM 执行多个并行任务进行恢复工作 -L, --use-list=FILENAME 从这个文件中使用指定的内容表排序 ...
Restore the backup on the same database to get back at the state of the step 4: Executepsql -c "SELECT timescaledb_pre_restore()" "postgres://admin:..." Executepg_restore --host host.example.com --port 30014 --dbname biniou_5636 --user admin --clean --if-exists --no-owner -...
When running pg_restore --clean --dbname=my_database backup_file.sql to restore a database dump to an empty database, the restore succeeds, but with the following warning message: pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Err...