1. 程式人生 > >基於Oracle環境配置PowerExchange CDC

基於Oracle環境配置PowerExchange CDC

準備

PWX安裝包

安裝Lisence

安裝

PowerExchange對安裝環境有要求,低版本9.1.0不滿足在Windows Server 2012以上安裝,所以在安裝前先檢視相容列表或者先諮詢廠家。

1. 安裝PWX安裝包,安裝過程記得輸入Lisence,一步步安裝完成。

2. 在作業系統下配置環境變數

  • windows 作業系統下新增環境變數 NLS_LANG  ,值為‘SIMPLIFIED CHINESE_CHINA.ZHS16GBK’
  • linux作業系統可參考:

---------------------------------------------------------------------------------------

vim /etc/profile

# ORACLE 環境變數

export ORACLE_BASE=/oracle/oracle

export ORACLE_HOME=/oracle/oracle/product/10.2.0/db_1

export ORACLE_SID=xxx

export PATH=$PATH:$ORACLE_HOME/bin

# PWX 環境變數

export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

export PWX_HOME=/opt/Informatica/PowerExchange9.1.0

export PATH=$PWX_HOME:$PATH

----------------------------------------------------------------------------------------

3. 開啟Oracle歸檔

開啟歸檔日誌:(以下以Linux為例)

新建目錄 xxxxORACLE_HOMExxx/ARCHIVELOG ,此目錄最好開放所有許可權 R\W\X

chmod 777 xxx/ARCHIVELOG

進入sqlplus 配置歸檔

su oracle

sqlplus / as sysdba

=====================以下所有操作在sqlplus下進行=========================

由於配置的時候要操作到spfile 所以要先備份好oracle dbs 目錄下的xxx.ora 引數檔案!!!!

CONNECT SYS/CHANGE_ON_INSTALL AS SYSDBA;

ALTER SYSTEM SET log_archive_dest_1 = 'location=D:/app/Administrator/oradata/ARCHIVELOG'  SCOPE=SPFILE;  

SHUTDOWN IMMEDIATE;

STARTUP MOUNT;

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE OPEN;

SHUTDOWN IMMEDIATE;

STARTUP;

再次進入sqlplus

SQL> ARCHIVE LOG LIST

image

自動歸檔為已啟用。

4. 建立抽取日誌使用者並授權

建立使用者:

CREATE USER "ORACAPTL" PROFILE "DEFAULT" IDENTIFIED BY "oracaptl" ACCOUNT UNLOCK;

這個使用者是之後在監聽器配置下輸入的使用者名稱和密碼。

授權查詢檢視許可權:

GRANT "CONNECT","RESOURCE","DBA" TO "ORACAPTL";

GRANT LOCK ANY TABLE TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$INSTANCE" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$DATABASE" TO "ORACAPTL";

GRANT SELECT ON "SYS"."DBA_LOG_GROUPS" TO "ORACAPTL";

GRANT SELECT ON "SYS"."DBA_LOG_GROUP_COLUMNS" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$TRANSACTION" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$ARCHIVED_LOG" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$LOGMNR_CONTENTS" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$PARAMETER" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$NLS_PARAMETERS" TO "ORACAPTL";

GRANT SELECT ANY TRANSACTION TO "ORACAPTL";

GRANT EXECUTE ON "SYS"."DBMS_FLASHBACK" TO "ORACAPTL";

GRANT EXECUTE ON "SYS"."DBMS_LOGMNR_D" TO "ORACAPTL";

GRANT EXECUTE ON "SYS"."DBMS_LOGMNR" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$ARCHIVED_LOG" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$DATABASE" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$INSTANCE" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$LOG" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$LOGFILE" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$TRANSPORTABLE_PLATFORM" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$THREAD" TO "ORACAPTL";

GRANT SELECT ON "PUBLIC"."V$DATABASE_INCARNATION" TO "ORACAPTL";

GRANT ALTER ANY TABLE TO "ORACAPTL";

COMMIT;

5. 新增最小附加日誌並複製到ORACLE歸檔目錄下

新增最小附加日誌

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

COMMIT;

-- ps: 刪除附加日誌

-- select * from dba_log_groups ;

-- alter table 表名 drop supplemental log group 附加日誌名 ;

複製日誌到ORACLE歸檔目錄下

begin

SYS.DBMS_LOGMNR_D.BUILD(options => sys.dbms_logmnr_d.store_in_redo_logs);

end;

/

執行完後可以到ARCHIVELOG目錄下看是否有日誌生成。

=====================以上操作在sqlplus下執行============================

6. 配置監聽器

PWX根目錄下新建/capture 和 /capture/xtramaps 目錄

配置dbmover.cfg檔案,該檔案位於PWX安裝根目錄下,貼出參考如下

DTLMSG_CODEPAGE=GB2312

LOG_CODEPAGE=GB2312

CODEPAGE=(GB2312,GB2312,GB2312)

LISTENER=(node1,TCPIP,2480,262144,262144,262144,262144)

NODE=(local,TCPIP,127.0.0.1,2480)

NODE=(node1,TCPIP,127.0.0.1,2480,262144,262144,262144,262144)

NODE=(default,TCPIP,x,2480)

APPBUFSIZE=256000

COLON=:

CONSOLE_TRACE=N

DECPOINT=.

DEFAULTCHAR=*

DEFAULTDATE=19800101

MAXTASKS=30

MSGPREFIX=PWX

NEGSIGN=-

PIPE=|

POLLTIME=1000

PRE861_COMPAT=N

EXT_CP_SUPPT=Y

/*標記名,oracle例項名*/

ORACLEID=(PWXCDC,orcl,orcl,orcl)     

CAPI_CONNECTION=(NAME=CAPIEDP,TYPE=(UOWC,CAPINAME=CAPIORAD,RSTRADV=60))

CAPI_CONNECTION=(NAME=CAPIORAD,TYPE=(ORCL,ARRAYSIZE=1000,SELRETRY=0,ORACOLL=PWXCDC))

CAPI_CONNECTION=(NAME=CAPXSYNC,DLLTRACE=CPX,TYPE=(CAPX,DFLTINST=SYNC,FILEWAIT=60,RSTRADV=600))

/*監聽配置MAP存放的位置*/

CAPT_PATH=C:\Informatica\PowerExchange9.1.0\64\capture

CAPT_XTRA=C:\Informatica\PowerExchange9.1.0\64\capture\xtramaps

7. 啟動監聽:

管理員許可權啟動命令列  >>  dtllst node1

如果啟動成功,可以在PowerExchange Navigator下進行行測試,源端更新資料看看是否能捕捉。