码迷,mamicode.com
首页 > 数据库 > 详细

mysql导入数据到oracle中

时间:2016-06-22 00:12:34      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

mysql导入数据到oracle中。

建立Oracle表:

CREATE TABLE "GG_USER" (
  "USERID" VARCHAR2(255 BYTE) NOT NULL,
  "ISPART" VARCHAR2(255 BYTE) DEFAULT NULL,
  "ACTUALPOSITIONID" NUMBER(11) DEFAULT NULL,
  "BEGINWORKTIME" TIMESTAMP(0) DEFAULT NULL,
  "BIRTHDAY" TIMESTAMP(0) DEFAULT NULL,
  "CARDNO" VARCHAR2(255 BYTE) DEFAULT NULL,
  "EMAIL" VARCHAR2(255 BYTE) DEFAULT NULL,
  "GENDERID" NUMBER(11) DEFAULT NULL,
  "HEALTHID" NUMBER(11) DEFAULT NULL,
  "HOME" VARCHAR2(255 BYTE) DEFAULT NULL,
  "IDENTIFY" VARCHAR2(255 BYTE) DEFAULT NULL,
  "LEAVEREASONID" NUMBER(11) DEFAULT NULL,
  "LEAVETIME" TIMESTAMP(0) DEFAULT NULL,
  "MOBILEPHONE" VARCHAR2(255 BYTE) DEFAULT NULL,
  "OFFICE" VARCHAR2(255 BYTE) DEFAULT NULL,
  "ORGID" VARCHAR2(255 BYTE) DEFAULT NULL,
  "ORGNAME" VARCHAR2(255 BYTE) DEFAULT NULL,
  "PASSWORD" VARCHAR2(255 BYTE) DEFAULT NULL,
  "POSITIONID" NUMBER(11) DEFAULT NULL,
  "REACHTIME" TIMESTAMP(0) DEFAULT NULL,
  "SORTSNO" NUMBER(11) DEFAULT NULL,
  "USERIMG" VARCHAR2(255 BYTE) DEFAULT NULL,
  "USERNAME" VARCHAR2(255 BYTE) DEFAULT NULL,
  "WORKSTATUSID" NUMBER(11) DEFAULT NULL,
  "STATUS" NUMBER(11) DEFAULT NULL,
  "CERTYPEID" NUMBER(11) DEFAULT NULL,
  "MINZUID" NUMBER(11) DEFAULT NULL,
  "PERSONID" VARCHAR2(255 BYTE) DEFAULT NULL,
  PRIMARY KEY ("USERID")
)

执行mysql数据导出命令:

mysql -h172.166.230.229 -uread -p -Ne "use gguser; select* from gg_user;" > /tmp/test.sql

编写sqlldr导入control文件

load data
CHARACTERSET UTF8
infile /tmp/test.sql
replace into table PALACE.GG_USER
fields terminated by X09
optionally enclosed by "
(USERID NULLIF(USERID=NULL) ,ISPART NULLIF(ISPART=NULL) ,ACTUALPOSITIONID NULLIF(ACTUALPOSITIONID=NULL) ,BEGINWORKTIME  timestamp "yyyy-mm-dd" NULLIF(BEGINWORKTIME=NULL) ,BIRTHDAY timestamp "yyyy-mm-dd" NULLIF(BIRTHDAY=NULL) ,CARDNO NULLIF(CARDNO=NULL) ,EMAIL NULLIF(EMAIL=NULL) ,GENDERID NULLIF(GENDERID=NULL) ,HEALTHID NULLIF(HEALTHID=NULL) ,HOME NULLIF(HOME=NULL) ,IDENTIFY NULLIF(IDENTIFY=NULL) ,LEAVEREASONID NULLIF(LEAVEREASONID=NULL) ,LEAVETIME  timestamp "yyyy-mm-dd" NULLIF(LEAVETIME=NULL) ,MOBILEPHONE NULLIF(MOBILEPHONE=NULL) ,OFFICE NULLIF(OFFICE=NULL) ,ORGID NULLIF(ORGID=NULL) ,ORGNAME NULLIF(ORGNAME=NULL) ,PASSWORD NULLIF(PASSWORD=NULL) ,POSITIONID NULLIF(POSITIONID=NULL) ,REACHTIME timestamp "yyyy-mm-dd" NULLIF(REACHTIME=NULL) ,SORTSNO NULLIF(SORTSNO=NULL) ,USERIMG NULLIF(USERIMG=NULL) ,USERNAME NULLIF(USERNAME=NULL) ,WORKSTATUSID NULLIF(WORKSTATUSID=NULL) ,STATUS NULLIF(STATUS=NULL) ,CERTYPEID NULLIF(CERTYPEID=NULL) ,MINZUID NULLIF(MINZUID=NULL) ,PERSONID NULLIF(PERSONID=NULL))

执行sqlldr导入操作

./sqlldr userid=username/pwd control=/tmp/ctl.ctl log=/tmp/ctl.log

mysql导入数据到oracle中

标签:

原文地址:http://www.cnblogs.com/dorothychai/p/5605278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!