真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

oracle上的數(shù)據(jù)怎么遷移到到mysql

這篇文章主要介紹“oracle上的數(shù)據(jù)怎么遷移到到MySQL”,在日常操作中,相信很多人在oracle上的數(shù)據(jù)怎么遷移到到mysql問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”oracle上的數(shù)據(jù)怎么遷移到到mysql”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

成都創(chuàng)新互聯(lián)公司主營(yíng)伍家崗網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都app軟件開發(fā),伍家崗h5微信小程序開發(fā)搭建,伍家崗網(wǎng)站營(yíng)銷推廣歡迎伍家崗等地區(qū)企業(yè)咨詢

首先在oracle端和mysql端安裝上OGG,安裝很簡(jiǎn)單,然后在oracle源端和目標(biāo)端配置好mgr(端口需要一致),然后在源端配置上抓取進(jìn)程,在目標(biāo)端配置上replicate進(jìn)程(只運(yùn)行一次即可),然后在源端使用DEFGEN命令做映射文件,并把文件傳到mysql端相應(yīng)目錄下。啟動(dòng)源端的抓取進(jìn)程即可實(shí)現(xiàn)數(shù)據(jù)庫(kù)初始化,也就完成了數(shù)據(jù)遷移。

注意事項(xiàng)和相關(guān)報(bào)錯(cuò):

1,oracle到mysql的ogg屬于異構(gòu)的ogg, 需要借助DEFGEN命令生成一個(gè)映射文件,也就是兩個(gè)表的映射關(guān)系,并把文件放到目標(biāo)端相應(yīng)位置下。否則會(huì)報(bào)錯(cuò)WARNING OGG-01194  EXTRACT task RINIG1 abended : Could not find definition for INFOSERVICE.T_MEMBER_INFO_SUM

2,在源端配置抓取進(jìn)程,需要注意的是:初始化數(shù)據(jù)庫(kù)過(guò)程需要一個(gè)的抓取進(jìn)程,之后保持?jǐn)?shù)據(jù)同步也需要一個(gè)抓取進(jìn)程,這兩個(gè)抓取進(jìn)程是有區(qū)別的,然后目的端也需要兩個(gè)replicate進(jìn)程,一個(gè)用來(lái)初始化數(shù)據(jù)庫(kù),一個(gè)用來(lái)實(shí)時(shí)同步數(shù)據(jù) 。

3,注意oracle字段默認(rèn)是區(qū)分大小寫的,但是mysql默認(rèn)是不區(qū)分的。如下:

mysql> select login_id from T_MEMBER_INFO where login_id = 'SHFRONT';

+----------+

| login_id |

+----------+

| shfront  |

| SHFRONT  |

+----------+

2 rows in set (0.81 sec)

需要這樣修改,讓mysql對(duì)大小寫敏感。

mysql> alter table T_MEMBER_INFO modify  login_id varchar(100) binary;

mysql> select login_id from T_MEMBER_INFO where login_id = 'SHFRONT';

+----------+

| login_id |

+----------+

| SHFRONT  |

+----------+

1 row in set (0.78 sec)

如果mysql的主鍵是login_id,那么可能會(huì)遇到下面這個(gè)報(bào)錯(cuò),主鍵沖突,真正的原因是:mysql字段值默認(rèn)是不區(qū)分大小寫

報(bào)錯(cuò):WARNING OGG-01004  Aborted grouped transaction on 'liuwenhe.T_MEMBER_INFO_SUM', Database error 1062 ([SQL error 1062]Duplicate entry 'shandongchaoyue' for key 'PRIMARY'

從oracle轉(zhuǎn)到MySQL的OGG,在使用mysql過(guò)程中,會(huì)遇到很多不同于oracle的問(wèn)題,初始化數(shù)據(jù)的時(shí)候總是報(bào)主鍵沖突,但是這些數(shù)據(jù)都是從同樣表結(jié)構(gòu)的oracle數(shù)據(jù)庫(kù)中導(dǎo)出來(lái)的,當(dāng)然主鍵也是一樣的。

查看了一下數(shù)據(jù)文件,發(fā)現(xiàn)存在很多數(shù)據(jù)只是大小寫不一樣,如’goolen,‘GOOLEN’,‘Goolen’這樣的數(shù)據(jù),

其實(shí)MySQL中,字段值默認(rèn)是不區(qū)分大小寫的,也就是說(shuō)插入值‘a(chǎn)bc’和'ABC‘是等價(jià)的,

下面展示具體的配置:

源端oracle 抓取進(jìn)程配置:

[oracle@master2 ggs]$ cd   /u01/OGG_linux/ggs 

[oracle@master2 ggs]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO

Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.

1,GGSCI (master2) 1>  create  subdirs  

Creating subdirectories under current directory /u01/OGG_linux/ggs

Parameter files                /u01/OGG_linux/ggs/dirprm: already exists

Report files                   /u01/OGG_linux/ggs/dirrpt: created

Checkpoint files               /u01/OGG_linux/ggs/dirchk: created

Process status files           /u01/OGG_linux/ggs/dirpcs: created

SQL script files               /u01/OGG_linux/ggs/dirsql: created

Database definitions files     /u01/OGG_linux/ggs/dirdef: created

Extract data files             /u01/OGG_linux/ggs/dirdat: created

Temporary files                /u01/OGG_linux/ggs/dirtmp: created

Stdout files                   /u01/OGG_linux/ggs/dirout: created,

2,登錄數(shù)據(jù)庫(kù) 

GGSCI (master2) 3> dblogin userid ogg,password ogg

Successfully logged into database.

3,添加需要同步的用戶到ogg

開啟scott用戶下所有表的附加日志

GGSCI (WebServer) 3> add trandata infoservice.*

2013-03-08 11:02:33  WARNING OGG-00869  No unique key is defined for table 'BONUS'.

All viable columns will be used to represent the key, but may not guarantee

uniqueness.  KEYCOLS may be used to

define the key.

Logging of supplemental redo data enabled

for table SCOTT.BONUS.

Logging of supplemental redo data enabled

for table SCOTT.DEPT.

Logging of supplemental redo data enabled

for table SCOTT.EMP.

2013-03-08 11:02:34  WARNING OGG-00869  No unique key is defined for table

'SALGRADE'. All viable columns will be used to represent the key, but may not

guarantee uniqueness.  KEYCOLS may be

used to define the key.

Logging of supplemental redo data enabled

for table SCOTT.SALGRADE.

4,GGSCI (WebServer) 4> info trandata scott.*

Logging of supplemental redo log data is

enabled for table SCOTT.BONUS.

Columns supplementally logged for table

SCOTT.BONUS: ENAME, JOB, SAL, COMM.

Logging of supplemental redo log data is

enabled for table SCOTT.DEPT.

Columns supplementally logged for table

SCOTT.DEPT: DEPTNO.

Logging of supplemental redo log data is

enabled for table SCOTT.EMP.

Columns supplementally logged for table

SCOTT.EMP: EMPNO.

Logging of supplemental redo log data is

enabled for table SCOTT.SALGRADE.

Columns supplementally logged for table

SCOTT.SALGRADE: GRADE, LOSAL, HISAL.

3,GGSCI (master2) 3>edit params mgr

PORT 7839

4,GGSCI (master2) 3> start  mgr

5,GGSCI (master2) 3>info  mgr

Manager is running (IP port

WebServer.7839).

1.抓取進(jìn)程

GGSCI (oracle3) 10>add extract  ext_1,sourceistable     ####sourceistable代表直接從表中讀取數(shù)據(jù)

GGSCI (oracle3) 10> view params ext_1

extract ext_1

setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

userid goldengate@cbl , password ogg123456

rmthost 192.168.0.12,mgrport 7839

rmttask replicat,group rinig1

table INFOSERVICE.T_MEMBER_INFO;

2.DEFGEN命令生成的映射文件。

1)創(chuàng)建DEFGEN工具的參數(shù)文件;

GGSCI (oracle3) 3> view params defgen

defsfile ./dirdef/source.def, purge

userid ogg@rman_cbl1 , password ogg

TABLE INFOSERVICE.T_PUBLISH_INFO;

TABLE INFOSERVICE.T_PUBLISH_ZBXX;

TABLE INFOSERVICE.T_MEMBER_INFO;

TABLE INFOSERVICE.T_MEMBER_INFO_FUBIAO1;

TABLE INFOSERVICE.T_MEMBER_INFO_SUM;

TABLE INFOSERVICE.T_MEMBER_MY;

TABLE INFOSERVICE.T_MEMBER_MY_INFO;

TABLE INFOSERVICE.T_PUBLISH_INFO_SUM_TONGJI;

TABLE INFOSERVICE.USER_REGIST_LS_FAIL;

TABLE INFOSERVICE.USER_REGIST_LS;

2))運(yùn)行DEFGEN工具生成數(shù)據(jù)定義文件

進(jìn)入GGSCI安裝目錄下,命令行執(zhí)行:

[oracle@oracle3 ogg]$./defgen paramfile dirprm/defgen.prm

3)把生成的文件 scp到目標(biāo)端相應(yīng)文件下:

[oracle@oracle3 ogg]scp /home/oracle/ogg/dirdef/source.def  root@192.168.0.12:/files/ogg/dirdef/source.def

目標(biāo)端:replicate 配置:

GGSCI (db2) 1> add replicat rinig1,specialrun //specialrun代表只運(yùn)行一次

注意下面的target liuwenhe.T_MEMBER_INFO

GGSCI (server02) 12> view params  rinig1

replicat rinig1

sourcecharset ZHS16GBK

setenv (NLS_LANG=AMERICAN_AMERICA.zhs16gbk)

sourcedefs ./dirdef/source.def

sourcedb infoservice,userid ogg,password ogg

discardfile ./dirrpt/rinig1.dsc,purge

map infoservice.T_MEMBER_INFO, target liuwenhe.T_MEMBER_INFO  REPERROR (1403, discard);

最后打開源端的抓取進(jìn)程即可

GGSCI (oracle3) 3>start ext_1

GGSCI (oracle3) 3> view report ext_1      ###查看輸出結(jié)果

最后可以看日志:

ogg錯(cuò)誤日志

[root@server02 dirdef]# find  / -name ggserr.log

[root@server02 dirdef]#tail -f /files/ogg/ggserr.log

總結(jié):

oracle到mysql的ogg需要借助defgen命令生成的映射文件,并把文件傳到目標(biāo)端相應(yīng)位置下,才能完成數(shù)據(jù)庫(kù)初始化,用于初始化的replicate進(jìn)程,只會(huì)運(yùn)行一次。注意字符集問(wèn)題,就是源端的抓取進(jìn)程配置的字符集和目標(biāo)端replicate配置的字符集必須是一樣的,否則可能會(huì)導(dǎo)致只導(dǎo)進(jìn)去一部分?jǐn)?shù)據(jù)。

到此,關(guān)于“oracle上的數(shù)據(jù)怎么遷移到到mysql”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!


新聞標(biāo)題:oracle上的數(shù)據(jù)怎么遷移到到mysql
網(wǎng)站URL:http://weahome.cn/article/gosejs.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部