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 -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 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='username/pwd' control='/tmp/ctl.ctl' log='/tmp/ctl.log'
  • 相关阅读:
    20、Windows API 进程间通信,邮槽(Mailslot)
    15、Windows API 线程同步
    11、Windows API 内存管理(1)
    17、Windows API 图形用户界面(1)
    16、Windows API 服务
    12、Windows API 内存管理(2)
    19、Windows API 系统信息
    Oracle: 四、Oracle连接查询,子查询(相关子查询,嵌套子查询)(下)
    OpenSource: “一个开源的留言系统”,欢迎加入,共同开发
    Oracle: 四、对scott用户的基本查询操作(上篇)
  • 原文地址:https://www.cnblogs.com/dorothychai/p/5605278.html
Copyright © 2011-2022 走看看