zoukankan      html  css  js  c++  java
  • mysql导入数据到oracle中

    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  -uroot -pD******** -Ne "use dsideal_db; select * from gg_user;" > /usr/local/mysql/gg_user.csv

    编写sqlldr导入control文件

    复制代码
    load data
    CHARACTERSET 'UTF8'
    infile 'd:/gg_user.csv'
    replace into table GG_USER
    fields terminated by X'09'
    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='dsideal/dsideal' control='d:/ctl.ctl' log='d:/ctl.log'
  • 相关阅读:
    科学使用睡眠周期,你会比别人拥有更多时间
    遇见那个对的人,便是爱情
    因为专注,所以伟大
    从来都没有爱情发生的人生
    每天只要做好三件事就行了 积跬步以至千里
    不读书的中国人
    两性思维的差异与情侣夫妻间争吵
    结婚的意义 — 几米
    二维码工具类
    验证码图片生成工具类——Captcha.java
  • 原文地址:https://www.cnblogs.com/littlehb/p/8425929.html
Copyright © 2011-2022 走看看