目录
一、设置归档文件路径及开启附加日志
源端Oracle:
设置归档文件路径
alter database archivelog;
alter system set db_recovery_file_dest='';
alter system set log_archive_dest='/ora/oracle/product/11.2.0/db_1/archlog';
alter database open;
开启附加日志
select SUPPLEMENTAL_LOG_DATA_MIN min, SUPPLEMENTAL_LOG_DATA_PK pk, SUPPLEMENTAL_LOG_DATA_FK fk, SUPPLEMETAL_LOG_DATA_ALL "all" from v$database;
alter database add supplemental log data;
alter database add supplemental log data (all) columns;
select supplemental_log_data_min,supplemental_log_data_all from v$database;
目的端dm8:
开启归档
alter database mount;
alter database archivelog;
alter database open;
select arch mode from v$database;
开启逻辑日志
SELECT PARA_VALUE FROM SYS.V$DM_INI WHERE PARA_NAME = 'RLOG_APPEND_LOGIC';
SP_SET_PARA_VALUE(2, 'RLOG_APPEND_LOGIC',1);
alter system set 'RLOG_APPEND_LOGIC'=1 both;
SELECT PARA_VALUE FROM SYS.V$DM_INI WHERE PARA_NAME = 'RLOG_APPEND_LOGIC';
SELECT PARA_VALUE FROM SYS.V$DM_INI WHERE PARA_NAME = 'FAST_COMMIT';
二、创建用户及授权
源端Oracle:
创建用户及授权
create user DMHS identified by "DMHS" default tablespace USERS temporary tablespace TEMP profile DEFAULT;
grant connect to DMHS;
grant select any table to DMHS;
grant select any dictuonary to DMHS;
grant create session to DMHS;
grant lock any table to DMHS;
grant execute on dbms_flashback to DMHS;
grant unlimited tablespace to DMHS;
目的端DM8:
创建同步用户
create user DMHS identified by "DMHS_1234" default tablespace MAIN temporary tablespace TEMP;
grant resource to DMHS;
grant select any table to DMHS;
grant dba to DMHS;
grant unlimited tablespace to DMHS;
三、配置ODBC
源端oracle11g:
安装odbc
yum -y install unixODBC unixODBC-devel
odbcinst -j
vim /etc/odbcinst.ini
[Oracle in OraDb11g_home1]
Description = Oracle ODBC driver for Oracle 11g
Driver = /ora/oracle/product/11.2.0/db_1/lib/libsqora.so.11.1
Threading = 0
vim /etc/odbc.ini
[ORACLE]
Description = Oracle ODBC driver for Oracle 11g
Driver= Oracle in OraDb11g_home1
SERVER = 192.168.208.43
ServerName = ORCL
UserID = DMHS
Password = DMHS
Port = 1521
检查是否缺依赖
ldd /ora/oracle/product/11.2.0/db_1/lib/libsqora.so.11.1
缺少libodbcinst.so.1
find / -name libodbcinst*
选择一个将其拷贝到数据库的lib目录下
cp /usr/lib64/libodbcinst.so.2 /ora/oracle/product/11.2.0/db_1/lib/libodbcinst.so.1
使用odbc连接Oracle数据库
isql -v ORACLE
四、配置DMHS 的配置文件
目的端dm8:
vim /dmdata/dmhs/bin/dmhs.hs
<?xml version="1.0" encoding="GB2312"?>
<dmhs>
<base>
<lang>en</lang>
<mgr_port>5345</mgr_port>
<chk_interval>2</chk_interval>
<ckpt_interval>45</ckpt_interval>
<siteid>4</siteid>
<version>2.0</version>
</base>
<exec>
<recv>
<data_port>5346</data_port>
</recv>
<db_type>dm8</db_type>
<db_server>192.168.208.42</db_server>
<db_user>DMHS</db_user>
<db_pwd>DMHS_1234</db_pwd>
<db_port>5236</db_port>
<char_code>PG_UTF8</char_code>
<db_name></db_name>
<exec_thr>2</exec_thr>
<exec_sql>1024</exec_sql>
<exec_trx>2000</exec_trx>
<exec_rows>2000</exec_rows>
<msg_col_size>30000</msg_col_size>
<ddl_continue>1</ddl_continue>
<affect_row>0</affect_row>
<exec_policy>2</exec_policy>
<enable_rowid>0</enable_rowid>
<clear_trx_file>1</clear_trx_file>
<trx_max_file>8</trx_max_file>
</exec>
</dmhs>
源端Oracle
dmhs.hs
vim /home/oracle/dmhs/release/dmhs.hs
<?xml version="1.0" encoding="GB2312"?>
<dmhs>
<base>
<lang>en</lang>
<mgr_port>5345</mgr_port>
<ckpt_interval>60</ckpt_interval>
<siteid>1</siteid>
<version>2.0</version>
</base>
<cpt>
<db_type>oracle11g</db_type>
<db_server>orcl</db_server>
<db_user>DMHS</db_user>
<db_pwd>DMHS</db_pwd>
<ddl_mask>op:obj</ddl_mask>
<char_code>PG_UTF8</char_code>
<arch>
<clear_interval>600</clear_interval>
<clear_flag>0</clear_flag>
</arch>
<send>
<ip>192.168.208.42</ip>
<mgr_port>5345</mgr_port>
<data_port>5346</data_port>
<filter>
<enable>
<item>DMHS.*</item>
</enable>
<disable>
</disable>
</filter>
<map>
</map>
</send>
</cpt>
</dmhs>
五、源端创建测试表
create table t1(id number);
insert into t1 values(1);
commit;
六、进行初始装载
目的端开启服务
cd /dmdata/dmhs/bin
./dmhs_server dmhs.hs
另起一个窗口
./dmhs_console
start exec
进行初始字典装载,开启增量同步
clear exec lsn
COPY 0 "SCH.NAME='DMHS' CREATE|INSERT|THREAD|2
start cpt
源端插入数据,查看目的端数据
源端:
select * from t1;
insert into t1 values(2);
commit
目的端:
select * from t1;
更多资讯请到达梦社区地址了解: