Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Oracle Virtual Private Databases VPD multiple policy values

Oracle Database Tips by Donald Burleson

Question:  I need to have a VPD security policy accept multiple objects, like this:

CREATE OR REPLACE FUNCTION
SECFUNC (
   p_object_schema in varchar2,
   p_object_name in varchar2,
   p_fund in varchar2,
   p_org in varchar2)

Even though I can create the dbms_rls.add_policy function, how can I create a policy with multiple input values?

EXEC DBMS_RLS.ADD_POLICY(
   'MSMITH', LEDGER',
   'SecByFund', 'SYS',
   'SECFUNC',
   'SELECT');

Answer:  Good question!  I would start by examining the dbms_rls.shared_static option.  Also note this VPD security policy article where the author says it is possible to have multiple policies for each object and it is possible to define policy groups for objects, but it does not say how to share the same policy between multiple tables.

However, VPD's allow Multiple security and can place more than one policy on each object, as well as stack them on other base policies. This makes VPD perfect for Web applications that are deployed for many companies.

Using the Oracle 10g Static Policy Type

When you use static policies, VPD always enforces the same predicate for access control, regardless of the runtime environment. However, if you set the policy_type parameter to shared_static, the policy is applied to multiple objects.

The book "Oracle 10g new features" has examples of using advanced VPD features.

Michael Armstrong-Smith noted this novel solution:

I was trying to do was to create a VPD policy where the contents of FUND and ORG, both columns in the same table, had to be referenced inside the VPD function in order to determine whether a TRUE predicate (1=1) or a FALSE predicate (1=2) would be returned.

My problem is that I was unable to pass a column name or ROWID into the VPD function, therefore I was unable to check whether the row was or was not accessible. Unlike most VPD situations, the predicate would change not only based upon the USER and the user's role but would also change depending upon the content of data within the row itself.

As I say, in the end I created a solution that returns a predicate string containing a subquery and a boolean expression, something like:

FUND = FUND AND (SELECT FUND_CODE FROM SEC_TABLE WHERE SEC_TABLE.USERID = UID AND SEC_TABLE.ORG_CODE = ORG and SEC_TABLE.FUND_CODE = FUND) IS NOT NULL

My VPD predicate just looks like the above with the code being evaluated against each row. Both FUND and ORG come from the row being checked, while FUND_CODE and ORG_CODE are in my security table which has a primary key of USERID, FUND_CODE and ORG_CODE.

If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.