The purpose of each of the Teradata SQL DDL statements used to enable and disable DBQL logging is described in the following table.
|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:
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';
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.