Business Scenario:-
The scheduled data services job(especially Rapid Mart) fails with delta load due to data base connection timed out or occurrence of system resources’ dead lock.
Solution: -
Auto Rerunning of the same job with full load by triggering it from another scheduled job.
Data Services JOBS used for demonstration are as follows
Job Name | Description |
Accounts_Receivable_Load_DIMS_20_SAP | Accounts Receivable Rapid mart with DELTA load |
Accounts_Receivable_Load_DIMS_20_SAP_FULL_LOAD | Accounts Receivable Rapid mart with FULL load |
Auto_Rerun | Customized Job with script to trigger FULL load whenever DELTA load fails. |
Procedure:
- Created a project Auto_Rerun and added the above mentioned 2 rapid marts to the project.
- Created a Batch job with a workflow consisting of a script.
- Created two global variables $StatusOfJob(varchar) and $LatestJobTimestamp(varchar).
- Customized the script with the following code:-
#Recent job start time
$LatestJobTimestamp = sql('Test_AutoRerun_DS','SELECT MAX(START_TIME) FROM dbo.ALVW_HISTORY WHERE SERVICE=\'Accounts_Receivable_Load_DIMS_20_SAP\';');
PRINT('********************************************************************************************************');
PRINT('Recent timestamp of Job Accounts_Receivable_Load_DIMS_20_SAP is '||$LatestJobTimestamp);
#Recent status
$StatusOfJob = sql('Test_AutoRerun_DS','SELECT STATUS FROM dbo.ALVW_HISTORY WHERE SERVICE=\'Accounts_Receivable_Load_DIMS_20_SAP\' AND START_TIME=\'[$LatestJobTimestamp]\';');
PRINT('Status Of the JOB Accounts_Receivable_Load_DIMS_20_SAP is '||$StatusOfJob);
if ($StatusOfJob='E')
begin
Print('Job Accounts_Receivable_Load_DIMS_20_SAP had failed ');
Print('Rerunning the job Accounts_Receivable_Load_DIMS_20_SAP ......... ');
exec('C:\ProgramData\SAP BusinessObjects\Data Services\log\Accounts_Receivable_Load_DIMS_20_SAP_FULL_LOAD.bat','',8);
PRINT('********************************************************************************************************');
end
else
begin
print('Job Accounts_Receivable_Load_DIMS_20_SAP had Successfully executed');
PRINT('****************************************************************************');
end
5.Executed the job Accounts_Receivable_Load_DIMS_20_SAP (DELTA load):
6.Executed the job Auto_Rerun:
Since the DELTA load did not fail, the script did not trigger FULL load job.
7.Removed one of the mappings of query transform for DELTA load (to fail the execution):
8.Saved and executed the job with DELTA load: (DELTA load failed)
9.Executed the job Auto_Rerun:
Since the DELTA load failed, the script triggered FULL load job.
Central Management Console:
Summary:
- The JOB Accounts_Receivable_Load_DIMS_20_SAP which has DELTA load is scheduled as per the client’s schedule.
- The Job Auto_Rerun is scheduled after around an hour (compared to the scheduled time of DELTA load).
- Hence, if the DELTA job runs successfully then the Auto_Rerun job gets the status from the default repository view (dbo.ALVW_HISTORY) and as per the “if” condition mentioned, it does not trigger the FULL load.
- But when the DELTA load fails, the Auto_Rerun job gets the status from the default repository view (dbo.ALVW_HISTORY) and as per the “if” condition mentioned, it triggers the FULL load which indeed will avoid the data base connectivity or any other resource issues and data is successfully loaded into the target.
Regards,
Mubashir Hussain