postgresql:pg_restore错误与“详细信息:系统目录修改当前不允许”。

问题描述:

我想将笔记本电脑上的开发数据库转移到工作站上。它给了我各种各样的错误,我不知道如何正确地恢复这个数据库转储。没有-1它完成,但有很多对象丢失。postgresql:pg_restore错误与“详细信息:系统目录修改当前不允许”。

目标机器上的数据库名称与我从中剔除的数据库不同。但我看不出有什么可能与错误有关。完全新的这个转储/恢复的东西。我看不出在pg_restore -l我出线索的有关系统目录中的任何东西......

D:\db>pg_restore -d checkpoint -U postgres --disable-triggers -x -O - 
1 -v -n temp dump-1.backup 
pg_restore: connecting to database for restore 
Password: 
pg_restore: creating TYPE "temp.my_agg" 
pg_restore: [archiver (db)] Error while PROCESSING TOC: 
pg_restore: [archiver (db)] Error from TOC entry 1037; 1247 89882 TYPE my_agg po 
stgres 
pg_restore: [archiver (db)] could not execute query: ERROR: permission denied t 
o create "pg_catalog.my_agg" 
DETAIL: System catalog modifications are currently disallowed. 
    Command was: CREATE TYPE my_agg AS (
     ecnt integer, 
     eids integer 
); 

下降-n temp似乎摆脱了特权的问题。但更多的错误来临

pg_restore: creating FUNCTION "public.cmptime(timestamp without time zone, text, 
timestamp without time zone, text, text)" 
pg_restore: [archiver (db)] Error while PROCESSING TOC: 
pg_restore: [archiver (db)] Error from TOC entry 355; 1255 60129 FUNCTION cmptim 
e(timestamp without time zone, text, timestamp without time zone, text, text) po 
stgres 
pg_restore: [archiver (db)] could not execute query: ERROR: language "plv8" doe 
s not exist 
    Command was: CREATE FUNCTION cmptime(t0 timestamp without time zone, s0 text 
, t1 timestamp without time zone, s1 text, rcode text) RETURN... 

手动创建plv8和plpython扩展后。那些语言错误消失了。我有这个FDW表的问题。

pg_restore: creating FOREIGN TABLE "public.t1" 
pg_restore: [archiver (db)] Error while PROCESSING TOC: 
pg_restore: [archiver (db)] Error from TOC entry 204; 1259 25543 FOREIGN TABLE r 
edrawing postgres 
pg_restore: [archiver (db)] could not execute query: ERROR: server "myserver1" 
does not exist 
    Command was: CREATE FOREIGN TABLE t1 (
    fid bigint, 
    pd_date text, 
    team text, 
    shift text, 
    line text, 
    opr1 te... 

我试着创建FDW扩展。但FDW依赖于公共模式。 正在删除-c --if-exists pg_restore选项,在每次恢复尝试之前重新创建检查点数据库。

pg_restore: [archiver (db)] could not execute query: ERROR: server "myserver1" 
does not exist 
    Command was: CREATE FOREIGN TABLE t1 (
    fid bigint, 
    pd_date text, 
    team text, 
    shift text, 
    line text, 
    opr1 te... 

FDW仍然存在问题。必须在每次遇到新的FDW错误后创建每个FDW服务器(我不记得它们全部)。循环这个过程,直到所有的FDW服务器错误消失 (这是真的如何无错误的数据库恢复应该做....?)。 下一个错误

pg_restore: [archiver (db)] could not execute query: ERROR: server "myserver1" 
does not exist 
    Command was: CREATE FOREIGN TABLE t1 (
    fid bigint, 
    pd_date text, 
    team text, 
    shift text, 
    line text, 
    opr1 te... 

我已经物化视图缓存plpython函数的结果。但是他们的一些逻辑被破坏了,不能被轻易修复。

我想我的无错恢复在这里结束。必须删除-1单一交易模式。总误差从55降低到6。看起来大多数物体都回来了。

有什么办法来negelect的materalized视图刷新过程...

错误消息看起来很奇怪 - 但如果很好地理解,PostgreSQL的尝试,以恢复模式public自定义数据类型什么应该被禁止 - 请,只尝试以SQL格式转储架构并确保,因此没有直接修改pg_catalogue方案。

应该首先安装扩展 - 扩展安装有两部分1:将rpm /编译代码安装到数据库服务器,2:扩展注册每个数据库。只有第二步应该通过备份完成。

错误消息pg_restore: [archiver (db)] could not execute query: ERROR: server "myserver1" does not exist是干净的 - 可能在某处声明CREATE SERVER失败 - 可能是由于在服务器上缺少扩展名。