oracle12c用户名c##_如何创建可以在Oracle 12c中创建用户的用户?

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:

Login as local sysdba;

Run:

CREATE USER USERA IDENTIFIED BY "PWDpwd123" DEFAULT TABLESPACE TBS1

TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;

Grant all privileges and roles you can see in SQL Developer to USERA;

Login as USERA;

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!

解决方案

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值