You are on page 1of 7

Loading Session Statistics into a database table

Applies to:
Informatica PowerCenter

Summary
This article briefs about loading the session statistics into a database table.

Author Bio
Author(s): Sukumar Balasubramanian Company: CIBC Created on: January 11, 2010

Sukumar Balasubramanian is an experienced Informatica ETL Consultant working with CIBC, Canada.
He has good exposure to Data Integration/Data Warehousing Projects. He is also a key contributor in informatica-l group of ittoolbox

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 1

Loading Session Statistics into a database table

Table of Contents
INTRODUCTION..............................................................................................................................................3 SOLUTION OVERVIEW...................................................................................................................................4 SOLUTION STEPS...........................................................................................................................................4 SESSION1....................................................................................................................................................4 WORKFLOW VARIABLES............................................................................................................................4 ASSIGNMENT TASK....................................................................................................................................4 SESSION2....................................................................................................................................................4 PRE-Session Variable ..................................................................................................................................5 Workflow Execution.......................................................................................................................................5 ADVANTAGES ................................................................................................................................................6 DISCLAIMER AND LIABILITY NOTICE............................................................................................................7

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 2

Loading Session Statistics into a database table

INTRODUCTION
A frequent issue that a developer faces with Informatica Development is that developers won't have access to informatica repository views due to security reasons. But they need to load the session statistics such as Session Start & End Time, Success Rows, Failed Rows and Rejected Rows etc. into a database table for audit/log purpose. This article briefs about loading the session statistics into a database table using Informatica pre-defined variables.

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 3

Loading Session Statistics into a database table

SOLUTION OVERVIEW
After performing the below solution steps your end workflow will look as follows: START SESSION1 ASSIGNMENT TASK SESSION2

SOLUTION STEPS
SESSION1 This session is used to achieve your actual business logic. Meaning this session will perform your actual data load. It can be anything File Table, File File or TableTable.

WORKFLOW VARIABLES Create the following workflow variables. $$Workflowname $$SessionStartTime $$SessionEndTime $$TargetSuccessrows $$TargetFailedRows

ASSIGNMENT TASK Use the Expression tab in the Assignment Task and assign as follows: $$workflowname = $PMWorkflowName $$sessionStartTime = $ SESSION1.StartTime $$SessionEndTime = $ SESSION1.Endtime $$ TargetSuccessrows = $ SESSION1. TgtSuccessRows $$ TargetFailedRows = $ SESSION1. TgtFailedRows

SESSION2 This session is used to load the session statistics into a database table. This should call a mapping say m_sessionLog This mapping m_sessionLog should have mapping variables for the above defined workflow variables such as $$wfname, $$Stime, $$Etime, $$TSRows and $$TFRows.

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 4

Loading Session Statistics into a database table

This mapping m_sessionLog should use a dummy source and it must have a expression transformation and a target ( database Audit table) Inside the expression you must assign the mapping variables to the output ports workflowname=$$wfname starttime=$$Stime endtime=$$Etime SucessRows=$$TSRows FailedRows=$$TFRows Create a target database table with the following columns Workflowname, start time, end time, success rows and failed rows. Connect all the required output ports to the target which is nothing but your audit table.

PRE-Session Variable Session 2: In the Pre-session variable assignment tab assign the mapping variable = workflow variable In our case $$wfname=$$workflowname $$Stime=$$sessionStartTime $$Etime=$$sessionEndTime $$TSRows=$$TargetSuccessrows $$TFRows=$$TargetFailedrows

Workflow Execution Execute the workflow. 1. Session1 will achieve your business requirement. 2. Once the session is completed the assignment task will assign the session1 statistics to the appropriate workflow variables. 3. Session2 will assign the workflow variables to the mapping variables and load the session1 session stats to the audit table in your database.

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 5

Loading Session Statistics into a database table

ADVANTAGES

Pure informatica solution. No Unix/windows scripts are required for this purpose We need only one mapping to load the required session statistics into our Audit table. After each session we need to assign and call the above mapping that loads the previous session statistics into our audit table.

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 6

Loading Session Statistics into a database table

DISCLAIMER AND LIABILITY NOTICE


Informatica offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this software asset, including any liability resulting from incompatibility between the content within this asset and the materials and services offered by Informatica. You agree that you will not hold, or seek to hold, Informatica responsible or liable with respect to the content of this software asset.

Informatica Technology Network 2009 Informatica Corporation. All Rights Reserved.

http://technet.informatica.com 7