Oracle Business Intelligence & Enterprise Data Warehouse Consultant à Evolutionary System Pvt. Ltd.
2 Jul 2016•0 j'aime
5 j'aime
Soyez le premier à aimer ceci
afficher plus
•3,356 vues
vues
Nombre de vues
0
Sur Slideshare
0
À partir des intégrations
0
Nombre d'intégrations
0
Publicité
Publicité
Publicité
Prochain SlideShare
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
Chargement dans ... 3
1 sur 16
Top clipped slide
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
2 Jul 2016•0 j'aime
5 j'aime
Soyez le premier à aimer ceci
afficher plus
•3,356 vues
vues
Nombre de vues
0
Sur Slideshare
0
À partir des intégrations
0
Nombre d'intégrations
0
Télécharger pour lire hors ligne
Signaler
Données & analyses
Dear All,
Hope all are doing well!
Here we are posting same model which we have posted earlier in 11g, but now we have implemented same in ODI 12C(12.2.1.0.0) with slight changes.
Please review it and Keep ODIING !!!
Thanks,
Multiple Flat Files(CSV) to Target Table in ODI12c(12.2.1.0.0)
ODI Multiple Flat Files to Table 2016
1
ODI (12.2.1.0.0)
Multiple CSV to Table via Interface with
dynamically getting of File Name with Status and
File Moved to Archive Folder
Document Made by: Darshankumar Prajapati & Ravindrakumar
Document Version: 1.0
Document Date: 02-Jul-2016
Document LastUpdated: 02-Jul-2016
ODI Multiple Flat Files to Table 2016
3
Purpose: Suppose we have multipleCSV Files,thatwe have toloadinto Single Table viaSingle
Interface,alsoFile Name musttakenDynamic;alsowe have tomake a table withFile Name’sListwith
Loadedinto Table Status alongwiththeirRecordCount.
Prerequisites : It was assumed that before this Tutorial you are able to load a Data from Flat
File to Table via Single Interface in ODI(11.2.1.0.0 or Greater).
Software and Hardware Requirements (Optional):
The followingis alistof software requirements:
The systemshouldinclude the followinginstalledproducts:
Oracle Database 11.2.1.0.0 or Greater
Oracle Data Integrator12.2.1.0.0
If notdone before,startthe servicesandcomponentsforOracle Database 11g.
Created Model:
You are goingto make thistype of Model,so eachand everycomponentcanbe explainedindetailin
below(DetailedTechnical Steps) section.
ODI Multiple Flat Files to Table 2016
4
Detailed Technical Steps:
We have to make one Package underPackagesname usedhere is:Multiple_Csv.
1) Made_List_Of_Files:
Go to Diagram Tab and Select:ODIOSCommand.
Thiswill usedforTakingAll FilesName inOne FlatFile toachieve DynamicallyGettingof File
Name.
Put BelowcommandinCommandtoExecute Tab:
dir D:ODI12SOURCEseha*.CSV /b/o:gn>D:ODI12SOURCEFILES.CSV
In case of Linux:
Cd /u01/files/
Ls > FILES.csv
In above commandassume thatOur Multiple FlatFilesSource Locationis: D:ODI12SOURCE*.*
AndWe are doingonlyListingof all filesintoFlatFile called FILES.CSV.
ScreenShotof filesinMyDirectory:
ODI Multiple Flat Files to Table 2016
5
Afterexecutingthisyouwill have thesevalues inFILES.CSV.
2) Get_File_Name:
Nowwe have to create 1 Interface,whichwillloadDatafrom above createdFile (PQ.CSV)to
Table.
For thiswe needtocreate one table like below:
CREATE TABLE FILE_LIST
(
FILENAME VARCHAR2(240 BYTE),
STATUS CHAR(1 BYTE),
RECORD_COUNT NUMBER)
Nowyouwill have tocreate On Interface inwhich FILES.CSVas a Source andFILE_LIST as
Target.
Screenshotof Interface created:
ODI Multiple Flat Files to Table 2016
6
- In Statusyoucan Hardcode ‘N’for a time.
- We will Update Record_CountLaterviaseparate procedure.
3) File_name
Nowwe needtocreate on LOCAL VARIABLEas showninBelow ScreenShots:
Thisis Refresh Variable:
Step1:
ODI Multiple Flat Files to Table 2016
7
Step2:
In thisBelowqueryisused:
selectfilename fromfile_listwhere loaded='N'
and rownum<=1
It will justgetsfile name forwhichwe are goingtoload data inTarget Table.
4) Nowwe needtohave One Mapping whichwill loadDatafromFlat File toTable.
In our case we have simplymade table same asFile,andmapeach and every column.
Step1:
ODI Multiple Flat Files to Table 2016
11
.
6) File Remainsto Process:
Nowwe needtohave one Variable whichwill countHow manyfilesare still remainstobe proceesed.
Step1:
ODI Multiple Flat Files to Table 2016
12
Step2:
QueryUsed:
selectcount(filename) fromfile_listwhere loaded='N'
Step3:
ODI Multiple Flat Files to Table 2016
13
7) Moving_files_to_Archive:
Nowwe needtoMove thisprocessedflatfile toArchive Directory.
For thiswe needtouse “ODIFILEMOVE” as below:
Step1:
Step2:
8) File_remains_to_Process:
Nowwe need tocross check How Many Filesare Still RemainstoLoad.
For thiswe needtoReuse Variable File_remains_to_Process asEVALUATEVARIBALEasshownbelow:
So itwill be automaticallystoppedwhenFile_CountNOT>0.
ODI Multiple Flat Files to Table 2016
14
So at the endYou have createdthe below Model.
Afterrunningof thisProcedure youcan checkfile statusinFILELIST_STATUSTable as below:
You can cross checknow FilesSuccessfullymovedtotargetdirectory:
ODI Multiple Flat Files to Table 2016
15
You can cross checkRecord Countinyour Final Table inwhichyouhave loadedData.
Summary:
In thistutorial,youhave learnedhowto:
Verifythe Prerequisites.
Create one ODI_OS_COMMAND forjustlistingof youall flatfliesintoSingle FlatFile.
Create a NewODI Model forthe FlatFile Source toTarget Database Table.
Create a NewODI Source Datastore for Use withODI Interface
Create a NewODI TargetDatastore forUse withODI Interface
Create a Variable forFile_remains_to_Process,File_Name.
Create a Mapping whichwill LoadData fromFlatfile toOracle Table.
Create a procedure whichwill UpdatesaFile Status inTable alongwithRecordCount.
Create a ODI_FILE_MOVE for movingyourprocessedfile toARCHIVEDirectory.
ODI Multiple Flat Files to Table 2016
16
Hope you have understoodwhich we have developedwiththe helpof thisdocument.
Hope you have learnednewthings,if youhave done somethinglikethis,please share iton
darshanprajapati@ymail.com andravindra_kumar67@rediffmail.com .
THANKYOU ! KEEP ODIING!!!!