SQL> connect sys@pdb1 as sysdba
Enter password:
Connected.
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
SQL> create user usera identified by usera
2 default tablespace users
3 temporary tablespace temp
4 quota unlimited on users;
User created.
SQL> grant create session, create user to usera;
Grant succeeded.
由于usera已被授予create user权限,因此允许其创建新用户-userb:
SQL> connect usera/usera@pdb1
Connected.
SQL> create user userb identified by userb
2 default tablespace users
3 temporary tablespace temp
4 quota unlimited on users;
User created.
但是,授予create session失败,因为不允许usera这样做:
SQL> grant create session to userb;
grant create session to userb
*
ERROR at line 1:
ORA-01031: insufficient privileges
SQL>
那么,你能做什么呢?
一种选择是使用**with admin option**;返回到sys,并将其重新授予usera:
SQL> connect sys@pdb1 as sysdba
Enter password:
Connected.
SQL> grant create session to usera with admin option;
Grant succeeded.
usera现在是否可以将create session授予userb?是!
SQL> connect usera/usera@pdb1
Connected.
SQL> grant create session to userb;
Grant succeeded.
SQL>
另一种选择是将**dba**角色授予usera:
SQL> connect sys@pdb1 as sysdba
Enter password:
Connected.
从usera中撤消create session将级联到无法再创建会话的userb:
SQL> revoke create session from usera;
Revoke succeeded.
只有usera具有CREATE SESSION权限:
SQL> grant create session to usera;
Grant succeeded.
但是,也要承认dba
SQL> grant dba to usera;
Grant succeeded.
usera现在可以将create session授予userb吗?是!
SQL> connect usera/usera@pdb1
Connected.
SQL> grant create session to userb;
Grant succeeded.
SQL>
1条答案
按热度按时间z9smfwbn1#
这就是你目前拥有的(我想是这样的,因为你没有发布你到底做了什么):
作为特权用户(
sys
)连接,我正在创建一个被授予create session
和create user
权限的新用户:由于
usera
已被授予create user
权限,因此允许其创建新用户-userb
:但是,授予
create session
失败,因为不允许usera
这样做:那么,你能做什么呢?
一种选择是使用**
with admin option
**;返回到sys
,并将其重新授予usera
:usera
现在是否可以将create session
授予userb
?是!另一种选择是将**
dba
**角色授予usera
:从
usera
中撤消create session
将级联到无法再创建会话的userb
:只有
usera
具有CREATE SESSION权限:但是,也要承认
dba
usera
现在可以将create session
授予userb
吗?是!然而:请注意,
with admin option
和dba
都是强大的,如果您不注意,您的系统可能存在安全漏洞。只将强大的特权留给强大的用户;所有其他用户都不应该执行此类任务。