17.00 - Example: Using DBC.QryLogEventHisV - Teradata Database

Teradata Vantage™ - Data Dictionary

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
created_date
June 2020
category
Administration
Programming Reference
featnum
B035-1092-170K

The following is an example SQL statement that demonstrates how data can be extracted from the QryLogEventHisV view to give an explanation of the expression and events which caused a RED SysCon.

WITH RECURSIVE
 CausalAnalysis(EntryTS,
         EntryKind, EntryID, EntryName, Activity, ActivityId) AS
 (
  SELECT EntryTS,
      EntryKind, EntryID, EntryName, Activity, ActivityId
  FROM DBC.QryLogEventHisV
  WHERE EntryKind = 'SYSCON'
    AND EntryName = 'RED'
    AND Activity = 'ACTIVE'
 UNION ALL
  SELECT Cause.EntryTS,
      Cause.EntryKind,
      Cause.EntryID,
      Cause.EntryName,
      Cause.Activity,
      Cause.ActivityId
  FROM CausalAnalysis Condition INNER JOIN
     DBC.QryLogEventHisV Cause
     ON Condition.EntryKind = Cause.ActivityId AND
      Condition.EntryID = Cause.ActivityId
 )
SELECT *
FROM CausalAnalysis
ORDER BY 1 DESC;