Informatica Lab
Informatica Lab
Prerequisites:
1. Creation of User Accounts
EMP Emp
DEPT
BONUS
Source DB Target DB
Process
1. Create User in Oracle (It can be any database)
a) StartProgramOracleApplication DevelopmentSQL*PLUS
b) Login with
Username: system
Password: manager
Host String: ORCL
SQL> CREATE USER BATCH7 IDENTIFIED BY target;
SQL> GRANT DBA TO BATCH7;
SQL> CONNECT BATCH7/target@ORCL;
SQL> CREATE TABLE DIM_EMP
( EMPNO NUMBER(5) PRIMARY KEY,
ENAME VARCHAR2 (10),
SAL NUMBER(7,2),
DNO NUMBER(3) );
2. Create the ODBC connection
An ODBC is a middleware or an interface which provides an access to the databases..
StartSettingControl PanelPerformance & MaintenanceAdministrative
tools Data Source (ODBC)
For Stand alone PC set “USER DSN”
For PC on Network:-
Select SYSTEM DSN tabClickAdd
-- Now the Create New Data Source Window will appear…
Select the driver Oracle in oradb10g_home (For 9i Oracle in OraHome90)
ClickFinish
-- Now the Oracle ODBC driver Configuration window will appear…
Data Source Name: Batch7_Source_Oracle
TNS Service Name: ORCL
USER ID: scott
ClickTest connection give password (tiger)
A message will appear “CONNECTION SUCCESSFUL” It means now your user
Scott is connected through ODBC. Otherwise check the configuration setting again
and do it properly.
** One more ODBC connection required for target similarly create an ODBC
connection name with BATCH7_TARGET_ORACLE by repeating the same process
explained above but here the username will be BATCH7 which you have created with
password target.
3. Starting Services
For Starting Services you can use MSCONFIG command on RUN prompt a window
will appear in that choose services. Or you can find Services in
control panelAdministrative tool.
Start these two services:
1. Informatica orchestration server
2. Informatica services 8.6.0
4. Creation of Folder
Process
1. StartProgramInformatica PowerCenter 8.6.0PowerCenter Repository
Manager.
2. From Repository Navigator pane Select Repository (nipuna_rep)Right
Clickconnect (you can also go through the Repository menu)
3. Enter the Login Details such as username, password (Administrator,
Administrator)connect
4. Folder menuCreate
5. Enter the Folder details (Name)
** Now every thing is completed for creation of Mappings. Now follow the steps
described earlier for creating mapping.
Note: Every source table definition by default associates with source qualifier
transformation.
The source qualifier transformation prepares an SQL statement which is used for
extraction by integration service.
Step 4: Creation of Session
Process
1. Open the client workflow manager
2. ConnectRepository
3. SelectFolder(your folder from Repository pane)Tool menuTask Developer
4. Task MenuCreate
5. SelectTask type sessionEnter the nameClickCreate
6. SelectMappingOK
7. ClickDone
** Creation of Source Connection:- (This connection is required for extraction and
loading of actual data. Earlier connection ODBC which you made is only for extracting
the structure of the table.)
Connection menuRelational
FromlistOracleNewEnter the Details
Name-BATCH7PM_SRC
Username- scott
Password-tiger
Connect String-ORCL
** Similarly create target connection following the above stated process.
8. Double ClickSession(S_simplepass)Mapping tab
9. From left paneSQ_EMPSet Connection with the value which you have
created for the “Extraction” connection name
10. Repeat the processDim_employeeSet Connection
11. From propertiesset Target load type “Normal”ApplyOK
12. RepositorySave
** There is an option in the Informatica PowerCenter in which you can create the target
definition manually to the Target Database.
DFD
Emp SQ_EMP Dept = 30 Top 3 Tax (Sal*.10) T_Emp
14 Rows 14 Rows 14 (I) 6(O) 6(I) 3(O) 3(I) 3(O)
Business Logic: Calculate the Tax for top 3 employees of department number 30
Ans: First we use the Filter transformation to filter the data of department number 30
only, then Rank transformation to take the top 3 employees from department number 30
and at last Expression transformation to calculate the Tax for each employee.
Procedure
1. Create the Source Definition Emp
2. Source AnalyzerCreate Target DefinitionEmp_tax_cal
3. Create MappingName M_tax_cal Drop source & target definition onto the
mapping designer workspace.
4. Transformation Menu CreateSelect Transformation type FilterEnter the
nameCreatedone
-- Repeat the same process to add Rank & Expression Transformation.
5. From SQ_EmpCopy the required ports to the filter transformation.
6. Double clickFilter TransformationProperties tab Set
Filter Condition DEPT = 30
7. Click ApplyOk
8. From Filter Transformation copy the port to a Rank Transformation.
9. Double clickRank Transformation Port tabSet
For a port name SALRank Port
10. SelectProperties TabSet
Top/Bottom Top
Number of Ranks3
11. From Rank Transformation copy the port to an Expression Transformation.
12. Double clickExpression TransformationPort tab
13. From tool barAdd new PortSet
Port Name=Tax
Data Type=Decimal
Precision=7
Scale=2
UncheckInput Port (I)
Expression SAL * 0.15
14. Click ApplyOk
15. From Expression Transformation connect the ports to the Target Definition.
16. Repeat the process of creation of workflow and execute the workflow.
Business Logic: Calculate the total Salary Paid for each department
Ans: Sorter transformation is used for better performance of Aggregator transformation,
and grouping the data department wise, aggregator transformation aggregate the salary
(Sum) department wise. There is Dname port is in the target table but Dname is not in the
Emp table so, we used the Lookup Transformation to get the Dname from Department
table. (Emp.deptno=Dept.deptno)
Procedure
1. Create the Source and Target Definition
2. Create the mapping with name M_LKP
3. Drop the Source & Target Definitions
4. Create the Transformation type Sorter and Aggregator.
5. From SQ_EMP copy the port (Dept, Sal) to Sorter Transformation
6. Double clickSelect Port tabfor port name Deptno check, key
checkboxapplyok
7. From Sorter Transformation copy ports to aggregator transformation
8. Double click on aggregator transformationSelect port tabfor a port name
deptnocheck group by checkbox
9. From a port name SAL uncheck output port (O)
10. From toolbar add new port
Port name DataType P S I O V Expression
Sumsal decimal 7 2 √ sum(sal)
11. Select the properties tab select a sorted inputclick applyOK
12. From aggregator connects the port to the target definition.
13. Transformation menuCreatelookup transformationName
LKP_SRCCreate
14. Select the tab Sourceselect the source table Dept definition ok
15. From aggregator transformation copy the port Deptno to the lookup
transformation double click on lookup transformation
16. Select the condition tab from a toolbar click on add a new condition.
Lookup table column Operator Transformation Port
Deptno = Deptno1
17. ClickapplyOK
18. From lookup transformation connect the Dname port to the target.
19. ClickRepository menusave
20. Repeat the process of creation of session and workflow and run the workflow.
Note: - Lookup Transformation supports both Equi-Join and Non-Equijoin.
3. Joiner Transformation
DFD
Emp
-Empno Joiner
-Ename Transformation Emp_Dept
-Job
-Sal -Empno
-Deptno -Ename
-Job
Dept -Sal
-Deptno
-Deptno -Dname
-Dname -Location
-Location
Business Logic Merge the table Emp and Dept
Ans: Use Joiner transformation copy the ports from the both Emp and Dept table to
joiner transformation. Set the condition on the port which is available in both tables
just like equi-join (deptno).
Procedure
1. Create Source and Target definition
2. Create MappingNameM_DATA_JOIN
3. Drop source and Target Definition
4. Create the transformation type joiner
5. From SQ_EMP copy the following ports to the joiner transformation (Empno,
ename job, sal, deptno)
6. From SQ_DEPT copy the following ports to joiner transformation (Deptno,
Dname, Location)
7. Double click on joiner transformationCondition tabFrom toolbar Add new
condition
Master Operator Detail
Deptno1 = Deptno
8. Clickapplyok
9. From joiner transformation connect to the port to target definition.
10. Repeat the process for creating session & workflow and run the workflow
Router Transformation
Default
Business Logic: Divide the Emp table records Department wise.
Ans: For this we will use Router Transformation because this takes one input and
provides multiple outputs. Connect the target table through the every distinct department
groups of output port in the Router transformation.
Procedure
1. Create Source and Target Definition
2. Create mapping with name M_Router
3. Drag and drop the source and target definition on to the mapping designer work
space.
4. Create Router Transformation from transformation menu.
5. Copy all the port from Source Qualifier to Router transformation
6. Double click Router TransformationGroup tabAdd new Group from toolbar
Group Name Group Filter Condition
Dept 10 Deptno=10
Dept 20 Deptno=20
Dept 30 Deptno=30
7. ClickApplyOk
8. Copy ports from Dept 10 Group to Emp_dept 10 Target. (Repeat the process for
Dept 20 and Dept 30 group)
9. Click Repository menuSave
10. Repeat the process for creating session and workflow and run the workflow.
Union Transformation
Note: All the sources should have the same structure.
Business Logic: Merge two table Emp and Employees table into one table Emp_Union
Ans: For this we will use Union Transformation It takes multiple inputs and provides one
output. But the various sources should have the same structure. Connect the target table
through single output port of the Union transformation.
Procedure
1. Import metadata of Emp and Employees from source database using Source
Analyzer.
2. Create Target table Emp_Union
3. Create a mapping with the name M_Union
4. Drag and Drop the Source and Target Definition on the mapping designer
workspace.
5. Create Union Transformation with name Emp_Union
6. Double Click on Union TransformationGroup tabAdd new groupName the
group Emp and Employees
7. Group port tabAdd new port
Name Datatype Precision Scale
Empno decimal 2 0
Ename String 10 0
Job String 10 0
8. Copy ports SQ_Emp to Emp Group
9. Copy ports Employees_SQ to Employees group
10. Copy the ports from output group to target (Emp_Union)
11. Repeat the Process of creating Session and workflow and Run the workflow.
6. Repeat the process for creating session and workflow and Run the workflow.
Mapplet
A mapplet is reusable metadata object created with business logic using set of
transformation.
Procedure
1. Tool menuMapplet Designer
2. Mapplet menuCreateGive the name of the mapplet
3. Transformation menuCreateMapplet InputEnter the proper
nameCreateDone
4. Transformation menuCreateMapplet InputEnter the proper
nameCreateDone
5. Create the Filter Transformation and Expression Transformation.
6. Double ClickMapplet Input TransformationPort tabCreate desired
portsOk
For Exercise (Empno, Ename, Job, Sal, Deptno)
7. From Mapplet Input Copy the port to Filter TransformationChange the data
type, precision, Scale for the required portDefine filter condition Deptno=20
or Deptno=30
8. From Filter Transformation copy the port to expression transformation.
9. Create an output port with the name TAX, Uncheck the input port checkbox from
properties & develop the expression with the following syntax
IFF(SAL>2000, SAL*15, SAL*20)
10. From Expression Transformation copy the ports to mapplet output transformation.
11. Repository menuSave
Design a Mapping with Mapplet
Business logic: Create a mapping for extraction and loading the data from table emp for
those employee whose belongs to department number 20 or 30 and also calculate their
annual tax.
Ans: We will use mapplet that we have just created in the above exercise because we
have already implemented this business logic into creating mapplet.
Procedure
1. Create Source and Target Definition
2. Create a mapping with name M_Mapplet
3. Drop the source and target definition onto the mapping designer workspace.
4. From mapplet subfolder drag the mapplet drop beside the source qualifier.
5. From SQ_Emp connect the ports to mapplet input and from mapplet output
connect the ports to target definition.
6. Repository menuSave
7. Repeat the process for creating the workflow and Run the workflow.
Scheduling Workflow
A schedule specifies the data and time to run the workflow.
Procedure
1. From the workflow managerTool menuWorkflow DesignerCreate
Workflow
2. Select scheduler tabSelect Reusable Radio buttonSet the values for scheduler
For Run Option
Run on Integration service Initialization
Schedule option Select Run Everyday
Select End OptionForever
Set the start date and time
3. ClickApplyOk
4. Repeat the Rest of the process of creating workflow.
Direct and Indirect Communication of Integration Service with Source File type
Direct Indirect
Process
1. Source Definition Emp Table
2. Target Definition (Emp_type2) (Empkey, Empno, Ename, Sal, Version)
3. Drag and Drop the source and target definition on mapping designer workspace.
Note: Drop the Target Definition twice on the mapping designer workspace
4. Create a lookup transformation to perform a lookup on target table.
5. From SQ_Emp copy the port Empno to the lookup transformation and make it
port type input only.
6. Double click on the lookup transformationSelect the condition tabadd new
conditionSet condition as follows
Lookup table condition Operator Transformation Port
Empno = Empno1
7. Select the properties tabSet the following properties
Transformation Attribute Value
Lookup policy on multiple match Use last value
8. Create Expression Transformation
9. From SQ_Emp copy (empno, ename, sal) ports to expression transformation
10. From lookup transformation copy (empkey, sal1, version) ports to expression
transformation
11. Rename the ports which are copies from lookup transformation for better
understanding as (TRG_EMPKEY, TRG_SAL, TRG_VERSION)
12. In expression transformationCreate two output ports with name
NEW_RECORD and UPDATE_RECORD and develop the following expression
NEW_RECORD ISNULL(TRG_EMPKEY)
UPDATE_RECORD NOT ISNULL(TRG_EMPKEY) AND (SAL!=TRG_SAL)
13. ClickApplyOk
Defining New Record data flow
14. Create transformation type Filter, Sequence Generator, Expression and Update
Strategy.
15. From expression transformation copy (Empno, Ename, Sal, New_Record) ports to
Filter transformation.
16. Double clickFilter TransformationProperties Tab
Link Condition
In Sequential batch processing the session can be executed sequentially and conditionally
using link conditions.
Define the link condition using a predefined variable called PreTaskStatus
Process
1. Create three Mappings.
2. Create three Sessions S10, S20, S30
3. Create workflow and assign the session in a sequential fashion.
4. Double Click on the link between S10 and S20 sessionPredefined TabDouble
Click on PrevTaskStatus Type SUCCEEDED
$S10.PrevTaskStatus=SUCCEEDED
5. Repeat the process for S20 and S30
6. Repository menuSave
7. Repeat the process for creating workflow and execute the workflow.
Worklet
A Worklet is defined as group of task. There are two types of Worklet.
i. Reusable Worklets
ii. Non-reusable Worklets
Process
1. Reusable Worklet
1. Tool menuWorklet Designer
2. Worklet menuCreateGive the proper name
3. Drag and Drop the sessions in parallel fashion and link the sessions.
4. Create WorkflowDrop the WorkletLink the workflow and Worklet
5. Run the Workflow
2. Non-Reusable Worklet
1. Tool menuWorkflow Designer Workflow menuCreateEnter the
nameOk
2. Task menuCreateTask type “Worklet”Enter the name
3. Link Workflow and Non-Reusable Worklet
4. Select Non-Reusable WorkletRight ClickOpen Worklet Drag and
Drop the sessions in Parallel Fashion
5. Select Workflow designer toolRepository menuSave
6. Run the Workflow.
Command Task
You can specify one or more Shell command for UNIX or Dos Command for Windows
to run during workflow with the command task.
You specify the shell commands in the command task to delete, reject and copy a file etc.
Used the command task in the following ways:
1. Standalone Command Task:- Use a command task anywhere in the workflow or
worklet to run the shell commands.
2. Pre-post session shell command:- You can call the command task as the pre-post
session shell command for a session task.
You can use any valid Unix commands for Unix server and any valid dos command for
Windows server.
Control Flow
Event-Wait
Copy C:\test.txt C:\Success Success
CMD
TASK S 20
WKF S 10
CMD
TASK S 20
Event-Wait
Copy C:\test.txt C:\Fail
Fail
Prerequisite
1. Create three session
2. Create two folder in drive C:\ named Success and Failed
3. Create a blank txt file named test.txt
Procedure
1. Tool menuTask DeveloperTask menuCreate
2. Select Task type “Command”Enter the NameCreateDone
3. Double clickCmd TaskCommand tabAdd a new cmd
Name cmd
On_Success copy C:\test.txt C:\Success
4. ClickApplyok
5. Select Task type “Command”Enter the NameCreateDone
6. Double clickCmd TaskCommand tabAdd a new cmd
Name cmd
On_Failed copy C:\test.txt C:\Failed
7. Double click on the session S10 Select the Components tab
Task Type Value
Post Session Success Command Reusable On_Success
Post Session Failure Command Reusable On_Failed
8. ClickApplyOk
9. Task menuCreateEvent WaitEnter the nameCreateDone
10. Double click Success “Event Wait” TaskSelect Events tabSelect the pre-
defined event
Enter the name of the file to watch
C:\Success\test.txt
11. Select properties tabSelect delete file watch file
12. ClickApplyok
13. Make a link between tasksDefine the link condition on the link between session
S10 and Command task for success and failure as follows
$S10.PrevTaskStatus=SUCCEEDED
$S10.PrevTaskStatus=FAILED
14. Repository menuSave Execute Workflow
Event Task
S 20 Event Wait S 40
S10
Procedure
1. Create four Sessions.
2. Tool MenuWorkflow DesignerWorkflow menuCreate
3. Enter the Workflow nameEvents tabCreate new EventsEnter the Event
nameClick Ok
4. Create Workflow as shown above figureTask menuCreateSelect Task
“Decision”, “Command” and “Event Wait” CreateDone
5. Make a link between tasksDouble Click on “Decision Task” Select the
Properties tab
Attribute Value
Decision Name $ S10.Status=Succeeded AND
$S20.Status=Succeeded AND
$ S30.Status=Succeeded
6. ClickOk
7. Double ClickLink Input to “Command Task”Properties tabCreate the
Expression
Expression: $Decision .condition=True
8. Double ClickCommand TaskCommand tab
Name Command
Success copy D:\CMDTASK\RESULT.txt D:\Success
9. Double Click “Event Wait task”Predefined EventEnter the file name
D:\Success\RESULT.txt
Note: If you want to delete the watch file after complete the task. You can select the
option “Delete Watch File” From properties tab of Event wait task.
10. Repository menuSave
Timer Task
You can specify the period of time to wait before integration service runs the next task in
the workflow with the timer task.
Procedure
1. Create timer task from task menu of workflow designer.
2. Double clickTimer taskTimer tab
3. Select absolute timespecify date and timeApplyOk
$S10.Status=Succeeded
S10
WKF
Command
Task
S20 $S20.Status=Succeeded
Procedure
1. Design the workflow as shown in above figure.
2. Double clickCommand TaskGeneral tab
Treat Input Link as AND OR
3. Command TabGive the command
4. Repository menuSave
Assignment Task
You can assign a value to user defined workflow variable with the assignment task.
To use an assignment task in the workflow first create and add an assignment task to the
workflow then configure the assignment task to assign value or expression to user
defined variable.
E-mail Task
Used to send an e-mail within a workflow.
Procedure
1. Develop a workflow with e-mail task.
2. Double clickEmail taskProperties tabSet the following Attribute
Email User Name [email protected]
Email Subject Daily Load Completed
Email Text Success
3. ClickOk
4. Repository menuSave