Thomas Carlton
Thomas Carlton

Reputation: 5968

How to grant permissions to SYS objects in Oracle AWS RDS?

I have an AWS RDS Oracle database. I would like to grant access to some sys objects with grant option.

I run:

exec rdsadmin.rdsadmin_util.grant_sys_object('DBA_OBJECTS', 'MASTER_USER', 'SELECT', true);

But I'm getting the error:

ORA-06550: line 1, column 164:
PLS-00306: wrong number or types of arguments in call to 'GRANT_SYS_OBJECT'

I doesn't like the last parameter 'true'. As per the documentation this parameter is for grant option.

If I run the command without the grant option:

exec rdsadmin.rdsadmin_util.grant_sys_object('DBA_OBJECTS', 'MASTER_USER', 'SELECT');

It works but it grants the privilege without the grant option.

How can I grant a privilege with grant option in AWS Oracle RDS?

Upvotes: 1

Views: 3160

Answers (1)

Roberto Hernandez
Roberto Hernandez

Reputation: 8528

Perhaps the problem is coming from an old release, or because you are not informing which parameters correspond with this order.

I would suggest to run it as documented. Why ? Because when you don't inform the parameters, Oracle will run it sequentially using the order in which they were defined when such package/procedure/function was created.

I don't have access to the reference of this RDS admin package, but it is most likely that the error is because of it.

begin
    rdsadmin.rdsadmin_util.grant_sys_object(
        p_obj_name     => 'DBA_OBJECTS',
        p_grantee      => 'MASTER_USER',
        p_privilege    => 'SELECT',
        p_grant_option => true);
end;
/

However, as you are grating with admin option then you must consider this

To be able to grant privileges on an object, your account must have those privileges granted to it directly with the grant option, or via a role granted using with admin option. In the most common case, you may want to grant SELECT on a DBA view that has been granted to the SELECT_CATALOG_ROLE role. If that role isn't already directly granted to your user using with admin option, then you can't transfer the privilege. If you have the DBA privilege, then you can grant the role directly to another user

Also take in consideration the deprecated versions in Amazon RDS for Oracle releases

Amazon RDS Oracle

Upvotes: 1

Related Questions