How to clone an Oracle user

1150415 pts.
Tags:
Oracle
SQL Query
I have to clone an Oracle user but I'm not sure of the process. Is there a SQL query to do this? Basically - this user will have the same privileges but just with a different username. Thank you.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

There is an easy way to do it using SQL Developer (a free tool, from Oracle):

  1. Click on the view menu and select “DBA”.  This will make the “DBA” section be visible.
  2. In the DBA pannel create a connection to the desired database.
  3. Expand the “Security” node and then expand “Users”.
  4. Look for the user you want to “clone” and right-click on it and select “Create Like”.
  5. This will open a dialog where you can set the name for the new user and modify any of the details that were copied from the original user.  There’s also an SQL tab where you can see the script that will be used to create the user and grant all the necessary privileges, etc.

Alternatively, you could use the dbms_metadata package to read the necessary details of the original user and create your new user creation script, as described in this article.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    This was asked back in Sept 2014 here.

    It was not answered then either, I wonder why?
    Maybe it cannot be done.
    134,930 pointsBadges:
    report
  • carlosdl

    It can be done. Probably not in a single operation, but a script can be written.

    I'll see if I have an example a little later.

    85,195 pointsBadges:
    report
  • carlosdl
    Just added the answer Wiki to the Wiki (and updated the previous question to link here too).
    85,195 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: