简体   繁体   English

如何创建可在Oracle 12c中创建用户的用户?

[英]How do I create a user that can create users in 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. 我创建了一个用户,授予了SQL Developer中除sysdba以外的所有权限,并以新用户身份登录,但我仍然无法创建其他用户。

Here is what I have done so far: 这是我到目前为止所做的:

  1. Login as local sysdba; 以本地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; 授予您在SQL Developer中可以看到USERA的所有权限和角色;

  4. Login as USERA; 以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 . 然后我得到一个ORA-01031 ERROR What's wrong? 怎么了? Many thanks for your help! 非常感谢您的帮助!

You need to grant CREATE USER system priviege to that user. 您需要向该用户授予CREATE USER系统priviege。

GRANT CREATE USER to username;

You can also grant ALTER USER and DROP USER system privileges to this user. 您还可以向此用户授予ALTER USERDROP USER系统特权。

See the documentation: https://docs.oracle.com/database/121/SQLRF/statements_9013.htm#i2077938 请参阅文档: https//docs.oracle.com/database/121/SQLRF/statements_9013.htm#i2077938

System Privilege Name: CREATE USER 系统权限名称: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. 将配置文件指定为CREATE USER语句的一部分。


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 SELECT user FROM dual的最后一个命令显示当前(已记录)用户是user123

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM