15.00 - Query Logging User Rules - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Query Logging User Rules

The information is this topic does not deal with the rules hierarchy (see “Hierarchy of Applying Database Query Logging Rules” on page 165), but can be helpful for understanding default accounts and DBQL rules.

Because you can log different information for different users, the system table DBC.DBQLRuleTbl is used to maintain the different logging rules for each user individually. These rules are based on the logon account string for each logged user and are maintained in cache to promote their quick access.

User access to DBC.DBQLRuleTbl is limited to the DBC.DBQLRulesV view: you cannot access either DBC.DBQLRuleTbl or DBC.DBQLRuleCountTbl directly.

Sessions are always associated with an account. At logon, the session is associated with the default account of the user who is logging on unless the startup string for that user specifies a different account assignment.

Note that DBQL searches for rules in the following order.

1 In local cache.

2 In the rules database.

Assume that user1 has a default account of abc, but is also assigned to account def.

Assume also that you have submitted the following BEGIN QUERY LOGGING requests.

     BEGIN QUERY LOGGING ON ALL ACCOUNT = 'ABC';
 
     BEGIN QUERY LOGGING WITH OBJECTS ON user1 ACCOUNT = 'def'; 

In this scenario, if a user does not specify an account string when logging on, then the system applies the ALL rule instead of the user1 rule.

 

IF user1 logs on …

THEN the following rule applies …

specifying account def

user1.

The system uses the rule specified by the following request to log the user1 queries and to log objects for those queries.

     BEGIN QUERY LOGGING WITH OBJECTS
       ON user1
       ACCOUNT = 'def';

without specifying an account

ALL.

The system uses the rule specified by the following request to log the user1 queries, but does not log object information about them.

     BEGIN QUERY LOGGING 
       ON ALL 
       ACCOUNT = 'abc';