Informatica Lab

download Informatica Lab

of 34

  • date post

    26-Nov-2014
  • Category

    Documents

  • view

    107
  • download

    3

Embed Size (px)

description

Steps Involved in building an ETL process… 1. Create Source Definition 2. Create Target Definition 3. Design Mapping with or without Transformation Rule 4. Create Session for each Mapping 5. Create Workflow 6. Execute Workflow Prerequisites: 1. Creation of User AccountsUsername: scott Passwor: tigerUsername: batch7 Password: targetEMP DEPT BONUSEmpSource DBTarget DBProcess 1. Create User in Oracle (It can be any database) a) StartProgramOracleApplication DevelopmentSQL*PLUS b)

Transcript of Informatica Lab

Steps Involved in building an ETL process 1. Create Source Definition 2. Create Target Definition 3. Design Mapping with or without Transformation Rule 4. Create Session for each Mapping 5. Create Workflow 6. Execute Workflow Prerequisites: 1. Creation of User Accounts

Username: scott Passwor: tiger

Username: batch7 Password: target

EMP DEPT BONUS

Emp

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 ODBCconnection 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. 2. 3. 4. 5. StartProgramInformatica PowerCenter 8.6.0PowerCenter Repository Manager. From Repository Navigator pane Select Repository (nipuna_rep)Right Clickconnect (you can also go through the Repository menu) Enter the Login Details such as username, password (Administrator, Administrator)connect Folder menuCreate Enter the Folder details (Name)

**

Now every thing is completed for creation of Mappings. Now follow the steps described earlier for creating mapping. Step 1: Creation of Source Definition A source definition is created using Source Analyzer Tool in the designer client component. Process 1. StartProgramInformatica PowerClientClientPowreCenter Designer ** Now you are at Designer component window. 2. ConnectRepositorySelect desired folder 3. Tools menuSource Analyzer 4. Sources menuImport from database ** An Import Tables window will appear Connect to the database with the following details ODBC data source- Give the connection name you had given earlier while creating your ODBC connection. Username: SCOTT Ownername: SCOTT Password: tiger Click Connect Select desired tables you want to be as a source definitionOK

Repository menuSave **Now your Source Definition has been created and saved in repository. Step 2: Create Target Definition Target Definition can be created using Target Designer Tool in the Designer client Component. Procedure 1. Tool menuTarget Designer 2. Source menuImport from database Connect to the database with following details: ODBC data source Username Password ClickConnect Select TablesOK Repository menuSave Step3: Design a mapping without Transformation Rule ** A mapping without Transformation Rule called Simple Pass Mapping. A Mapping is created using mapping designer tool. Every mapping is uniquely identified by name. Procedure 1. Tools menuMapping Designer 2. Mapping MenuCreate 3. Enter the Mapping NameOK 4. From repository navigator pane drag the source (EMP) and Target (Dim_Emp) table definition; drop on mapping designer work space. 5. From Source_Qualifier (SQ_EMP) connect column to the corresponding columns in the target table definition by just dragging. (You can also use auto connect) 6. Repository menuSave 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 NormalApplyOK 12. RepositorySave Step 5: Creation of Workflow Process 1. Tool menuWorkflow Designer 2. Workflow menuCreate 3. Enter the Workflow name (WKF_simplepass)

4. From repository Navigator window expandSession sub folderDrag the session, drop beside the workflow 5. From Task menuLink taskDrag the link from workflow, drop on session 6. Repository menuSave Step 6: Executing Workflow Process 1. Workflow menuStart Workflow

** Now Start the Workflow Monitor to view your workflow status. ** There is an option in the Informatica PowerCenter in which you can create the targetdefinition manually to the Target Database. Target DefinitionManual Approach Process 1. Tools menuTarget Designer 2. Target menuCreate 3. Enter the Target Table nameselect Database type (Oracle)CreateDone 4. Double ClickTarget DefinitionColumn Tab from toolbarAdd new column The column Structure will look like this Column name DEPTNO DNAME SUMSAL Data Type Number(p,s) Varchar2 Number(p,s) Precision 2 10 7 Scale 0 0 2 Not Null Key Type Primary key Not A key Not A key

5. ClickOkDone 6. Target menuGenerate/Execute SQL 7. ClickConnectGive the Information ODBC Data source Username Password 8. ClickConnect

9. Select Create TableGenerate/ExecuteClose

Transformation1. (Filter, Rank, Expression) DFDEmp 14 Rows SQ_EMP 14 Rows Dept = 30 14 (I) 6(O) Top 3 6(I) 3(O) Tax (Sal*.10) 3(I) 3(O) T_Emp

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. 2. Sorter, Aggregator, Lookup DFD

Lookup T/R Dept Table -Deptno -Deptname -Location

Emp -Emp -Ename -Sal -Deptno

SQ_EMP

Sorter T/R -Sal -Deptno (Key)

Aggregator T/R -Deptno -Sal (I) -Sumsal (O) -sum(Sal)

Emp_Sum -Deptno -Dname -Sumsal

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. 2. 3. 4. 5. Create the Source and Target Definition Create the mapping with name M_LKP Drop the Source & Target Definitions Create the Transformation type Sorter and Aggregator. 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