我在Linux服务器上运行pg_dumpall,并试图在另一个Linux服务器上还原生成的文件,运行相同版本的Postgres(8.1.21-1.el5_5.1)。
当我尝试还原时,会出现以下错误:

# psql --user=postgres -f pgbackup_dcs.sql postgres
[...]
psql:pgbackup_dcs.sql:10753: ERROR:  relation "sl_event" does not exist
psql:pgbackup_dcs.sql:10754: invalid command \N
psql:pgbackup_dcs.sql:10755: invalid command \N
psql:pgbackup_dcs.sql:10756: invalid command \N
psql:pgbackup_dcs.sql:10757: invalid command \N
psql:pgbackup_dcs.sql:10758: invalid command \N
psql:pgbackup_dcs.sql:10759: invalid command \N
[there are a lot of other errors following this point]

转储文件中的这些行如下所示(这里的第一行是10753)
COPY sl_event (ev_origin, ev_seqno, ev_timestamp, ev_minxid, ev_maxxid, ev_xip, ev_type, ev_data1, ev_data2, ev_data3, ev_data4, ev_data5, ev_data6, ev_data7, ev_data8) FROM stdin;
1       687653  2010-12-08 11:54:45.669861      36713740        36713741                SYNC    \N      \N      \N      \N      \N      \N      \N      \N
1       687654  2010-12-08 11:54:55.6757        36713769        36713770                SYNC    \N      \N      \N      \N      \N      \N      \N      \N
1       687655  2010-12-08 11:55:05.68132       36713796        36713797                SYNC    \N      \N      \N      \N      \N      \N      \N      \N

我是在垃圾场还是在恢复?如何在新服务器上还原dbs?

最佳答案

备份中是否有创建表SL_事件(…..)?您尝试将内容复制到不存在的表中,它必须在备份中丢失或在复制语句之后创建。

关于database - 从pg_dumpall恢复Postgres:不存在该关系,命令\N无效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4396700/

10-12 01:37