CREATE USER USER_NAME WITH REPLICATION LOGIN PASSWORD 'USER_PASSWORD';
更改下列內容:
USER_NAME:要建立的 Datastream 使用者名稱。
USER_PASSWORD:您要建立的 Datastream 使用者登入密碼。
將下列權限授予您建立的使用者:
GRANT SELECT ON ALL TABLES IN SCHEMA SCHEMA_NAME TO USER_NAME;
GRANT USAGE ON SCHEMA SCHEMA_NAME TO USER_NAME;
ALTER DEFAULT PRIVILEGES IN SCHEMA SCHEMA_NAME
GRANT SELECT ON TABLES TO USER_NAME;
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-12 (世界標準時間)。"],[[["\u003cp\u003eEnable logical replication in Cloud SQL by setting the \u003ccode\u003ecloudsql.logical_decoding\u003c/code\u003e flag to 'on' and restarting the instance to apply the changes.\u003c/p\u003e\n"],["\u003cp\u003eCreate a publication for specific tables or all tables, using the \u003ccode\u003eCREATE PUBLICATION\u003c/code\u003e command, to manage the data intended for replication.\u003c/p\u003e\n"],["\u003cp\u003eEstablish a replication slot with a unique name using the \u003ccode\u003ePG_CREATE_LOGICAL_REPLICATION_SLOT\u003c/code\u003e function for each stream replicating from the database.\u003c/p\u003e\n"],["\u003cp\u003eCreate a dedicated Datastream user with replication and login privileges, then grant it necessary \u003ccode\u003eSELECT\u003c/code\u003e and \u003ccode\u003eUSAGE\u003c/code\u003e privileges on the required schemas.\u003c/p\u003e\n"]]],[],null,[]]