我创建了一个用户,授予了SQL Developer中除sysdba以外的所有权限,并以新用户身份登录,但我仍然无法创建其他用户。
这是我到目前为止所做的:
以本地sysdba登录;
执行命令
MatchesActivity
将您在SQL Developer中可以看到的所有权限和角色授予USERA;
以USERA身份登录;
运行:
@Override protected void onCreate(Bundle savedInstanceState)
{
MainActivity.dbc.setDbProcesslistener(this); // to know txaMatches has been defined
MainActivity.dbc.findDBMatches(); // generate output
}
然后我得到CREATE USER USERA IDENTIFIED BY "PWDpwd123" DEFAULT TABLESPACE TBS1
TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
。怎么了?
非常感谢你的帮助!
答案 0 :(得分:4)
您需要向该用户授予CREATE USER
系统权限。
GRANT CREATE USER to username;
您还可以向此用户授予ALTER USER
和DROP USER
系统权限。
请参阅文档:https://docs.oracle.com/database/121/SQLRF/statements_9013.htm#i2077938
系统权限名称:CREATE USER
创建用户。此权限还允许创建者:
在任何表空间上分配配额。设置默认和临时 表空间。将配置文件指定为CREATE USER语句的一部分。
编辑 - 实际例子
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>
最后一个命令SELECT user FROM dual
显示当前(已记录)用户为user123