Multiple files single target single interface


Published on

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

Published in: Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Multiple files single target single interface

  1. 1. MULTIPLE FILES - SINGLE TARGET TABLE-SINGLE INTERFACESteps to use a single interface to load all the flat files of same structure into the single targettable.Lets consider that you have three Flat files namely FILE1.txt,FILE2.txt and FILE3.txt to beloaded 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 datafrom 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 andpassword in the Password field. Click OK to login.Go to Topology Manager >> Physical Architecture >> File >> FILE_GENERIC. Right click onFILE_GENERIC and select New Physical schema. See below screen shot for more info.
  2. 2. Enter complete path where your data files are located under Schema and Work Schema fieldsand press Save button.
  3. 3. In topology manager, go to Logical Architecture >> File. Right click on File technology andselect New Logical Schema.
  4. 4. Choose Physical schema under Global context.Create new project and import LKM File to SQL and IKM SQL Control Append knowledgemodules.Now, you need to reverse engineer source file.Insert new model.
  5. 5. Right click on your newly create data model and select New Datastore.
  6. 6. Enter details required for creating Datastore and press Save button. See below screens for moredetails.
  7. 7. Now create RDBMS schema/user by executing below SQL query.SQL> create user ODI_MULTI_TEST identified by password default tablespace userstemporary 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.
  8. 8. 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.
  9. 9. In order to create target data server, perform the below steps:In topology manager, go to Physical Architecture >> Oracle technology. Right click on Oracletechnology and select Insert Data Server.Enter required parameters and press Save button.
  10. 10. Insert Physical Schema
  11. 11. Insert Logical SchemaCreate Target Model
  12. 12. Reverse engineer target model.
  13. 13. Reverse engineering model produces below output.Do some modifications on source (file) data store.Replace the resource name with #Project_Name.FILE_NAME.txt
  14. 14. Create Interface
  15. 15. Create Package
  16. 16. Click on Diagram tab.Drag and drop count variable under diagram section of package.Drag and drop File_Name variable.
  17. 17. Drag and drop MULTITEST interface.
  18. 18. Drag and drop count variableDrag and drop Files_Count variable.
  19. 19. Drag and drop count variable.Now, customized your package. It should look like below screen.
  20. 20. 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.
  21. 21. You can see the result of your package execution either in Operator or by viewing data of yourtarget table directly from Designer.
  22. 22. Thats it, you have now successfully loaded data from multiple files to a single target table usingsingle interface.