Example: Logging Requests Except for a Single User and Account - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

To log all users for SQL, but not log any requests from the myuser2 account 'marketing ' pair. If myuser2 submits a request under account 'marketing', DBQL does not log the request. However, if myuser2 logs on with account 'sales', DBQL logs the request and the system captures the SQL text for myuser2:'sales ' in DBC.DBQLSQLTbl.

To replace an existing rule for myuser2, you can either submit a REPLACE QUERY LOGGING request or submit an END QUERY LOGGING request followed by a new BEGIN QUERY LOGGING request. See REPLACE QUERY LOGGING and END QUERY LOGGING.

These two requests enable query logging with SQL for all users, but exclude requests for the myuser2:'marketing’ pair:

     BEGIN QUERY LOGGING WITH SQL ON ALL; 
     BEGIN QUERY LOGGING WITH NONE ON myuser2 ACCOUNT='marketing';

These two requests remove the rules for logging all users for SQL with the exclusion of the myuser2:'marketing’ pair:

     END QUERY LOGGING ON ALL;
     END QUERY LOGGING ON myuser2 ACCOUNT='marketing';

To replace existing rules with a new rule set, submit a REPLACE QUERY LOGGING request. See REPLACE QUERY LOGGING.