Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to dump users grants to .sql file

Re: How to dump users grants to .sql file

From: Alexander Chuchko <ayc_at_feature.kharkov.ua>
Date: Thu, 16 Dec 1999 15:52:16 +0200
Message-ID: <3858ef39@newsfeed.itl.net.ua>

Marc Cluet пишет в сообщении <3858c3ec.9307713_at_news.worldonline.es> ...
>Hi
>
>Someone knows how to dump all the grants I've given to a specific user
>as SQL commands to a .sql file so I can execute it on another server
>to give the same permissions to the same user?
>Thank you!
>Marc
>

spool c:\temp\grants.sql
select 'GRANT '||privilege||' ON '||table_schema||'.'||table_name||' TO '||grantee||decode(grantable, 'YES', ' WITH GRANT OPTION;', ';') from dba_tab_privs where grantee=<user_name>; select 'GRANT'||privilege||' TO '||grantee||decode(admin_option, 'YES', ' WITH ADMIN OPTION;', ';')
from dba_sys_privs where grantee=<user_name>; spool off

I hope this will help you.

Ayc. Received on Thu Dec 16 1999 - 07:52:16 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US