如何创建可以在 Oracle 12c 中创建用户的用户?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34827613/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I create a user that can create users in Oracle 12c?
提问by t123yh
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:
这是我到目前为止所做的:
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;
以本地 sysdba 身份登录;
跑:
CREATE USER USERA IDENTIFIED BY "PWDpwd123" DEFAULT TABLESPACE TBS1 TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
将您在 SQL Developer 中可以看到的所有权限和角色授予 USERA;
以用户身份登录;
跑:
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!
然后我得到一个ORA-01031 ERROR
. 怎么了?非常感谢您的帮助!
采纳答案by krokodilko
You need to grant CREATE USER
system priviege to that user.
您需要CREATE 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
您还可以授予ALTER USER
和DROP USER
系统权限给该用户。
请参阅文档: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.
系统权限名称:CREATE USER
创建用户。此特权还允许创建者:
在任何表空间上分配配额。设置默认和临时表空间。分配配置文件作为 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