Re: Active Data Guard with additional permissions

  • From: Rich J <rjoralist3@xxxxxxxxxxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 02 Nov 2016 13:42:02 -0500

On 2016/11/02 12:47, Jeff Chirco wrote:

I have developers that are always asking for production query access.  I was 
thinking I could setup an Active Data Guard instance, and since one of the 
benefits is to use ADG as a read only reporting database.  However I don't 
want users to have select permissions on the tables in primary, only the 
standby.  Unless I am wrong I don't believe you can issues grants in a 
physical standby database.  

Does anybody have some other creative solution to this?  I was thinking maybe 
issuing the grants to a non default role and if possible attach a some kind 
of trigger that would run on a SET ROLE command and then check if the 
instance was primary or not and then allow or not the set role command.  You 
think this is possible? Or something else?

I had experimented with a logon trigger for just such an occasion: 

CREATE OR REPLACE TRIGGER SYS.ON_ITTEST_LOGON
    AFTER LOGON ON ITTEST.SCHEMA
--
-- SYS.ON_ITTEST_LOGON
--
-- Trigger designed to disallow logins on Primary instance of Data Guard
setup.
--
DECLARE
    e_no_clearance    EXCEPTION;
    PRAGMA EXCEPTION_INIT(e_no_clearance, -9808);
BEGIN
    IF SYS_CONTEXT('USERENV','DATABASE_ROLE') = 'PRIMARY' THEN
        RAISE e_no_clearance;
    END IF;
END ON_ITTEST_LOGON;


Although my situation would only require very few schema triggers to be
created.  YMMV, of course! 

Rich

Other related posts: