Scenarios of Logging Accounts - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
Action Result
Submit one of the following statements:
BEGIN QUERY LOGGING ON ALL;
REPLACE QUERY LOGGING ON ALL;
System creates one rule for the user named ALL. If DBQL rule for ALL is in system, each query is logged for every user that logs on.
Submit one of the following statements:
BEGIN QUERY LOGGING ON ALL ACCOUNT = 'ABC';
REPLACE QUERY LOGGING ON ALL ACCOUNT = 'ABC';
Any user that logs on with the account string 'ABC' is logged.
Begin query logging for a specific account for a user, but the account does not exist. BEGIN QUERY LOGGING statement is accepted (accounts need not exist).

DBQLRules[V] shows rule for user, but queries run by that user are not logged, because sessions never match user/account/application triplet.

Begin query logging for a specific account (define a rule) for a user, and that user logs on under an account that does not match the rule. No rows are logged for any queries run during that session.
Log SQL for all users except specifically when user2 logs on under account 'ABC'. Submit the following statements:
BEGIN QUERY LOGGING WITH SQL ON ALL;

BEGIN QUERY LOGGING WITH NONE ON myuser2 ACCOUNT='abc';

If user2 issues query under account ABC, system does not log query. However, if user2 logs on with another account such as DEF, system logs query and DBQLSQLTbl shows SQL for user2/DEF queries.

To stop these logging rules, submit the END QUERY statement for each rule. The rule for user2 must be specifically removed with a separate END QUERY LOGGING statement:
END QUERY LOGGING ON ALL;

END QUERY LOGGING ON myuser2 ACCOUNT='ABC';
Submit the following statement:
BEGIN QUERY LOGGING WITH OBJECTS ON ALL ACCOUNT='WebQry&D&H';
A row in DBQLObjTbl and DBQLogTbl for each object for each query during each 'WebQry&D&H' session.
Submit the following statement:
BEGIN QUERY LOGGING WITH STEPINFO ON ALL ACCOUNT='$HTactQry&D&H';
A row in DBQLStepTbl and DBQLogTbl for each step of each query during each '$HTactQry&D&H' session.
Submit the following statement:
BEGIN QUERY LOGGING WITH SQL, STEPINFO, OBJECTS LIMIT THRESHOLD=3 ON ALL ACCOUNT='$LStratQry&D&H';
For each '$LStratQry&D&H' session:
  • One row of count data in DBQLSummaryTbl for all queries that completed in less than three seconds (within the 10-minute logging intervals)
  • For each query that ran longer than three seconds, one row of data is logged in DBQLSQLTbl, DBQLStepTbl, DBQLObjTbl, and DBQLogTbl
If you define more than one account string in your SQL statement, use a comma to separate the delimited list and enclose the account strings in parentheses. See BEGIN QUERY LOGGING and END QUERY LOGGING .