基于Oracle环境配置PowerExchange CDC
Posted Jan丶X
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于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
自动归档为已启用。
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下进行行测试,源端更新数据看看是否能捕捉。
以上是关于基于Oracle环境配置PowerExchange CDC的主要内容,如果未能解决你的问题,请参考以下文章
Oracle 11g 基于CentOS7静默安装教程(无图形界面,远程安装)
Configuring Oracle 18c RAC Using NFS With ASM