Sunday, February 28, 2010

Purpose of MO_GLOBAL ORG_SECURITY and MO_GLOBAL SET_POLICY_CONTEXT


The purpose of Row-Level-Security is to hide certain data[based on some conditions]. RLS does so by appending a where clause to the secured object.
1. MO_GLOBAL.ORG_SECURITY is a function that returns a predicate for the WHERE CLAUSE
2. The where clause will be appended to Table/Synonym/View for which Multi Org Row Level security is enabled
This procedure has two parameters
   1. p_access_mode
   Pass a value "S" in case you want your current session to work against 

   Single ORG_ID
   Pass a value of "M" in case you want your current session to work 

   against multiple ORG_ID’s
   2. p_org_id
   Only applicable if p_access_mode is passed value of "S"
In SQL*Plus, I wish to set my session to work against a specific Org [one single org]. How do I do that in R12
SQL>> exec MO_GLOBAL.SET_POLICY_CONTEXT(’S’,101);
In the above case, ORG_ID 101 will be assigned as current org for your session.
Internally, following code in blue will be executed by Oracle when you set your context to single Org, dbms_session.set_context(’multi_org2’, ’current_org_id’, 101);

If the current database session is initialised for Single Org[as in above step], then Where clause appended to object by Row-Level-Security will be
WHERE org_id = sys_context(’multi_org2’,’current_org_id’)

0 Responses to “Purpose of MO_GLOBAL ORG_SECURITY and MO_GLOBAL SET_POLICY_CONTEXT”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.