Get the App
SLTechnology News&Howtos  ›  Database  › 

Introduction of Oracle data to MySQL tutorial

Shulou Source: shulou.com Published: 2022-06-01 20:34:13 10月03日 Update

The following content mainly brings you MySQL guide data to Oracle tutorials to explain, the knowledge here is slightly different from books, are professional and technical personnel in the process of contact with users, summed up, has a certain experience sharing value, hope to bring help to the majority of readers.

Due to some project requirements, the data from a single table in Oracle needs to be imported into MySQL on a regular basis. Note that the timeliness of the data is not high here. With high requirements, you can make use of goldengate.

First, you need to export the vid,userid,goodid,time4 fields in the visit table

Export ORACLE_HOME=/usr/lib/oracle/11.2/client64export TNS_ADMIN=$ORACLE_HOMEexport PATH=$PATH:$ORACLE_HOME/binexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/libexport NLS_LANG= "AMERICAN_AMERICA.UTF8" MYDB=visit # MySQL database name MYUSER=vis_my_user # MySQL username MYPASS=is_my_pass # MySQL password ORA_NAME=visit # Oracle instance name ORA_USER=visuser # Oracle username ORA_PASS=vispass # Oracle password id= `mysql-u$MYUSER-p$MYPASS $MYDB-N-e "select max (vid) from visit "`# MySQL-N parameter can ignore the first line output sqlplus-S ${ORA_USER} / ${ORA_PASS} @ ${ORA_NAME} = 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); "# here to import Oracle data into MySQL

For the above introduction of Oracle data to MySQL tutorials, if you have more information, you can continue to pay attention to the innovation of our industry. If you need professional solutions, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.

Tags: Data user tutorial major password user name knowledge different one line text book person value content parameter available in field instance technology database Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Shulou Technology OPPO Reno Shulou Information