3.6 Creating and Managing Multiple Named Policy Expressions
A named, centrally managed Oracle Data Redaction policy expression can be used in multiple redaction policies and applied to multiple tables or views.
- About Data Redaction Policy Expressions to Define Conditions
A Oracle Data Redaction named policy expression is designed to work as an alternative to the policy expression that is used in existing Data Redaction policies. - Creating and Applying a Data Redaction Named Policy Expression
TheDBMS_REDACT.CREATE_POLICY_EXPRESSIONandDBMS_REDACT.APPLY_POLICY_EXPR_TO_COLenable you to create and apply a Data Redaction named policy expression. - Updating a Data Redaction Named Policy Expression
You can use theDBMS_REDACT.UPDATE_POLICY_EXPRESSIONprocedure to update a Data Redaction named policy expression. The update takes place immediately and is reflected in all the columns that use the named policy expression. - Dropping a Data Redaction Named Policy Expression
You can use theDBMS_REDACT.DROP_POLICY_EXPRESSIONprocedure to drop a Data Redaction named policy expression. - Tutorial: Creating and Sharing a Data Redaction Named Policy Expression
This tutorial shows how to create an Oracle Data Redaction named policy expression, apply it to multiple tables, and centrally manage the named policy expression.
Parent topic: Configuring Oracle Data Redaction Policies
3.6.1 About Data Redaction Policy Expressions to Define Conditions
A Oracle Data Redaction named policy expression is designed to work as an alternative to the policy expression that is used in existing Data Redaction policies.
A policy expression enables you to redact data based on runtime conditions. This type of policy expression can affect whether or not redaction takes place on columns of the table or view on which the redaction policy is defined. By default, a Data Redaction policy expression applies to all the columns that belong to the Data Redaction policy defined on that table or view. Alternatively, you can choose to create and associate a policy expression for individual columns of a table or view. These column level policy expressions are called named policy expressions. The column to which you apply a named policy expression must already be redacted by a Data Redaction policy.
You can use Data Redaction named policy expressions in the following ways:
-
Each named policy expression can be associated with multiple columns of the same or different tables or views.
-
Each named policy expression can be associated with columns within the same or different Data Redaction policies.
-
The named policy expression overrides the default policy expression of the associated columns. The default policy expression still applies to columns that have no named policy expressions applied to them.
-
Any updates made to a named policy expression apply to all of the column associations of the expression.
-
You cannot associate multiple named policy expressions for the same column.
- You cannot associate named policy expressions with columns in a different pluggable database (PDB).
Table 3-8 describes the DBMS_REDACT PL/SQL procedures that you can use to create and manage named policy expressions. To find information about policy expressions, query the REDACTION_EXPRESSIONS data dictionary view.
Table 3-8 DBMS_REDACT Policy Expression Procedures
| Procedure | Description |
|---|---|
|
|
Creates a Data Redaction named policy expression |
|
|
Updates a Data Redaction named policy expression |
|
|
Applies a Data Redaction named policy expression to a table or a view column |
|
|
Drops a Data Redaction named policy expression |
3.6.2 Creating and Applying a Data Redaction Named Policy Expression
The DBMS_REDACT.CREATE_POLICY_EXPRESSION and
DBMS_REDACT.APPLY_POLICY_EXPR_TO_COL enable you to create and apply a Data
Redaction named policy expression.
Parent topic: Creating and Managing Multiple Named Policy Expressions
3.6.3 Updating a Data Redaction Named Policy Expression
You can use the DBMS_REDACT.UPDATE_POLICY_EXPRESSION
procedure to update a Data Redaction named policy expression. The update takes place immediately
and is reflected in all the columns that use the named policy expression.
REDACTION_EXPRESSIONS data dictionary view to find existing Data Redaction policy expressions.
Parent topic: Creating and Managing Multiple Named Policy Expressions
3.6.4 Dropping a Data Redaction Named Policy Expression
You can use the DBMS_REDACT.DROP_POLICY_EXPRESSION
procedure to drop a Data Redaction named policy expression.
REDACTION_EXPRESSIONS data dictionary view
to find the existing Data Redaction named policy expressions.
Parent topic: Creating and Managing Multiple Named Policy Expressions
3.6.5 Tutorial: Creating and Sharing a Data Redaction Named Policy Expression
This tutorial shows how to create an Oracle Data Redaction named policy expression, apply it to multiple tables, and centrally manage the named policy expression.
- Step 1: Create Users for This Tutorial
You must create two users for this tutorial:dr_admin, who will create the Oracle Data Redaction policies, andhr_clerk, who will test them. - Step 2: Create an Oracle Data Redaction Policy
Userdr_adminis ready to create an Oracle Data Redaction policy to protect theHR.EMPLOYEESandHR.JOBStables. - Step 3: Test the Oracle Data Redaction Policy
Userhr_clerkis ready to query the tables that have redacted data. - Step 4: Create and Apply a Named Policy Expression to the Redacted Table Columns
Next, userdr_adminis ready to create a Data Redaction named policy expression (hr_redact_pol) and apply it to two of the three redacted table columns. - Step 5: Test the Data Redaction Named Policy Expression
Userhr_clerkis now ready to test thehr_redact_polnamed policy expression. - Step 6: Modify the Data Redaction Named Policy Expression
Userdr_admindecides to modify the Data Redaction named policy expression so that userhr_clerkwill get redacted data, not userHR. - Step 7: Test the Modified Named Policy Expression
UsersHRandhr_clerkare ready to test the modified Data Redaction named policy expression. - Step 8: Remove the Components of This Tutorial
If you do not need the components of this tutorial, then you can remove them.
Parent topic: Creating and Managing Multiple Named Policy Expressions
3.6.5.1 Step 1: Create Users for This Tutorial
You must create two users for this tutorial: dr_admin, who will create the Oracle Data Redaction policies, and hr_clerk, who will test them.
COMPATIBLE initialization parameter is set to 12.2.0.0 or later. You can check this setting by using the SHOW PARAMETER command.
3.6.5.2 Step 2: Create an Oracle Data Redaction Policy
User dr_admin is ready to create an Oracle Data Redaction policy to protect the HR.EMPLOYEES and HR.JOBS tables.
HR.EMPLOYEES.SALARY, HR.EMPLOYEES.COMMISSION_PCT, and HR.JOBS.MAX_SALARY columns are redacted.
3.6.5.3 Step 3: Test the Oracle Data Redaction Policy
User hr_clerk is ready to query the tables that have redacted data.
3.6.5.4 Step 4: Create and Apply a Named Policy Expression to the Redacted Table Columns
Next, user dr_admin is ready to create a Data Redaction
named policy expression (hr_redact_pol) and apply it to two of the three
redacted table columns.
hr_clerk to view the redacted data.
hr_clerk can view data in the HR.EMPLOYEES.SALARY and HR.JOBS.MAX_SALARY, but the data in the HR.EMPLOYEES.COMMISSION_PCT column will still be redacted for this user.
3.6.5.5 Step 5: Test the Data Redaction Named Policy Expression
User hr_clerk is now ready to test the
hr_redact_pol named policy expression.
3.6.5.6 Step 6: Modify the Data Redaction Named Policy Expression
User dr_admin decides to modify the Data Redaction named
policy expression so that user hr_clerk will get redacted data, not user
HR.
3.6.5.7 Step 7: Test the Modified Named Policy Expression
Users HR and hr_clerk are ready to test the
modified Data Redaction named policy expression.