Skip Headers

PL/SQL Packages and Types Reference
10g Release 1 (10.1)

Part Number B10802-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

34
DBMS_FGA

The DBMS_FGA package provides fine-grained security functions.

See Also:

Oracle Database Application Developer's Guide - Fundamentals for a fuller discussion and more usage information on DBMS_FGA.

This chapter contains the following topics:


Using DBMS_FGA


Security Model

Execute privilege on DBMS_FGA is needed for administering audit policies. Because the audit function can potentially capture all user environment and application context values, policy administration should be executable by privileged users only.


Operational Notes

This package is available for only cost-based optimization. The rule-based optimizer may generate unnecessary audit records since audit monitoring can occur before row filtering. For both the rule-based optimizer and the cost-based optimizer, you can refer to DBA_FGA_AUDIT_TRAIL to analyze the SQL text and corresponding bind variables that are issued.


Summary of DBMS_FGA Subprograms

Table 34-1 DBMS_FGA Package Subprograms
Subprogram Description

ADD_POLICY Procedure

Creates an audit policy using the supplied predicate as the audit condition

DISABLE_POLICY Procedure

Disables an audit policy

DROP_POLICY Procedure

Drops an audit policy

ENABLE_POLICY Procedure

Enables an audit policy


ADD_POLICY Procedure

This procedure creates an audit policy using the supplied predicate as the audit condition. The maximum number of FGA policies on any table or view object is 256.

Syntax

DBMS_FGA.ADD_POLICY(
 object_schema   VARCHAR2, 
   object_name     VARCHAR2,    policy_name     VARCHAR2, 
   audit_condition VARCHAR2, 
   audit_column    VARCHAR2, 
   handler_schema  VARCHAR2, 
 handler_module  VARCHAR2, 
   enable          BOOLEAN, 
   statement_types VARCHAR2,
   audit_trail     BINARY_INTEGER IN DEFAULT,
   audit_column_opts BINARY_INTEGER IN DEFAULT);

Parameters

Table 34-2 ADD_POLICY Procedure Parameters
Parameter Description

object_schema

The schema of the object to be audited.

Default value: NULL. (If NULL, the current effective user schema is assumed.)

object_name

The name of the object to be audited.

policy_name

The unique name of the policy.

audit_condition

A condition in a row that indicates a monitoring condition. NULL is allowed and acts as TRUE.

Default value: NULL

audit_column

The columns to be checked for access. These can include hidden columns. The default, NULL, causes audit if any column is accessed or affected.

Default value: NULL

handler_schema

The schema that contains the event handler. The default, NULL, causes the current schema to be used.

Default value: NULL

handler_module

The function name of the event handler; includes the package name if necessary. This function is invoked only after the first row that matches the audit condition is processed in the query. If the procedure fails with exception, the user SQL statement will fail as well.

Default value: NULL

enable

Enables the policy if TRUE, which is the default.

Default value: TRUE

statement_types

The SQL statement types to which this policy is applicable: insert, update, delete, or select only.

Default value: SELECT

audit_trail

Whether to populate LSQLTEXT and LSQLBIND in fga_log$.

Default value: DB_EXTENDED

audit_column_opts

Establishes whether a statement is audited when the query references any column specified in the audit_column parameter or only when all such columns are referenced.

Default value: ANY_COLUMNS

Usage Notes

Examples

DBMS_FGA.ADD_POLICY (object_schema => 'scott', object_name=>'emp', policy_name 
=> 'mypolicy1', audit_condition => 'sal < 100', audit_column =>'comm, credit_
card, expirn_date', handler_schema => NULL, handler_module => NULL, enable => 
TRUE, statement_types=> 'INSERT, UPDATE'); 

DISABLE_POLICY Procedure

This procedure disables an audit policy.

Syntax

DBMS_FGA.DISABLE_POLICY(
 object_schema  VARCHAR2, 
   object_name    VARCHAR2,    policy_name    VARCHAR2 ); 

Parameters

Table 34-3 DISABLE_POLICY Procedure Parameters
Parameter Description

object_schema

The schema of the object to be audited. (If NULL, the current effective user schema is assumed.)

object_name

The name of the object to be audited.

policy_name

The unique name of the policy.

The default value for object_schema is NULL. (If NULL, the current effective user schema is assumed.)


DROP_POLICY Procedure

This procedure drops an audit policy.

Syntax

DBMS_FGA.DROP_POLICY(
   object_schema  VARCHAR2, 
   object_name    VARCHAR2,    policy_name    VARCHAR2 );

Parameters

Table 34-4 DROP_POLICY Procedure Parameters
Parameter Description

object_schema

The schema of the object to be audited. (If NULL, the current effective user schema is assumed.)

object_name

The name of the object to be audited.

policy_name

The unique name of the policy.

Usage Notes

The DBMS_FGA procedures cause current DML transactions, if any, to commit before the operation. However, the procedures do not cause a commit first if they are inside a DDL event trigger. With DDL transactions, the DBMS_FGA procedures are part of the DDL transaction. The default value for object_schema is NULL. (If NULL, the current effective user schema is assumed.)


ENABLE_POLICY Procedure

This procedure enables an audit policy.

Syntax

DBMS_FGA.ENABLE_POLICY(
 object_schema  VARCHAR2,
   object_name    VARCHAR2,
   policy_name    VARCHAR2,
   enable         BOOLEAN);

Parameters

Table 34-5 ENABLE_POLICY Procedure Parameters
Parameter Description

object_schema

The schema of the object to be audited. (If NULL, the current effective user schema is assumed.)

object_name

The name of the object to be audited.

policy_name

The unique name of the policy.

enable

Defaults to TRUE to enable the policy.