4

I have created a user, granted all the privileges you can see in SQL Developer except sysdba and logged in as the new user, but I still cannot create other users.

Here is what I have done so far:

  1. Login as local sysdba;

  2. Run:

    CREATE USER USERA IDENTIFIED BY "PWDpwd123" DEFAULT TABLESPACE TBS1
    TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
    
  3. Grant all privileges and roles you can see in SQL Developer to USERA;

  4. Login as USERA;

  5. Run:

     CREATE USER USERB IDENTIFIED BY "pwd321" DEFAULT TABLESPACE TBS2
     TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
    

And then I get a ORA-01031 ERROR. What's wrong? Many thanks for your help!

1 Answer 1

5

You need to grant CREATE USER system priviege to that user.

GRANT CREATE USER to username;

You can also grant ALTER USER and DROP USER system privileges to this user.

See the documentation: https://docs.oracle.com/database/121/SQLRF/statements_9013.htm#i2077938

System Privilege Name: CREATE USER

Create users. This privilege also allows the creator to:

Assign quotas on any tablespace. Set default and temporary tablespaces. Assign a profile as part of a CREATE USER statement.


EDIT - practical example


C:\>sqlplus system as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Jan 16 15:16:52 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> create user test123 identified by test;

User created.

SQL> grant connect to test123;

Grant succeeded.

SQL> grant create user to test123;

Grant succeeded.

SQL> connect test123
Enter password:
Connected.
SQL> create user alamakota1 identified by alamakota;

User created.

SQL> select user from dual;

USER
------------------------------
TEST123

SQL>

The last command SELECT user FROM dual shows, that the current (logged) user is user123

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks! But would you please paste a link or show a practical code?
As you can see, I have granted any possible privileges to USERA. The code runs smoothly in 11g or older versions, so I doubt whether it has something to do with the Oracle version.
I've attached a log from a test session to the answer.
How can you create a user whose name does not begin with C##? I got an ORA-65096 trying to do so. I am a complete newbee to Oracle with only a few MSSQL knowledges, so please help me.
I have a non-CDB installation (without a multitenant container database ). You have CDB installation, so all usernames have to start with c##, see the documentation: docs.oracle.com/database/121/SQLRF/… In a non-CDB installation the username cannot begin with c##.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.