Oracle 11g and 12c in the role of resource difference

Foreword

experiment

Here to do a little experiment:

Oracle 11g environment:

(1) create a table space

CREATE TABLESPACE test DATAFILE

  '/u01/app/oracle/oradata/bond/test01.dbf' SIZE 5242880

  AUTOEXTEND ON NEXT 1310720 MAXSIZE 32767M

  LOGGING ONLINE PERMANENT BLOCKSIZE 8192

  EXTENT MANAGEMENT LOCAL AUTOALLOCATE DEFAULT

 NOCOMPRESS  SEGMENT SPACE MANAGEMENT AUTO;

(2) create user and authorization

create user test identified by "test" default tablespace test;

grant resource,connect to test;

(3) to create objects and insert data

[oracle@bond ~]$ sqlplus test/test

SQL*Plus: Release 11.2.0.4.0 Production on Sun Aug 18 13:56:26 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP, Data Mining,

Oracle Database Vault and Real Application Testing options

SQL> create table t_dict as

  2  select * from dict where rownum <=100;

Table created.

Inserting data success!

Oracle 12c environment

(1) create a table space

CREATE TABLESPACE test DATAFILE

  '/u01/app/oracle/oradata/bond/test01.dbf' SIZE 5242880

  AUTOEXTEND ON NEXT 1310720 MAXSIZE 32767M

  LOGGING ONLINE PERMANENT BLOCKSIZE 8192

  EXTENT MANAGEMENT LOCAL AUTOALLOCATE DEFAULT

 NOCOMPRESS  SEGMENT SPACE MANAGEMENT AUTO;

(2) create user and authorization

create user test identified by "test" default tablespace test;

grant resource,connect to test;

(3) Construction and inserting data objects

[oracle@bond ~]$ sqlplus test/test

SQL*Plus: Release 12.2.0.1.0 Production on Fri Sep 6 19:53:16 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> create table t_dict as

  2  select * from dict where rownum <=100;

select * from dict where rownum <=100

              *

ERROR at line 2:

ORA-01950: no privileges on tablespace 'TEST'

Insert data failed.

Cause Analysis 

    Contrast 11g and 12c of user permissions and role permissions can be seen, when the user is granted connect and resource privileges granted to users by default 11g UNLIMITED TABLESPACE authority, and 12c and the permission is not granted by default.

    Queries official website that this phenomenon is 11g R2 looks like a bug, and 12c fixes this bug. Official website explained as follows:

The  UNLIMITED TABLESPACE  system privilege will be removed from the  RESOURCE  role in a future Oracle Database release (reference Bug 7614645).

Think

      Since 12c is not as straightforward grant users connect and resource privileges like 11g can be used, then the how to create users and assign permissions to it?

The following example to create a normal user:

CREATE TABLESPACE test DATAFILE

  '/u01/app/oracle/oradata/bond/test01.dbf' SIZE 5242880

  AUTOEXTEND ON NEXT 1310720 MAXSIZE 32767M

  LOGGING ONLINE PERMANENT BLOCKSIZE 8192

  EXTENT MANAGEMENT LOCAL AUTOALLOCATE DEFAULT

 NOCOMPRESS  SEGMENT SPACE MANAGEMENT AUTO;

 


CREATE TEMPORARY TABLESPACE test_temp TEMPFILE

  '/u01/app/oracle/oradata/bond/test_temp01.dbf' SIZE 33554432

  AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M

  EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1048576;


create user test identified by "test"

default tablespace test

quota 30G on test

temporary tablespace test_temp;

Guess you like

Origin www.linuxidc.com/Linux/2019-09/160669.htm