Microsoft Excel as a Source and Target as Oracle in ODI

时间:2021-04-02 11:39:37

创建测试表格和目标表

导出scott用户的emp表为EMP.xlsx作为测试的元数据,结果如下

Microsoft Excel as a Source and Target as Oracle in ODI

打开EMP.xlsx 公式→定义名称

Microsoft Excel as a Source and Target as Oracle in ODI

创建目标表(来自scott.sql)

CREATE TABLE EMP

( EMPNO NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY,

ENAME VARCHAR2(10),

JOB VARCHAR2(9),

MGR NUMBER(4),

HIREDATE DATE,

SAL NUMBER(7,2),

COMM NUMBER(7,2),

DEPTNO NUMBER(2));

定义数据源

控制面板→管理工具→数据源(ODBC)

Microsoft Excel as a Source and Target as Oracle in ODI

Microsoft Excel as a Source and Target as Oracle in ODI

双击数据源(ODBC)

Microsoft Excel as a Source and Target as Oracle in ODI

最终结果如下

Microsoft Excel as a Source and Target as Oracle in ODI

配置ODI Studio拓扑结构

上一步我们新建了数据源,现在我们使用ODI Studio创建拓扑结构

新建数据服务器:

Microsoft Excel as a Source and Target as Oracle in ODI

配置如下,并测试

Microsoft Excel as a Source and Target as Oracle in ODI

新建物理方案:

Microsoft Excel as a Source and Target as Oracle in ODI

新建逻辑方案:

Microsoft Excel as a Source and Target as Oracle in ODI

新建模型,并逆向工程

Microsoft Excel as a Source and Target as Oracle in ODI

报错

Microsoft Excel as a Source and Target as Oracle in ODI

原因:C:\WINDOWS\SysWOW64\odbcad32.exe不适odi64.exe

解决办法1:使用C:\Oracle\Middleware\Oracle_Home\odi\studio\ODI.exe

解决办法2:使用C:\Oracle\Middleware\Oracle_Home\odi\studio\ODI.exe

下载64 bit excel/access driver.并安装 下载地址 link.

(http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=13255 Microsoft Excel as a Source and Target as Oracle in ODI)

模型创建成功后,我们就可以看到EMP中的数据了

Microsoft Excel as a Source and Target as Oracle in ODI

Microsoft Excel as a Source and Target as Oracle in ODI

对目标表也进行逆向工程

Microsoft Excel as a Source and Target as Oracle in ODI

新建接口

新建接口Excel_To_Oracle

Microsoft Excel as a Source and Target as Oracle in ODI

运行

Microsoft Excel as a Source and Target as Oracle in ODI

Caused By: java.sql.SQLException: Invalid Fetch Size

this is a bug in ODI 11.1.1.5.  Oracle has provided a patch to resolve this ( patch number 13528165).

解决办法:去拓扑结构,修改数据excel数据服务器EMP的数组提取大小和批处理更新大小为0. 以前的默认值为30

Microsoft Excel as a Source and Target as Oracle in ODI

重新运行,可以发现表中已经有数据了。Microsoft Excel as a Source and Target as Oracle in ODI

说明:

时间类型的HIREDATE 有问题,做实验的时候,可以去掉该列

参考

http://dwteam.in/microsoft-excel-as-a-source-and-a-target-as-oracle-in-odi-11-1-1-6/