How to clone a user in Oracle

Have a need for a sql query that will clone an Oracle user. As a source, I have a user who has all the necessary privileges. I wonder if it is possible to create the same thing, but with a different username in the same database.

+6
sql database oracle plsql
source share
1 answer

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 simply replace the username with the new one you want to create.

+8
source share

All Articles