自定义格式(-F c)的PostgreSQL备份在pg_restore(日志中的复制命令)期间失败



我们有一个PostgreSQL自定义格式(-F c(数据库备份,大小约为1Gb,无法在我们的两台用户机器上恢复。发生的错误是

:pg_restore:[archiver(db(]错误由PQputCopyData返回,并且在日志中Copy命令中存在错误。

在pg_restore期间,我们在Copy命令中发现的所有错误报告都与文本(sql(备份有关,但事实并非如此。

有什么想法吗

以下是详细描述该问题的信息:

1.使用";Microsoft文件校验和完整性验证程序";

2.备份、恢复和恢复使用PostgreSQL 9.6.5 64位执行。

3.pg_dump的备份格式称为

pg_dump -U username -F c -Z 9  mydatabase >  myarchive

4.客户端上的数据库是用创建的

CREATE DATABASE mydatabase  WITH TEMPLATE = template0 ENCODING = 'UTF8'  OWNER=user;

5。Pg_resote调用:

pg_restore.exe  -U user --dbname=mydatabase   --verbose --no-owner --role=user 

6.日志示例,存在带有随机表错误的重复行:

2020-12-07 13:40:56 GMT LOG:  checkpoints are occurring too frequently (21 seconds apart)
2020-12-07 13:40:56 GMT HINT:  Consider increasing the configuration parameter "max_wal_size".
2020-12-07 13:40:57 GMT ERROR:  extra data after last expected column
2020-12-07 13:40:57 GMT CONTEXT:  COPY substance, line 21511: "21743    N  2   1d8c29d2d4dc17ccec4a29710c2f190a    e98906e08d4cf1ac23bc4a5a26f83e73    1d8c29d2d4dc17ccec4a297..."
2020-12-07 13:40:57 GMT STATEMENT:  COPY substance (id, text_id, storehouse_id, i_tb_id, i_twod_tb_id, tb_id, twod_tb_id, o_smiles, i_smiles_id, i_twod_smiles_id, smiles_id, twod_smiles_id, substance_type)
2020-12-07 13:40:57 GMT FATAL:  invalid frontend message type 48
2020-12-07 13:40:57 GMT LOG:  PID 105976 in cancel request did not match any process

2020-12-07 14:35:42 GMT LOG:  checkpoints are occurring too frequently (16 seconds apart)
2020-12-07 14:35:42 GMT HINT:  Consider increasing the configuration parameter "max_wal_size".
2020-12-07 14:35:59 GMT LOG:  checkpoints are occurring too frequently (17 seconds apart)
2020-12-07 14:35:59 GMT HINT:  Consider increasing the configuration parameter "max_wal_size".
2020-12-07 14:36:09 GMT ERROR:  invalid byte sequence for encoding "UTF8": 0x00
2020-12-07 14:36:09 GMT CONTEXT:  COPY scalar_calculation, line 3859209
2020-12-07 14:36:09 GMT STATEMENT:  COPY scalar_calculation (calculator_id, smiles_id, mean_value, remark) FROM stdin;
2020-12-07 14:36:09 GMT FATAL:  invalid frontend message type 49
2020-12-07 14:36:10 GMT LOG:  PID 109816 in cancel request did not match any process

我在带有PG 11.x的windows 10 pro机器上看到了类似的行为。

我按照上面的建议使用了pg_dump,并使用psql恢复到上述机器,没有任何错误。

我还注意到,使用不同的"-j";设置。例如,在没有设置或"-j1";pg_restore总是在同一个表和记录上失败。更改为"-j4";导致该表成功地应用了记录而没有错误,但它发生在另一个表上。

将记录中的特定列更改为null可以满足整个还原。

使用pgAdmin 4运行恢复不会产生错误。复制pgAdmin中显示的确切命令会重现相同的错误:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 32780; 0 5435293 TABLE DATA REDACTED_TABLE_NAME postgres
pg_restore: [archiver (db)] COPY failed for table "REDACTED_TABLE_NAME": ERROR:  extra data after last expected column
CONTEXT:  COPY mi_gmrfutil, line 117: "REDACTED PLAIN TEXT  N  REDACTED PLAIN TEXT N  N  N  N  N  N  REDACTED PLAIN TEXT N  N  REDACTED PLAIN TEXT N  ..."
pg_restore: FATAL:  invalid frontend message type 49

我尝试使用pg_restore版本14,结果也是一样的。

相关内容

  • 没有找到相关文章

最新更新