17.10 - Example: Using DBC.QryLogEventHisV - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Data Dictionary

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Administration
Programming Reference
Publication ID
B035-1092-171K
Language
English (United States)

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;