Skip to content


Oracle VPD: Check what columns security is defined on

Let’s say you have defined a policy on a table, and you are making use of Oracle 10g functionality to restrict it to certain columns:

begin
 DBMS_RLS.ADD_POLICY (
   'MYSCHEMA',
   'MYTABLE',
   'MY_POLICY_NAME',
   'MYSCHEMA',
   'MY_POLICY_FUNCTION',
   'SELECT',
   SEC_RELEVANT_COLS     => 'COL1, COL2',
   sec_relevant_cols_opt => dbms_rls.ALL_ROWS
  );
end;

Normally you would query the dba_policies data dictionary view in order to see what policies are defined, but this data dictionary view does not include the relevant columns for the policy.
In order to see what columns are impacted by a certain policy, you need to query the dba_sec_relevant_cols data dictionary view.

SQL> SELECT object_owner, object_name, sec_rel_column 
      FROM DBA_SEC_RELEVANT_COLS;
OBJECT_OWNER             OBJECT_NAME              SEC_REL_COLUMN
------------------------ ------------------ ------------------------
MYSCHEMA                 MYTABLE            COL1
MYSCHEMA                 MYTABLE            COL2

Posted in Oracle, Security. Tagged with , , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.