Select distinct instancetime, c.name, b.resourcename, SLE.
terminationreason
from [dbo].[BPAScheduleLogEntry] AS SLE
join [BPAScheduleLog] AS SL on SLE.schedulelogid = SL.id
join [BPASchedule] AS S on S.id = SL.scheduleid
join [dbo].[BPATaskSession] b on b.taskid = sle.taskid
join BPAProcess as c on c.processid= b.processid
where SLE.terminationreason is not null and
(SLE.terminationreason like '%is too busy to run that process.%' or
SLE.terminationreason like '%No sessions were successfully created%' or
SLE.terminationreason like '%offline%' or SLE.terminationreason like '%effective%'
or SLE.terminationreason like '%Timeout expired%'
or SLE.terminationreason like '%Session creation failed%' or SLE.terminationreason
like '%Timed out%')
and instancetime between '2020-02-05 00:00:00' and '2020-02-05 23:59:59'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------schedule miss-----------------------------------
select
CASE
WHEN s.retired = 0 THEN 'Active'
WHEN s.retired = 1 THEN 'Retired'
ELSE ' '
END as 'Retired',
s.name as 'Scheduler',
t.name as 'Task',
p.name as 'Process',
ts.resourcename as 'Resource',
st.startdate as 'Start On',
CASE
WHEN st.unittype = 0 THEN 'Once'
WHEN st.unittype = 1 THEN 'Hourly'
WHEN st.unittype = 2 THEN 'Daily'
WHEN st.unittype = 3 THEN 'Weekly'
WHEN st.unittype = 4 THEN 'Monthly'
WHEN st.unittype = 5 THEN 'Yearly'
WHEN st.unittype = 6 THEN 'Minutely'
ELSE ' '
END as 'Runs',
st.period as 'Every',
c.name as 'Calendar',
ts.processparams as 'ProcessParam'
from BPASchedule s
left JOIN BPATask t on s.id = t.scheduleid
left JOIN BPATaskSession ts on t.id = ts.taskid
left JOIN BPAProcess p on ts.processid = p.processid
left JOIN BPAScheduleTrigger st on s.id = st.scheduleid
left JOIN BPACalendar c on st.calendarid = c.id
where s.name is not null and st.enddate is null
-----------------------------------------------------------------------------------
-----------to chcek active and
retired------------------------------------------------------------------------
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '2020-02-07 11:30:00' /*Change the date time here'*/
SET @EndDate = '2020-02-07 23:59:59' /*Change the date time here'*/
select a.sessionnumber, a.processname, b.description, a.startdatetime,
a.enddatetime,a.starterusername, a.runningresourcename
from BPVSessionInfo (nolock) a
left join BPAStatus (nolock) b
on a.statusid = b.statusid
left join BPASessionLog_Unicode (nolock) c
on a.sessionnumber = c.sessionnumber
where a.runningresourcename not like '%debug%'
--and a.enddatetime between cast(getdate() -1 as date) and
CAST(getdate() as date)
and a.enddatetime between @StartDate and @EndDate
group by a.sessionnumber, a.processname, b.description, a.startdatetime,
a.enddatetime,a.starterusername,a.runningresourcename
--and b.description = 'Terminated'
--and left(result, 5) = 'ERROR'
--order by 3 desc
-----------------------------------------------------------------------------------
-------------to chcek execution status-completed or
terminated--------------------------------------------------