Creating column-level policies

When you create a column-level VPD policy, you define sensitive columns, and if those columns are referenced in a query, statement will be rewritten. To create a column-level VPD policy, you also use the DBMS_RLS.ADD_POLICY procedure.

Getting ready

See the Getting ready section for the first recipe in this chapter. Results shown in this recipe assume that you completed previous recipes in this chapter.

How to do it...

  1. Connect to the database as a user who has appropriate privileges (for example, the user maja):
    $ sqlplus maja
    
  2. Create a VPD policy (for example, test_col) that protects the hr.emp_vpd_test table in the following way: it defines that salary and comm_pct are sensitive columns and a user can access them only ...

Get Oracle Database 12c Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.