ADJobInstance Variable

trueter (21 posts)
August 14, 2014 02:17 PM
Accepted Answer

Hi,

When I look at the value of the ADJobInstance variable, I'm not sure what it represents.  For example, it looks like this:

{7099D199-6C3C-4365-B627-AF563FC3D9D4}

 

I would have thought this value would tie back to the OID value in the executionhistoryitem table, but it doesn't seem to.  In fact, I can't figure out what it ties back to in the database.  Is there any job variable that contains the OID from the executionhistoryitem table?  It doesn't seem to be like there is.

This topic has an accepted answer. Jump to it.
Bill Staff (601 posts)
August 14, 2014 02:43 PM
Accepted Answer

This should match to the OID in ExecutionHistoryItem.

In adTempus 3 and earlier, the OID in the table will always start with "{2BABD9B0-25BA-4578-91FE-92D7ABD86CB2}:", followed by the value you're getting from the variable. So you should find a record with OID "{2BABD9B0-25BA-4578-91FE-92D7ABD86CB2}:{7099D199-6C3C-4365-B627-AF563FC3D9D4}".

In adTempus 4 and later, the class ID is gone from the table, so you would find a record with OID "{7099D199-6C3C-4365-B627-AF563FC3D9D4}"

trueter (21 posts)
August 14, 2014 02:50 PM
Accepted Answer

Thanks Bill,

That's what I figured, but both these queries return no records:

 

select *

from dbo.executionHistoryItem

where oid = '{2BABD9B0-25BA-4578-91FE-92D7ABD86CB2}:{7099D199-6C3C-4365-B627-AF563FC3D9D4}'

 

select *

from dbo.executionHistoryItem

where oid LIKE '%{7099D199-6C3C-4365-B627-AF563FC3D9D4}%'

 

Bill Staff (601 posts)
August 14, 2014 03:29 PM
Accepted Answer

I was wrong. In adTempus 4, this variable is set to the OID of the ExecutionHistoryItem as I described. In prior versions, though, it is unique but not related to anything else. It was put in there chiefly so the checkpoint utility could use it to identify the instance when calling back to adTempus.

You can find the correct ExecutionHistoryItem using the combination of the ADTJobOID and ADTInstanceID:

select * from executionhistoryitem where joboid='{1EC07219-59BE-4F02-A3BF-C7FDDA2AC982}:[ADTJobOID]' and jobinstanceid=[ADTInstanceID]

trueter (21 posts)
August 15, 2014 08:51 AM
Accepted Answer

Thanks Bill.  This works for the job instance OID.

 

Now I'm trying to get the step instance OID (the OID stored in the executionHistoryStep table) from inside a script that is run by the AdTempus step.  It doesn't seem to be populated at the time I try to receive it, though.  Basically I am getting the job instance OID, and then running this query:

 

SELECT oid

FROM adTempus_IRM_DB0.dbo.executionHistoryStep

WHERE stepOID = [ADTJobStep]

AND owner = '[JobInstanceOID_I_Just_Retrieved]'

 

Is the executionHistoryStep table not populated until the step is completed?

 

Thanks,

Tim

 

Bill Staff (601 posts)
August 15, 2014 02:13 PM
Accepted Answer

I was slightly wrong again--the ADJobOID returns the full OID, including the class ID prefix, so my previous answer should have been to use this to get the ExecutionHistoryItem:

select * from executionhistoryitem where joboid='[ADTJobOID]' and jobinstanceid=[ADTInstanceID]

With that correction, I was able to get the step record using this:

select * from executionhistorystep where stepOID='[ADTJobStep]' and owner=(select oid from executionhistoryitem where jobOID='[ADTJobOID]' and jobinstanceid=[ADTInstanceID])

 

Replies are disabled for this topic.