Regularly lead data from Oracle to MySQL

Source: Internet
Author: User

Due to some project requirements, it is necessary to import data from Oracle to MySQL regularly, noting that the timeliness of data is not high. Requirements high can use Goldengate


First, you need to export the Vid,userid,goodid,time4 fields from the visit table to

mydb=visit    #MySQL数据库名MYUSER =vis_my_user   #MySQL用户名MYPASS =is_my_pass  # MySQL password ora_name=visit        #Oracle实例名ORA_USER =visuser      #Oracle用户名ORA_PASS =vispass     #Oracle密码  id= ' Mysql -u$myuser -p$mypass   $MYDB  -N -e  "Select max (vid)  from visit;" ' #MySQL  -n parameter can ignore the first line of output sqlplus -s ${ora_user}/${ora_pass}@${ora_name} << eof  set echo off;set feedback off;set newpage none;set verify off; set pagesize 0;set term off;set trims on;set linesize 600;set  heading off;set timing off;set numwidth 38; spool /tmp/visit_result.txt;    #导出结果位置, the following is a query statement select          vid | |   ', '  | |          userid | |   ', '  | |          goodsid | |   ', '  | |          timefrom         Visitwhere        to_char (Time, ' YYYYMMDD ')  >= to_char ( SYSDATE-30, ' YYYYMMDD ') and         vid >  $idorder  by        CREATETIME asc; spool off;exiteofmysql -u$myuser -p$mypass  $MYDB  -e  "load data local  infile  '/tmp/visit_result.txt '  into table visit fields terminated by   ', '   (userid,goodsid,time,vid); " #此处为将Oracle数据导入MySQL


This article is from "Maple Night" blog, please be sure to keep this source http://fengwan.blog.51cto.com/508652/1892725

Regularly lead data from Oracle to MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.