我正在尝试使用 gcp 数据库迁移工具将 cloudsql postgres 9.6 实例迁移到 cloudsql postgres 13 实例。
我在 UI 中使用标志将
cloudsql.enable_pglogical
和 cloudsql.logical_decoding
设置为打开,并重新启动实例,但在尝试使用 postgres 帐户运行迁移时仍然收到以下错误。
连接源数据库失败。确保用户具有所需的权限。解决问题然后重新启动迁移作业。详细信息:复制用户 postgres 没有足够的权限:复制用户对数据库 postgres 中的 schema pglogic 没有 USAGE 权限;复制用户没有对表 public.team_members 的 SELECT 权限,复制用户没有对表 public.doc_comment_read 的 SELECT 权限,复制用户没有对表 public.mailbox_google 的 SELECT 权限,复制用户没有 SELECT 权限在表 public.doc_editor 上,复制用户没有对表 public.mailbox_microsoft 的 SELECT 权限,复制用户没有对表 public.enrollment_whitelist 的 SELECT 权限,复制用户没有对表 public.group_members 的 SELECT 权限,复制用户没有表 public.team_invites 的 SELECT 权限,复制用户没有表 public 的 SELECT 权限...
所以我发现了一些事情。
https://cloud.google.com/sql/docs/postgres/users
The postgres user is part of the cloudsqlsuperuser role, and has the following attributes (privileges): CREATEROLE, CREATEDB, and LOGIN. It does not have the SUPERUSER or REPLICATION attributes.
您需要确保使用数据库的所有者来进行迁移,而不是 postgres 用户。
您必须授予您的用户对 pglogic 模式的权限。
GRANT USAGE ON SCHEMA pglogical TO my_user;
GRANT ALL ON SCHEMA pglogical TO my_user;
ALTER ROLE my_user with REPLICATION;