Friday, November 29, 2019

Unable to open session logs from Load plan executed in ODI 11g

 Hello there,

I have faced this strange issue which is related to ODI 11g navigation and would like to discuss about the fix that we used in our Linux environment.

We have been using ODI 11g since 5 years and as the days pass by the no of jobs and no of loadplans got increased dramatically and hence the session logs sequence number is very high.

Basically the difficulty here will be from the operations team where they have to filter the logs and check the errors (Time consuming task) rather than directly opening the errored session log from the load plan.

Issue and cause:- ODI 11g has a bug where if the sequence generator of the session logs reach to certain threshold then the link between session logs and executed loadploan will break and you wont be able to open the session logs from the load plans.

Fix:- The sequence generators of various elements will be stored in SNP_ID table of the work repository so we need to rest the SNP_SESSION element in the table.

1) Take backup of your work repository.
2) Shut down all ODI services and Agents (Standalone if any).
3) Make sure there are no running sessions in the repository.
4) Purge all logs from the work repository with scenario reports. make sure there are no abandoned sessions left.
5) Connect to work repository and execute the below queries just to make sure all session logs are purged.

##########################################################################


update snp_id set id_next = 1 where id_tbl = 'SNP_SESSION';


/* >>> Delete all the Session-related records, using a combination of DELETE and TRUNCATE SQL commands. <<< */

/* Naming conventions used in this script:
 *
 *   PRD_BIA_ODIREPO is the name of the Work Repository Schema.
 *
 * Replace in this document all the occurrences of PRD_BIA_ODIREPO with the name of schema containing the Work Repository tables.
 */

 /*
 * 0. First switch off the AutoCommit mode
 */
    set autocommit off ;

/*
 * 1. Delete Session parameters and messages
 */

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_TASK_MESS from PRD_BIA_ODIREPO.SNP_SESS_TASK_LOG) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_STEP_MESS from PRD_BIA_ODIREPO.SNP_STEP_LOG) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_VAR from PRD_BIA_ODIREPO.SNP_VAR_SESS) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_DEF_T from PRD_BIA_ODIREPO.SNP_VAR_SESS) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_SESS_PARAMS from PRD_BIA_ODIREPO.SNP_SESSION) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_SESS_MESS from PRD_BIA_ODIREPO.SNP_SESSION) ;
     
/*
 * 2. Delete Session Header parameters and messages
 */
    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_TASK_MESS from PRD_BIA_ODIREPO.SNP_SESS_TASK_LOG) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_STEP_MESS from PRD_BIA_ODIREPO.SNP_STEP_LOG) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_VAR from PRD_BIA_ODIREPO.SNP_VAR_SESS) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_DEF_T from PRD_BIA_ODIREPO.SNP_VAR_SESS) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_SESS_PARAMS from PRD_BIA_ODIREPO.SNP_SESSION) ;

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_SESS_MESS from PRD_BIA_ODIREPO.SNP_SESSION) ;
     
/*
 * 3. Delete Session execution reports
 */

    /* (a). Deactivate the constraints */
    alter table PRD_BIA_ODIREPO.SNP_SESS_TXT_LOG disable constraint FK_SESS_TXT_LOG ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK_LS disable constraint FK_SESS_TASK_LS ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK_LS disable constraint FK_SESS_LS_SEQ ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK_LOG disable constraint FK_SESS_TASK_LOG ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_STEP_LV disable constraint FK_SESS_STEP_LV ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_STEP_LV disable constraint FK_SESS_LV_VAR ;
    alter table PRD_BIA_ODIREPO.SNP_STEP_LOG disable constraint FK_STEP_LOG ;
    alter table PRD_BIA_ODIREPO.SNP_TASK_TXT disable constraint FK_TASK_TXT ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK disable constraint FK_SESS_TASK ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_STEP disable constraint FK_SESS_STEP ;
    alter table PRD_BIA_ODIREPO.SNP_SEQ_SESS disable constraint FK_SEQ_SESS ;
    alter table PRD_BIA_ODIREPO.SNP_VAR_SESS disable constraint FK_VAR_SESS ;
    alter table PRD_BIA_ODIREPO.SNP_PARAM_SESS disable constraint FK_PARAM_SESS ;

    /* (b). Delete */
    truncate table PRD_BIA_ODIREPO.SNP_SESS_TXT_LOG ;
    truncate table PRD_BIA_ODIREPO.SNP_SESS_TASK_LS ;
    truncate table PRD_BIA_ODIREPO.SNP_SESS_TASK_LOG ;
    truncate table PRD_BIA_ODIREPO.SNP_SESS_STEP_LV ;
    truncate table PRD_BIA_ODIREPO.SNP_STEP_LOG ;
    truncate table PRD_BIA_ODIREPO.SNP_TASK_TXT ;
    truncate table PRD_BIA_ODIREPO.SNP_SESS_TASK ;
    truncate table PRD_BIA_ODIREPO.SNP_SESS_STEP ;
    truncate table PRD_BIA_ODIREPO.SNP_SEQ_SESS ;
    truncate table PRD_BIA_ODIREPO.SNP_VAR_SESS ;
    truncate table PRD_BIA_ODIREPO.SNP_PARAM_SESS ;   
    truncate table PRD_BIA_ODIREPO.SNP_SESSION ;
   
    /* (c). Reactivate the constraints */
    alter table PRD_BIA_ODIREPO.SNP_SESS_TXT_LOG enable constraint FK_SESS_TXT_LOG ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK_LS enable constraint FK_SESS_TASK_LS ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK_LS enable constraint FK_SESS_LS_SEQ ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK_LOG enable constraint FK_SESS_TASK_LOG ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_STEP_LV enable constraint FK_SESS_STEP_LV ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_STEP_LV enable constraint FK_SESS_LV_VAR ;
    alter table PRD_BIA_ODIREPO.SNP_STEP_LOG enable constraint FK_STEP_LOG ;
    alter table PRD_BIA_ODIREPO.SNP_TASK_TXT enable constraint FK_TASK_TXT ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_TASK enable constraint FK_SESS_TASK ;
    alter table PRD_BIA_ODIREPO.SNP_SESS_STEP enable constraint FK_SESS_STEP ;
    alter table PRD_BIA_ODIREPO.SNP_SEQ_SESS enable constraint FK_SEQ_SESS ;
    alter table PRD_BIA_ODIREPO.SNP_VAR_SESS enable constraint FK_VAR_SESS ;   
    alter table PRD_BIA_ODIREPO.SNP_PARAM_SESS enable constraint FK_PARAM_SESS ;
     
/*
 * 4. Delete Scenario associated messages
 */
    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_STEP_MESS from PRD_BIA_ODIREPO.SNP_STEP_REPORT) ;   

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT where I_TXT in
    (select I_TXT_SESS_MESS from PRD_BIA_ODIREPO.SNP_SCEN_REPORT) ;   
     
 /*
 * 5. Delete Scenario Header associated messages
 */
    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_STEP_MESS from PRD_BIA_ODIREPO.SNP_STEP_REPORT) ;   

    delete from PRD_BIA_ODIREPO.SNP_EXP_TXT_HEADER where I_TXT in
    (select I_TXT_SESS_MESS from PRD_BIA_ODIREPO.SNP_SCEN_REPORT) ;   
     
 /*
 * 6. Delete Scenario associated reports
 */
    /* (a). Deactivate the constraints */
    alter table PRD_BIA_ODIREPO.SNP_STEP_REPORT disable constraint FK_STEP_REPORT ;
   
    /* (b). Delete */
    truncate table PRD_BIA_ODIREPO.SNP_STEP_REPORT ;
    truncate table PRD_BIA_ODIREPO.SNP_SCEN_REPORT ;

    /* (c). Reactivate the constraints */
    alter table PRD_BIA_ODIREPO.SNP_STEP_REPORT enable constraint FK_STEP_REPORT ;
   
/*
 * 7. Commit the changes
 */
    commit ;



#######################################################################
 

Clear  tmp and Cache folders in ODI server paths, after restart the ODI server will create new TMP folders  automatically.

Now you can start back your ODI services and Agents and you can test by triggering a new load plan.
You willsee the sessions will start with 2.... and now you will be able to open the session logs directly from the executed load plans.

Oracle reference:-
Unable to Open The Scenario Object Using The Link Of The Execution Session ID From Load Plan Session Log In ODI Studio Operator (Doc ID 2222817.1 )


       How To Manually Delete ODI 10g And 11g Sessions And Scenario-Related Reports (Doc ID 424740.1)
 

K@run@

2 comments:

  1. You need to purge logs periodically to avoid the issue

    ReplyDelete
    Replies
    1. No purging the logs will not fix the threshold of log sequence, for sure need to follow the above fix for ODI.

      Delete