DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: About GRANT...

  1. #1
    Join Date
    Aug 2000
    Posts
    11

    Question

    Hi,

    is there a way of granting all the privileges of a user X to another user Y? Something like "GRANT * FROM UYER X TO USER Y" ? - Many thanks in advance!
    Dan

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    There is NO "from" and "to" in GRANT command.

  3. #3
    Join Date
    Sep 2000
    Posts
    5
    Try to create ROLE and grant all objects you need to the role. Then you can grant role to the user with only one statement.

  4. #4
    Join Date
    Oct 2000
    Posts
    6
    Dan,

    You could try "cut and paste" at SQL*plus or SQLWorksheet. Run something like the following statements, copy the output and paste to run your actual grants.

    To copy table rights from USER1 to USER2 for example,

    select 'GRANT ' || PRIVILEGE || ' ON ' || TABLE_NAME ||
    ' TO USER2;' from dba_tab_privs where grantee = 'USER1';

    for role privileges,
    select 'GRANT ' || GRANTED_ROLE ||
    ' TO USER2;' from dba_role_privs where grantee = 'USER1';

    for system privileges use dba_sys_privs.

    Moks


  5. #5
    Join Date
    Jul 2000
    Posts
    296
    For granting object privileges also select the owner of the object and run the grant statements from the owners account.
    And include grant option (dba_tab_privs) or admin option(dba_role_privs, dba_sys_privs):

    select 'GRANT ' || PRIVILEGE || ' ON ' || OWNER ||'.'|| TABLE_NAME ||' TO ROLE1'||
    decode(grantable, 'YES', ' WITH GRANT OPTION', null)||';'
    from dba_tab_privs where grantee = 'USER2';


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width