开发者

How to clone user in Oracle

开发者 https://www.devze.com 2023-01-31 14:37 出处:网络
Have a need for a sql query which will do cloning of Oracle user.开发者_开发百科 As source I have user which has all necessary privileges. I wonder if it is possible to create the same one, but with d

Have a need for a sql query which will do cloning of Oracle user.开发者_开发百科 As source I have user which has all necessary privileges. I wonder if it is possible to create the same one, but with different username in the same database.


Briefly (from here)

select dbms_metadata.get_ddl('USER', '...') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT','...') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT','...') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT','...') FROM DUAL;
SELECT DBMS_METADATA.GET_granted_DDL('TABLESPACE_QUOTA', '...') FROM dual;

Then just replace the username with the new one you want to create.

0

精彩评论

暂无评论...
验证码 换一张
取 消