【发布时间】:2020-01-16 10:51:14
【问题描述】:
我正在尝试从 Google Cloud SQL (PostgreSQL) 实例导出我的数据,以便使用 pg_dump 和 pg_restore 将其导入常规 Postgres DB:
pg_dump -h sql_proxy -F t --no-owner --no-acl > backup.tar
pg_restore backup.tar -c
但是,在运行 pg_restore 时,我收到以下错误:
pg_restore: [archiver (db)] 处理目录时出错:pg_restore: [archiver (db)] 来自 TOC 条目 197 的错误;第1259章 17010 postgres pg_restore: [archiver (db)] 无法执行查询:错误: 角色“postgres”不存在 命令是:ALTER TABLE public.xxx OWNER TO postgres;
pg_restore: [archiver (db)] 来自 TOC 条目 198 的错误; 1259 17017 桌子 xxy postgres pg_restore: [archiver (db)] 无法执行查询: 错误:角色“postgres”不存在 命令是:ALTER TABLE public.xxy OWNER TO postgres;
...
我尝试了几种不同的标志,但都没有成功。我发现了很多关于如何反向迁移的文章(从 PostgreSQL 迁移到 Google Cloud SQL for PostgreSQL),Google Cloud docs 仅描述了如何导出数据以再次导入 Cloud SQL DB。
对于如何避免上述错误以及如何以尽可能少的更改迁移数据库,我将不胜感激。
【问题讨论】:
标签: postgresql google-cloud-platform google-cloud-sql