Search This Blog

Monday, November 8, 2010

Previous Session/Scenario/Package details in ODI ( oracle data Integrator)

odiRef.getPrevStepLog: oracle data Integrator


In this artice i will try to explain how to extract the log/details for mutiple scenarios in ODI.
What is odiRef.getPrevStepLog ?
This ODI inbuilt function helps to identify or create reports at package/scenario level.
odiRef.getPrevStepLog : Returns information about the most recently executed step in a package. The information requested is specified through the parameter. If there is no previous step (for example, if the getPrevStepLog step is executed from outside a package), the exception "No previous step" is raised. 


I will try to explain one of the scenario where it can be used.
for an example suppose I have a main package/scenario "COPY_OF_PKG_LOAD_SUZ_CORNERSTONE" which includes/calls  Scenario "COPY_OF_PKG_SUZ_ORA_PGSQL version 001".

I want to create the log for the Scenario "COPY_OF_PKG_SUZ_ORA_PGSQL version 001".
Add these codes (in the image below )in the email body ( the mail notification step which i have already posted in previous article "Email Reporting in ODI" )  or the ouput log file & add it to the main pacakage "COPY_OF_PKG_LOAD_SUZ_CORNERSTONE"



I have added these deatils in my SUCCESS & FAILURE notification email step and added it to the main package "COPY_OF_PKG_LOAD_SUZ_CORNERSTONE"



Previous Session/Scenarion/Package details


MESSAGE: <%=odiRef.getPrevStepLog("MESSAGE")%>
step name: <%=odiRef.getPrevStepLog("STEP_NAME")%>
Session No: <%=odiRef.getPrevStepLog("SESS_NO")%>
Steps Number: <%=odiRef.getPrevStepLog("NNO")%>
Step Type: <%=odiRef.getPrevStepLog("STEP_TYPE")%>
Step Begin: <%=odiRef.getPrevStepLog("BEGIN")%>
Step End: <%=odiRef.getPrevStepLog("END")%>
Step Duration: <%=odiRef.getPrevStepLog("DURATION")%>
Step Status: <%=odiRef.getPrevStepLog("STATUS")%>



MESSAGE: Error log if there is any error / or empty if COPY_OF_PKG_SUZ_ORA_PGSQL version 001 executed successfully.  Error message returned by previous step, if any. Blank string if no error.
step name:   Name of the previous step of the package "COPY_OF_PKG_SUZ_ORA_PGSQL version 001'
Session No: Session number of previous step
Steps Number:  Number of steps
Step Type:  
  • F: Interface
  • VD: Variable declaration
  • VS: Set/Increment variable
  • VE: Evaluate variable
  • V: Refresh variable
  • T: Procedure
Step Begin:  The date and time that the step began

Step End: The date and time that the step terminated
Step Duration: Time the step took to execute in seconds
Step Status: Returns the one-letter code indicating the status with which the previous step terminated. The state R (Running) is never returned.
  • D: Done (success)
  • E: Error
  • Q: Queued
  • W: Waiting
  • M: Warning



I created the Scenario for the package "COPY_OF_PKG_LOAD_SUZ_CORNERSTONE" & executed it. 
THe OUPUT of odiRef.getPrevStepLog step which i recieved through email is :



Failure loading of Package


Session Name:           COPY_OF_PKG_LOAD_SUZ_CORNERSTONE
Session Version:  002
Session No:       21768001
Context:          Development

Failure details

step name:  Execution of the Scenario COPY_OF_PKG_SUZ_ORA_PGSQL version 001
Session No: 21768001
Steps Number:     1
Step Type:  SE
Step Begin: 2010-11-08 01:57:03.644
Step End:   2010-11-08 01:57:05.84
Step Duration:    2
Step Status:      E

Error Message:    java.lang.Exception: The scenario did not end properly.
      at com.sunopsis.dwg.dbobj.SnpScen.a(SnpScen.java)
      at com.sunopsis.dwg.dbobj.SnpScen.localExecuteSync(SnpScen.java)
      at com.sunopsis.dwg.tools.StartScen.actionExecute(StartScen.java)
      at com.sunopsis.dwg.function.SnpsFunctionBaseRepositoryConnected.execute(SnpsFunctionBaseRepositoryConnected.java)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
      at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
      at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
      at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
      at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
      at com.sunopsis.dwg.cmd.e.k(e.java)
      at com.sunopsis.dwg.cmd.h.A(h.java)
      at com.sunopsis.dwg.cmd.e.run(e.java)
      at java.lang.Thread.run(Thread.java:619)


Sunday, November 7, 2010

Email Reporting in ODI ( Oracle Data Integrator)

Success/Failure Notification Of scenario/Package through Email.


I would describe how to generate scenario notification through email.
In figure below there is main package which contains two scenario's A & B and two email notifications one for success & other for failure.




Failure email notification will be generated when the execution of the main package fails & similarly the Success email notification will be generated when the package is executed successfully. 


1.Just Drag the Scenario A & B within the main package for which success/failure notification is to be sent.


2. From tool box drag the OdiSendMail & name it as SUCCESS.
3. From tool box drag the OdiSendMail & name it as FAILURE.
4. Open the properties tab of SUCCESS  add the following details.



Mail Server: 162.22.120.56
From:         ODI@gmail.com
To:                  [neeraj.singh@gmail.com]
Cc:                neeraj.singh@gmail.com
BCc:              neeraj.singh@gmail.com
Subject::  SUCESSFULLY EXECUTED:<%=odiRef.getSession( "SCEN_NAME" )%>  Load.
Attcahment: ABC.xml
Body:
Session Name: <%=odiRef.getSession( "SCEN_NAME" )%>
Session Version: <%=odiRef.getSession( "SCEN_VERSION" )%>
Session No: <%=odiRef.getSession( "SESS_NO" )%> 
Context: <%=odiRef.getSession( "CONTEXT_NAME" )%>
Session Begin: <%=odiRef.getSession("SESS_BEG")%>


4. Open the properties tab of FAILURE add the following details.



Mail Server: 162.22.120.56
From:         ODI@gmail.com
To:                  [neeraj.singh@gmail.com]
Cc:                neeraj.singh@gmail.com
BCc:              neeraj.singh@gmail.com
Subject::  FAILED :<%=odiRef.getSession( "SCEN_NAME" )%>  Load.
Body:
Session Name: <%=odiRef.getSession( "SCEN_NAME" )%>
Session Version: <%=odiRef.getSession( "SCEN_VERSION" )%>
Session No: <%=odiRef.getSession( "SESS_NO" )%> 
Context: <%=odiRef.getSession( "CONTEXT_NAME" )%>
Session Begin: <%=odiRef.getSession("SESS_BEG")%>





5. Link Scenario  "B" to the step "SUCCESS"  through the "OK" ( Next step on success) present on the upper pane 
6. Link Scenario  "B" to the step "FAILURE"  through the "KO" ( Next step on failure) present on the upper pane 




7. Now generate the scenario for the main package example "C"  with version "001".




Execute the Scenarion "C".


If it is successfully executed you will recieve the success email.






If it is failed you will recieve the Failure email.










You can add & modify the notification reports. For this you can do some tricky things
for example you do the following tasks.
can export the log through attachment.
can create the log of the previous step through "<%=odiRef.getPrevStepLog( <> )%>"
can the add the target schema & source schema deatils through


"<%=odiRef.getSchemaName("D")%>" & "<%=odiRef.getCatalogName( "D")%>"