資料庫組態
用於擷取的資料庫軟體
若要從 PostgreSQL 資料庫擷取,Oracle GoldenGate 需要為資料庫安裝 test_decoding 資料庫 Plug-in。依預設,安裝資料庫時可能未安裝此 Plug-in。
確定資料庫伺服器上已安裝 postgresqlversion#-contrib 套裝軟體,如下列範例所示:
sudo yum install postgresql14-contrib
PostgreSQL 資料庫組態檔中的參數
若為 Oracle GoldenGate,請在 PostgreSQL 資料庫組態檔 $PGDATA/postgresql.conf 中設定下列參數:
注意:Oracle GoldenGate 將從主要資料庫擷取的主要 PostgreSQL 資料庫,以及 Oracle GoldenGate 在主要資料庫發生失敗時能夠擷取的任何待命資料庫,都需要進行這些變更。
-
對於 Extract 或 Replicat 的遠端連線,請設定 PostgreSQL
listen_addresses以允許遠端資料庫連線。舉例而言:listen_addresses=remotehost_ip_address注意:請設定
pg_hba.conf檔案,確定將從屬端認證設為允許來自 Oracle GoldenGate 主機的連線。如需詳細資訊,請參閱此文件:pg_hba.conf 檔案 -
若要支援 Oracle GoldenGate Extract,必須將預寫記錄日誌設為
logical,此日誌會新增支援交易記錄解碼的必要資訊。每個 Extract 必須設定最大複製槽位數,以容納一個開啟槽位,一般而言,每個資料庫不需要一個以上的 Extract。例如,如果 PostgreSQL 原生複製已在使用中,且正在使用所有目前設定的複製插槽,請增加允許註冊 Extract 的值。
應設定最大預寫寄件者數,以符合最大複製插槽值。
(選擇性) 您可以在預寫寫入日誌中啟用確認時戳,在啟用邏輯預寫日誌記錄的同時設定時,會以正確的時間戳記值追蹤該點開始的第一個 DML 確認記錄。否則,Oracle GoldenGate 擷取遇到的第一筆記錄會有不正確的確認時戳。
wal_level = logical # set to logical for Capture max_replication_slots = 1 # max number of replication slots, # one slot per Extract/client max_wal_senders = 1 # one sender per max repl slot track_commit_timestamp = on # optional, correlates tx commit time # with begin tx log record (useful for # timestamp-based positioning) -
在進行上述任何變更之後,請重新啟動資料庫。
使用這些指示來管理 PostgreSQL、Amazon Aurora PostgreSQL、PostgreSQL 的 Amazon RDS、PostgreSQL 的 Google AlloyDB 以及 PostgreSQL 的 Google Cloud SQL 的資料庫設定值。
Azure Database for PostgreSQL
針對 PostgreSQL 的 Azure 資料庫設定 Oracle GoldenGate for PostgreSQL Extract 時,必須啟用邏輯解碼並將其設為 LOGICAL。
閱讀 Microsoft 文件,取得相關說明:
https://learn.microsoft.com/en-us/azure/postgresql/
Azure Database for PostgreSQL 的其他資料庫設定值可以透過資料庫執行處理的「伺服器參數」段落來管理。
若是連線至 PostgreSQL 執行處理的 Azure 資料庫,預設的「Azure 連線安全」設定值需要 SSL 連線。若要遵循這項需求,需要進一步的步驟來支援與 Oracle GoldenGate 的 SSL 連線。
請依照 Configuring SSL Support for PostgreSQL 下列出的內容,瞭解詳細資訊。
適用於 PostgreSQL 的 Amazon Aurora PostgreSQL 和 Amazon RDS
對於 Amazon Aurora PostgreSQL 和 Amazon RDS for PostgreSQL,資料庫設定值會在參數群組內修改。
請檢閱 Amazon AWS 文件,瞭解如何編輯新參數群組內的資料庫設定值,並將其指派給資料庫執行處理:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithParamGroups.html
-
請在指定給執行處理的參數群組中驗證之前所列的資料庫組態設定值是否正確。
-
Amazon 資料庫服務的
wal_level設定具有名為rds.logical_replication的參數,其預設值為0,如果資料庫要用於 Oracle GoldenGate Extract 的來源資料庫,則應設為1。 -
Amazon RDS 不支援在複製插槽名稱前面加上
rds字串。如果複製槽位名稱開頭為rds字串,Oracle GoldenGate Extract 用來建立複製槽位的命令會傳回錯誤。例如,您可以將複製插槽命名為ordscdc而不是rdscdc,以避免發生此錯誤,如下列範例所示:select slot_name from pg_create_logical_replication_slot('ordscdc', 'test_decoding');此命令會增加
ordscdc複製插槽。不過,如果您使用複製槽位名稱作為rdscdc,將會發生下列錯誤:ERROR: must be superuser or replication role to use logical replication slots in the 'rds' namespace
限制:
在 Amazon Aurora PostgreSQL 版本 12.17 上,如果執行大寫 SHOW 命令,則會報告下列錯誤:
"ERROR: must be superuser or replication role to run this operation."
您必須使用小寫 SHOW 命令來避免此錯誤。
Google AlloyDB for PostgreSQL
從 Oracle GoldenGate 21.14 版開始,Oracle GoldenGate 支援 PostgreSQL 版的 Google AlloyDB。設定 Oracle GoldenGate for PostgreSQL Extract for a Google AlloyDB for PostgreSQL 時,必須將 alloydb.logical_decoding configuration 參數 (旗標) 設為 ON。
Google Cloud SQL for PostgreSQL
設定 Oracle GoldenGate for PostgreSQL Extract for a Google Cloud SQL for PostgreSQL 資料庫時,必須設定邏輯解碼,並將 cloudsql.logical_decoding 變數設為 ON 來完成。依照 Google 提供的指示,瞭解如何啟用此資料庫旗標。如需詳細資訊,請參閱 https://cloud.google.com/sql/docs/postgres/flags#postgres-l 。