由於oracle 12c已經是多租戶架構,在使用OGG同步的時候,需要考慮下面一些情況
- 一個 CDB包含多個PDB,源端部署的一個extract可訪問所有pdb redo,理論上不需要每個pdb單獨配置extract.
- 抽取模式只能是integrated(集成)模式,不支持claasic capture傳統方式捕獲;
- 因為要使用integrated extract,因此,需要能訪問log mining server,而這個只能從cdb$root中訪問;
- 源端要使用common user,即c##ogg這種用戶來訪問源端DB,這樣能訪問DB的redo log & all pdbs。
- 在GGSCI或參數文件中,可以使用pdb.schema.table來訪問具體的表或序列;
- 可以在參數文件 中使用sourceCatalog參數,指定一個PDB,后面的參數中只需要schema.table即可;
- 目標端每個pdb要有一個replicat進程,即一個replicat進程只能投遞到一個PDB,不能投遞到多個。
- 源端OGG用戶需要賦權:dbms_goldengate_auth.grant_admin_privilege(‘C##GGADMIN’,container=>‘all’),同時建議將ogg的用戶設置賦權為:grant dba to c##ogg container=all;
- 源端DB除了以前要打開歸檔, force logging, 最小附加日志,可能還需要打開一個開關:alter system set enable_goldengate_replication=true;
extract示例:
EXTRACT ex1 SETENV (ORACLE_SID='oradb')
userid c##ogg@oradb, password ogg
EXTTRAIL ./dirdat/lt
TABLE pdb1.schema1.table*;
SOURCECATALOG pdb2
TABLE schema2.table*;
TABLE schema3.table*;
SOURCECATALOG pdb3
TABLE schema4.table*;add extract之后,還需要
register extract ex12c database container(pdb1, pdb2, pdb3)
EXTRACT dp1
SETENV (ORACLE_SID='oradb')userid c##ogg@oradb, password oggRMTHOST orasql-test, MGRPORT 7809
RMTTRAIL ./dirdat/rt
TABLE pdb1.schema1.table*;
SOURCECATALOG pdb2
TABLE schema2.table*;
TABLE schema3.table*;
SOURCECATALOG pdb3
TABLE schema4.table*;
replicat示例:
REPLICAT rep1
SETENV (ORACLE_SID='condb2')
DBOPTIONS INTEGRATEDPARAMS(parallelism 6)
USERID C##ogg@tgt_pdb1, PASSWORD welcome1
ASSUMETARGETDEFS
MAP pdb1.schema1.table*, target schema1.table*;
MAP pdb3.schema4.table*, target schema1.table*;
sourceCatalog
MAP schema2.table*, target schema1.table*;
MAP schema3.table*, target schema1.table*;