Oracle - 权限不足

时间:2018-03-12 17:41:58

标签: database oracle oracle11g

我创建了这个用户“user1”,以便在它们上创建自己的表和触发器,因为我认为创建表和触发器作为SYS并不是一个好主意(我得到了一个例外,我无法创建一个在SYS创建的特定表上触发。

此“user1”具有以下权限:

create user user1 identified by password1;
grant connect to user1 ;
grant create session to user1 ;
grant resource to user1 ;
grant unlimited tablespace to user1 ;
grant all privileges to user1 ;
grant dba to user1 ;

但是,当我尝试登录时,我无法连接到数据库并且获得“权限不足” - 错误。

哪些特权缺失?

这是输出:

这是德语,意思是:

-user1 created
-grant succeeded
-connected
-The established connection got closed with "Connected"-Script command

enter image description here

当我尝试登录时,我收到以下错误:

enter image description here

1 个答案:

答案 0 :(得分:2)

男孩,你授予了所有可能的(也是不可能的)特权:)

信不信由你,实际上 - 工作。看看我的11g XE上发生了什么:

SQL> show user
USER is "SYS"
SQL> create user user1 identified by password1;

User created.

SQL> grant connect to user1 ;

Grant succeeded.

SQL> grant create session to user1 ;

Grant succeeded.

SQL> grant resource to user1 ;

Grant succeeded.

SQL> grant unlimited tablespace to user1 ;

Grant succeeded.

SQL> grant all privileges to user1 ;

Grant succeeded.

SQL> grant dba to user1 ;

Grant succeeded.

SQL> connect user1/password1@xe
Connected.

Session altered.

SQL> create table test (id number);

Table created.

SQL>

请参阅?一切似乎都很好 - 我作为USER1连接并创建了一个表。您是否介意发布与我相同的输出,但这次是在您的数据库上运行,以便我们可以看到您做了什么以及Oracle如何响应?

顺便说一句,我建议你不要这样做:创建用户时,只授予他所需的最少权限。如果事实证明他需要其他东西,你可以轻松地授予它。授予DBA角色是吧,有点危险。这就是我通常这样做的方式:

SQL> connect sys@xe as sysdba
Enter password:
Connected.

Session altered.

SQL> drop user user1 cascade;

User dropped.

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS

SQL> create user user1 identified by password1
  2  default tablespace users
  3  temporary tablespace temp
  4  profile default
  5  quota unlimited on users;

User created.

SQL> grant create session to user1;

Grant succeeded.

SQL> grant create table to user1;

Grant succeeded.

SQL> connect user1/password1@xe
Connected.

Session altered.

SQL> create table test (id number);

Table created.

SQL>