暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

12c 中resource role不再拥有unlimited tablespace权限

原创 黄宸宁 2015-03-17
1206
今年把12c作为全年的学习计划,在刚开始使用12c便遇到一些改变,记录一下。
在以往10g、11g中当创建用于授予resource权限后,就拥有使用该用户的默认表空间的权限,但是到了12c做出了一些改变,先看下面的情况:
[oracle@ora12ccdb admin]$ 
[oracle@ora12ccdb admin]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue Mar 17 21:55:04 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.

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> set lines 200
SQL> select * from v$version;
BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
TNS for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL Version 12.1.0.2.0 - Production 0
SQL>
SQL>
SQL> create user hcn identified by oracle default tablespace tbstest;
User created.
SQL> grant create session,resource to hcn;
Grant succeeded.
SQL>
SQL> create table hcn.test as select * from dba_objects;
create table hcn.test as select * from dba_objects
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'TBSTEST'

在授予resource权限后创建表会报ORA-01950没有使用默认表空间的权限
查看官方文档Database Security Guide,有以下描述:
The following are changes in Oracle Database Security Guide for Oracle Database 12c Release 1 (12.1.0.1):
RESOURCE Role No Longer Grants the UNLIMITED TABLESPACE Privilege
Starting with this release, the RESOURCE role will no longer grant the UNLIMITED TABLESPACE system privilege by default. If you want users to have this system privilege, then you must manually grant it to them.
See "Predefined Roles in an Oracle Database Installation" for more information about default roles.

从12.1.0.1版本开始,resource 角色不再默认授予“unlimited tablespace”权限
继续看看12c中resource角色的描述
RESOURCE
Provides the following system privileges: CREATE CLUSTER, CREATE INDEXTYPE, CREATE OPERATOR, CREATE PROCEDURE, CREATE SEQUENCE,
CREATE TABLE, CREATE TRIGGER, CREATE TYPE.
Be aware that RESOURCE no longer provides the UNLIMITED TABLESPACE system privilege.
This role is provided for compatibility with previous releases of Oracle Database.
You can determine the privileges encompassed by this role by querying the DBA_SYS_PRIVS data dictionary view.
Note: Oracle recommends that you design your own roles for database security rather than relying on this role.
This role may not be created automatically by future releases of Oracle Database.
See Also: Oracle Database Reference for a description of the DBA_SYS_PRIVS view

只能手工授予unlimited tablespace权限,下面是授予该权限后的测试
SQL> 
SQL> ALTER USER hcn quota unlimited on tbstest;
User altered.
SQL>
SQL>
SQL> create table hcn.test as select * from dba_objects;
Table created.
SQL> select count(*) from hcn.test;
COUNT(*)
----------
91601
SQL>

每个新版本总会带来一些细节上的改变,除了看官方文档就只有踩坑填坑了,O(∩_∩)O哈!
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论