17.00 - 17.05 - BEGIN/REPLACE/END QUERY LOGGING Statements - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Database Administration

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
17.05
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
rgu1556127906220.ditamap
dita:ditavalPath
lze1555437562152.ditaval

The purpose of each of the Teradata SQL DDL statements used to enable and disable DBQL logging is described in the following table.

Statement Purpose
BEGIN QUERY LOGGING When submitted by a user with EXECUTE privilege on DBQLAccessMacro, this statement enables logging for the named users, accounts, and applications triplet.
Log only a maximum of:
  • 100 users
  • One user with 100 accounts
  • 100 applications

per statement. If logging is to be enabled for more than 100 users, use blocks of BEGIN QUERY LOGGING statements with 100 users each. For active sessions, logging begins when Vantage receives the next query.

You can also enable a rule to make sure no logging takes place for a user, account, or application name.

For more information, see Logging Scenarios.

REPLACE QUERY LOGGING When submitted by a user with EXECUTE privilege on DBQLAccessMacro, this statement enables logging and deletes the existing rule in the DBC.DBQLRuleTbl table if one matches the users, accounts, applications triplet, and then creates a new rule. If no rule exists, the new rule is added to the DBC.DBQLRuleTbl table.
END QUERY LOGGING When submitted by a user with EXECUTE privilege on DBQLAccessMacro, this statement stops logging for the named users, accounts, or applications. Each END QUERY LOGGING statement should list fewer than 100 users/ 100 accounts for one user/ 100 applications. DBQL calls a routine that commits the data and flushes all the DBQL caches.

Each time you issue an END QUERY LOGGING statement, the system will flush all the rules cache and will flush the DBQL data tables.

You can also flush the DBQL cache using other methods. See Options for Flushing the DBQL Cache.

For more information on END QUERY LOGGING, see Effects of Dynamically Enabling/Replacing/Disabling Logging on Current Rules.

Every BEGIN QUERY LOGGING statement you enable must be disabled using the proper END QUERY LOGGING statement syntax. For example, if you submit:

BEGIN QUERY LOGGING WITH SQL ON user1 ACCOUNT='Marketing';

you must use the following syntax to end logging for that user:

END QUERY LOGGING ON user1 ACCOUNT='Marketing';

If you list more than one account, use parentheses. For example, ACCOUNT= ('Marketing', 'Finance').

For statement syntax, see Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144. To enable other users to submit these statements, see Granting DBQL Administrative Privileges to Other Users.