6

I have two users A and B. I want to grant B the permission to create, drop, etc. all tables in A's schema. As far as I can see, I can grant B full access to all schemas not a specific one. Is this correct?

3 Answers 3

11

You are correct that there is no way to grant a user create/drop/etc permissions on an entire schema. I suggest you look into proxy authentication. This basically involves altering user A to allow user B to proxy as A:

ALTER USER A GRANT CONNECT THROUGH B;

Then the connection uses user B's authentication, but gets the permissions of user A.

connect B[A]/Password@Database

This question was somewhat covered by my more specific question here.


Note on Roles: Roles work well for giving Object Privileges to another user since the privileges are tied to a specific object. While Roles can grant System Privileges, they apply either to the users own schema or to the entire database and therefore can't apply to another schema. For example, the user B could be granted CREATE TABLE which would allow it to create tables in its own schema or CREATE ANY TABLE which would allow it to create tables in any schema. These permissions could be granted directly or through a role, but the former wouldn't allow create privileges in the A schema. The latter would, but would also allow create privileges in any schema including sys, which would be a security concern.

4
  • Thanks for the answer. This is a pity of course. Basically, I don't understand why such a simple feature is not available in Oracle.
    – Michael-O
    Commented Feb 17, 2012 at 15:09
  • 2
    Just found this feature on a 12c wish list: dadbm.com/2012/03/oracle-database-12c-wish-list Commented Aug 30, 2012 at 17:33
  • 1
    I would highly prefer to decouple users from schemas. Just like in MySQL.
    – Michael-O
    Commented Aug 30, 2012 at 18:04
  • The permission would have to exist for the decoupling to work, so perhaps it would be a first step in that direction. Commented Aug 30, 2012 at 20:25
0

Just create a procedure on the target schema which involves EXECUTE_IMMEDIATE to create tables (check for other DDLs!!). Then grant the source schema privilege to execute on procedure. This should do the trick without security concerns.

-1

You could just create a role with those permissions, and grant the role to whoever needs that ability.

3
  • How is that supposed to work? Leigh said that I cannot grant on an specfic entire schema.
    – Michael-O
    Commented Feb 17, 2012 at 15:29
  • 1
    A Role can only include permissions that can be granted directly. The user B could be granted CREATE TABLE which would allow it to create tables in its own schema or CREATE ANY TABLE which would allow it to create tables in any schema. These permissions could be granted directly or through a role, but the first is too narrow and the second too broad. Commented Feb 17, 2012 at 15:56
  • Leigh, exactly, none fits.
    – Michael-O
    Commented Feb 17, 2012 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.