1.建立资料档案库(Migration Repository)
1.1 资料档案库用户(migrations)
-- Create the user
create user MIGRATIONS
identified by MIGRATIONS
default tablespace USERS
temporary tablespace TEMP
profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to MIGRATIONS with admin option;
grant resource to MIGRATIONS with admin option;
-- Grant/Revoke system privileges
grant alter any role to MIGRATIONS;
grant alter any sequence to MIGRATIONS;
grant alter any table to MIGRATIONS;
grant alter any trigger to MIGRATIONS;
grant alter tablespace to MIGRATIONS;
grant comment any table to MIGRATIONS;
grant create any sequence to MIGRATIONS;
grant create any table to MIGRATIONS;
grant create any trigger to MIGRATIONS;
grant create any view to MIGRATIONS;
grant create materialized view to MIGRATIONS with admin option;
grant create public synonym to MIGRATIONS with admin option;
grant create role to MIGRATIONS;
grant create session to MIGRATIONS with admin option;
grant create synonym to MIGRATIONS with admin option;
grant create tablespace to MIGRATIONS;
grant create user to MIGRATIONS;
grant create view to MIGRATIONS with admin option;
grant drop any role to MIGRATIONS;
grant drop any sequence to MIGRATIONS;
grant drop any table to MIGRATIONS;
grant drop any trigger to MIGRATIONS;
grant drop tablespace to MIGRATIONS;
grant drop user to MIGRATIONS;
grant grant any role to MIGRATIONS;
grant insert any table to MIGRATIONS;
grant select any table to MIGRATIONS;
grant unlimited tablespace to MIGRATIONS with admin option;
grant update any table to MIGRATIONS;
1.2 MIGRATIONS创建连接
1.3 关联迁移资料档案库
2.连接SqlServer
2.1 加载第三方连接库
2.2 创建sqlserver连接
3.迁移数据库
3.1 迁移数据库
3.2 步骤
选择迁移资料档案库
设置迁移的项目名及后续生成脚本的目录
选择要迁移的数据库,选择联机
选择要迁移的数据名
选择目标数据库(oracle),设置为脱机.这一步是生成用户和表结构的脚本.注:使用联机迁移会报错,不知道为什么.
数据的迁移脚本生成.设置为脱机.
提示已完成,实际并未完成.因为后面二项我们选择了.脱机方式.只生成了脚本.
4.手工执行脱机脚本
4.1 执行生成结构的脚本文件
#master.sql创建用户及表结构的脚本.sqldeveloper执行完上面的操作,将自动打开此脚本.
执行创建用户及表结构的脚本,创建的用户名与第三方数据库的名字相同.
执行完成后,可见到表及用户已创建,但表中没有数据
4.2 数据的迁移
MicrosoftSQLServer_data.bat #导出sqlserver数据的脚本
oracle_loader.bat #导入数据到oracle的脚本
进入命令行窗口
#执行数据导出脚本
MicrosoftSQLServer_data.bat 127.0.0.1 sa Fjtwkfb,要注意检查是否执行成功.
检查目录下是否有生成的数据文件
#执行数据导入脚本
oracle_loader.bat fjtw MIGRATIONS MIGRATIONS
再次查询表,可以见到已经有数据了.
参考文档:https://my.oschina.net/Rayn/blog/84800
https://blog.youkuaiyun.com/rootcn/article/details/8894130