16.10 - BEGIN/REPLACE/END QUERY LOGGING Statements - Teradata Database

Teradata Database Administration

Product
Teradata Database
Release Number
16.10
Published
April 2018
Content Type
Administration
Publication ID
B035-1093-161K
Language
English (United States)
Last Update
2018-04-26

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 Teradata Database 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 SQL Data Definition Language. To enable other users to submit these statements, see Granting DBQL Administrative Privileges to Other Users.