如何做企业网站小程序,育才网站建设,济南市建设局网站,卡盟网站怎么做图片大全一#xff0c;
前情回顾
某次在使用pg_dump命令逻辑备份出来的备份文件对指定的几个表恢复的时候#xff0c;报错pg_restore: implied data-only restore
当然#xff0c;遇到问题首先就是百度了#xff0c;但好像没有什么明确的解决方案#xff0c;具体的报错命令和…一
前情回顾
某次在使用pg_dump命令逻辑备份出来的备份文件对指定的几个表恢复的时候报错pg_restore: implied data-only restore
当然遇到问题首先就是百度了但好像没有什么明确的解决方案具体的报错命令和报错信息如下
[postgresnode1 ~]$ pg_restore -Upostgres -v -x -d pgbench -t ds.dr_route_ds -t ds.dr_task_active_ds 2023-08-02T04_00-ds.dump
pg_restore: connecting to database for restore
pg_restore: implied data-only restore第二行表示pg_restore 命令已经正确连接到数据库数据库名称是pgbench准备开始备份
第三行表示 暗示恢复命令是仅恢复数据然后就没有然后了
what fa
二
问题分析和解决方案
仔细观察这个备份命令发现是-d 数据库名称 -t 模式名称.该模式下的表名 -t 模式名称.该模式下的表名 -t 模式名称.该模式下的表名
OK将模式名称去掉发现可以正常的恢复了
postgresnode1 ~]$ pg_restore -Upostgres -v -x -a -d pgbench -t dr_route_ds -t dr_task_active_ds 2023-08-02T04_00-ds.dump
pg_restore: connecting to database for restore
pg_restore: processing data for table dr.dr_route_ds
pg_restore: processing data for table dr.dr_task_active_ds
pg_restore: processing data for table ds.dr_route_ds
pg_restore: processing data for table ds.dr_task_active_ds但出现了一个问题pgbench这个数据库下有两个scheme也就是两个模式两个模式有同样的两张表我现在只想恢复ds模式下的这两张表的数据并不想恢复dr模式下的这两张表的数据
因此最终的恢复命令为加 -n参数-指定ds模式
[postgresnode1 ~]$ pg_restore -Upostgres -v -x -a -d pgbench -n ds -t dr_route_ds -t dr_task_active_ds 2023-08-02T04_00-ds.dump
pg_restore: connecting to database for restore
pg_restore: processing data for table ds.dr_route_ds
pg_restore: processing data for table ds.dr_task_active_ds####注
参数-v 是显示恢复的过程通常此参数是必加的参数-a 是只覆盖恢复数据不检查对象是否存在比如要恢复的表已存在这个不检查只把表数据覆盖到表内参数-x 如果逻辑备份文件内有包含权限的对象例如用户什么的使用此参数的时候将不执行相关操作例如某个用户的创建在此逻辑备份文件内但不会执行也不会检查参数-d 指定要恢复到哪个数据库内也就是目标数据库参数-n 指定目标数据库下的scheme也就是模式名称参数-t 指定要恢复的表的表名最后逻辑备份文件前面不要加任何参数