使用Navicat工具实现oracle数据导出到mysql
oracle数据库版本:11.2.0.4
mysql版本:Server version: 5.5.60-MariaDB MariaDB Server
exp导出的离线数据一份 filename.dmp
离线dmp数据导入到新oracle数据库中
#查看离线dmp文件内容 show=y ;要使用 fromuser 和 touser 选项
[oracle@centos6_test1 ~]$ imp system show=y file=public_user_20210806_1525.dmp
Warning: the objects were exported by ADMIN, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
IMP-00031: Must specify FULL=Y or provide FROMUSER/TOUSER or TABLES arguments
IMP-00000: Import terminated unsuccessfully
#再次使用 show=y 查看文件内容,发现可以正常导入了
[oracle@centos6_test1 ~]$ imp system show=y file=public_user_20210806_1525.dmp fromuser=gabadmin touser=jia
Warning: the objects were exported by ADMIN, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing ADMIN's objects into JIA
"ALTER SESSION SET CURRENT_SCHEMA= "JIA""
"CREATE TABLE "PUBLIC_USER" ("PUBLIC_USER_ID" NUMBER(20, 0) NOT NULL ENABLE,"
" "PUBLIC_USER_NAME" VARCHAR2(30) NOT NULL ENABLE, "IDENTITY_ID" VARCHAR2(20"
# 开始导入,完成导入
[oracle@centos6_test1 ~]$ imp system file=public_user_20210806_1525.dmp fromuser=admin touser=jia
. importing ADMIN's objects into JIA
. . importing table "PUBLIC_USER" 1546070 rows imported
使用navicate工具查看oracle导入数据
查看数据表
select count(*) from jia.PUBLIC_USER; -- 1546070
创建测试表jia.users,选取部分数据
create table jia.users as
select * from jia.PUBLIC_USER where rownum<100;
select * from jia.users;
select count(*) from jia.users; --99
oracle数据导入到mysql数据库中
使用Navicate的迁移工具
缺点:字符集会有问题,在mysql中查询某些字段内容不能正常显示。所以要确保mysql中所属的数据库字符集为utf8即可
创建数据库时指定编码的两种方式:
CREATE DATABASE 数据库名 CHARACTER SET utf8 COLLATE utf8_general_ci;
create database if not exists 数据库名 default character set utf8;
查看mysql中导入成功的表
select * from USERS;
select count(*) from USERS; -- 99