26
MULTIPLE FILES - SINGLE TARGET TABLE-SINGLE INTERFACE Steps to use a single interface to load all the flat files of same structure into the single target table. Let's consider that you have three Flat files namely FILE1.txt,FILE2.txt and FILE3.txt to be loaded into TRG_TBL table of ORACLE database. In order to achieve this scenario, first of all you need to create a simple ODI routine to load data from FILE.txt file to TRG_TBL, by performing following steps. Go to Start > Programs > Oracle > Oracle Data Integrator > ODI Studio . Select DSBWR13 from the Login Name drop-down. Enter SUPERVISOR in the User field and password in the Password field. Click OK to login.

Multiple files single target single interface

Embed Size (px)

DESCRIPTION

Steps to use a single interface to load multiple flat files of same structure into the single target table.

Citation preview

Page 1: Multiple files single target single interface

MULTIPLE FILES - SINGLE TARGET TABLE-SINGLE INTERFACE

Steps to use a single interface to load all the flat files of same structure into the single target table.

Let's consider that you have three Flat files namely FILE1.txt,FILE2.txt and FILE3.txt to be loaded into TRG_TBL table of ORACLE database.

In order to achieve this scenario, first of all you need to create a simple ODI routine to load data from FILE.txt file to TRG_TBL, by performing following steps.

Go to Start > Programs > Oracle > Oracle Data Integrator > ODI Studio .

Select DSBWR13 from the Login Name drop-down. Enter SUPERVISOR in the User field and password in the Password field. Click OK to login.

Go to Topology Manager >> Physical Architecture >> File >> FILE_GENERIC. Right click on FILE_GENERIC and select New Physical schema. See below screen shot for more info.

Page 2: Multiple files single target single interface

Enter complete path where your data files are located under Schema and Work Schema fields and press Save button.

Page 3: Multiple files single target single interface

In topology manager, go to Logical Architecture >> File. Right click on File technology and select New Logical Schema.

Page 4: Multiple files single target single interface

Choose Physical schema under Global context.

Create new project and import LKM File to SQL and IKM SQL Control Append knowledge modules.

Now, you need to reverse engineer source file.

Insert new model.

Page 5: Multiple files single target single interface

Right click on your newly create data model and select New Datastore.

Page 6: Multiple files single target single interface

Enter details required for creating Datastore and press Save button. See below screens for more details.

Page 7: Multiple files single target single interface

Now create RDBMS schema/user by executing below SQL query.

SQL> create user ODI_MULTI_TEST identified by password default tablespace users temporary tablespace temp;

Grant privileges to ODI_MULTI_TEST user using below command.

SQL> grant connect, resource to ODI_MULTI_TEST;

Connect to SQL using this newly create user and execute following commands.

Page 8: Multiple files single target single interface

SQL> conn ODI_MULTI_TESTEnter password:Connected.SQL> CREATE TABLE SRC_FILE_DETAILS 2 ( FILE_NAME VARCHAR2(10 BYTE) 3 );

Table created.

SQL> INSERT INTO src_file_details values ('FILE1');

1 row created.

SQL> INSERT INTO src_file_details values ('FILE2');

1 row created.

SQL> INSERT INTO src_file_details values ('FILE3');

1 row created.

Create target table.

SQL> CREATE TABLE TRG_TBL ( 2 "EMPNO" NUMBER(10,0) NOT NULL, 3 "ENAME" VARCHAR2(200), 4 "JOB" VARCHAR2(200), 5 "MGR" VARCHAR2(200), 6 "HIREDATE" VARCHAR2(200), 7 "SAL" VARCHAR2(200), 8 "COMM" VARCHAR2(200), 9 "DEPTNO" VARCHAR2(200), 10 CONSTRAINT "TRG_TBL_PK" PRIMARY KEY ("EMPNO") 11 );

Table created.

Now you need to create variables by performing below steps:

In Designer panel, go to Projects >> [PROJECTNAME] >> Variables.Right click Variables and select New Variable.

See below screens for variable creation steps.

Page 9: Multiple files single target single interface
Page 10: Multiple files single target single interface

In order to create target data server, perform the below steps:

In topology manager, go to Physical Architecture >> Oracle technology. Right click on Oracle technology and select Insert Data Server.

Enter required parameters and press Save button.

Page 11: Multiple files single target single interface

Insert Physical Schema

Page 12: Multiple files single target single interface

Insert Logical Schema

Create Target Model

Page 13: Multiple files single target single interface

Reverse engineer target model.

Page 14: Multiple files single target single interface

Reverse engineering model produces below output.

Do some modifications on source (file) data store.

Replace the resource name with #Project_Name.FILE_NAME.txt

Page 15: Multiple files single target single interface

Create Interface

Page 16: Multiple files single target single interface

Create Package

Page 17: Multiple files single target single interface

Click on Diagram tab.

Drag and drop count variable under diagram section of package.

Drag and drop File_Name variable.

Page 18: Multiple files single target single interface

Drag and drop MULTITEST interface.

Page 19: Multiple files single target single interface

Drag and drop count variable

Drag and drop Files_Count variable.

Page 20: Multiple files single target single interface

Drag and drop count variable.

Now, customized your package. It should look like below screen.

Page 21: Multiple files single target single interface

Before executing package, verify that your target table is empty, by performing following steps.

In Designer, go to Model >> TRG_TBL. Right click on TRG_TBL and select View Data.

It will show you TRG_TBL table content.

Your target table is empty. Now execute the package by performing below steps.

In Designer, go to Projects >> [YOURPROJECT] >> Packages >> [YOURPACKAGE].

Right click on [YOURPACKAGE] and select execute.

Page 22: Multiple files single target single interface

You can see the result of your package execution either in Operator or by viewing data of your target table directly from Designer.

Page 23: Multiple files single target single interface

That's it, you have now successfully loaded data from multiple files to a single target table using single interface.