Oracle : Grant Create table in another schema?

后端 未结 3 1996
北海茫月
北海茫月 2020-12-16 19:56

I have two users : Schema1 and Schema2

How to grant Create Table privilege On Schema2 to Schema1 ?

I have been turning around and I got confused. I tried : <

相关标签:
3条回答
  • 2020-12-16 20:02

    Better solution (minimizes the security threat that comes with CREATE ANY TABLE privilege...)

    • Create a procedure on schema2 that takes a table definition as a "input" parameter (e.g. p_tab_def in varchar2(4000).
    • Inside put an execute_immediate(p_tab_def); statement. You MUST check the p_tab_def first in order to defend yourself from other DDL statements than "CREATE TABLE [...]". (e.g. you could use a simple check by checking first two words -> it must be "CREATE TABLE").
    • GRANT EXECUTE ON schema2.procedure_name TO schema1;

    It's a simple concept ... I've used such concepts in my previous job.

    0 讨论(0)
  • 2020-12-16 20:08

    You want to grant create ANY table:

    grant create any table to schema1;
    

    The any "modifier" allows to create tables in other than own schemas.

    0 讨论(0)
  • 2020-12-16 20:17

    The only other way to allow a non-DBA user to create a table in another schema is to give the user the CREATE ANY TABLE system privilege.

    This privilege can only be given to SCHEMA1 by a user with DBA privileges.

    0 讨论(0)
提交回复
热议问题