15.10 - Example: Logging Requests Except for a Single User and Account - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

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."