Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

pdb_storage_clause MAXSIZE has no effect

Mikhail VelikikhOct 17 2016 — edited Oct 19 2016

Hello,

According to the Oracle Documentation https://docs.oracle.com/database/121/SQLRF/statements_6010.htm#CACJAAGI

We could use MAXSIZE to limit the size of a PDB:

Use MAXSIZE to limit the amount of storage that can be used by all tablespaces in the PDB to the value specified with size_clause. This limit includes the size of data files and temporary files for tablespaces belonging to the PDB. Specify MAXSIZE UNLIMITED to enforce no limit.

It's also mentioned in the following MOS note: "How to set and check the max size of PLUGGABLE DATABASE STORAGE (Doc ID 2166477.1)" https://support.oracle.com/epmos/faces/ui/km/DocContentDisplay.jspx?id=2166477.1

And even in some books by respected authors.

I have struggled to get it working without success.

I wondered whether someone was able to point what I'm doing wrong.

Here's an example in which I set MAXSIZE to 600M and it didn't prevent me from consuming in the user tablespace more than that:

[velikikh@comp2364 ~]$ sp /nolog

SQL*Plus: Release 12.1.0.2.0 Production on Wed Oct 19 08:00:48 2016

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

SQL> @20161019/pdb_max_storage.sql

SP2-0310: unable to open file "save_sqlplus_settings.sql"

SQL>

SQL> conn / as sysdba

Connected.

SQL>

SQL> set sqlp "&_USER.@SQL> "

SYS@SQL>

SYS@SQL> alter pluggable database pdb_tc close immediate;

Pluggable database altered.

SYS@SQL>

SYS@SQL> drop pluggable database pdb_tc including datafiles;

Pluggable database dropped.

SYS@SQL>

SYS@SQL> create pluggable database pdb_tc

  2    admin user tc identified by tc roles=(connect,dba)

  3    storage (maxsize 600M);

Pluggable database created.

SYS@SQL>

SYS@SQL> alter pluggable database pdb_tc open;

Pluggable database altered.

SYS@SQL>

SYS@SQL> conn tc/tc@'localhost/pdb_tc'

ERROR:

ORA-00942: table or view does not exist

Error accessing PRODUCT_USER_PROFILE

Warning:  Product user profile information not loaded!

You may need to run PUPBLD.SQL as SYSTEM

Connected.

SYS@SQL>

SYS@SQL> set sqlp "&_USER.@SQL> "

TC@SQL>

TC@SQL> select sys_context( 'userenv', 'con_name') from dual;

SYS_CONTEXT('USERENV','CON_NAME')

----------------------------------------------------------------------------------------------------------------------------------------------------------------

PDB_TC

TC@SQL>

TC@SQL> col tablespace_name for a30

TC@SQL>

TC@SQL> select tablespace_name, sum(bytes)/power(2,20)

  2    from dba_segments

  3   group by rollup(tablespace_name)

  4   order by 2;

TABLESPACE_NAME            SUM(BYTES)/POWER(2,20)

------------------------------ ----------------------

SYSTEM                         234.3125

SYSAUX                         289.9375

                           524.25

TC@SQL>

TC@SQL> create tablespace users datafile size 10M autoextend on next 100M maxsize 1G;

Tablespace created.

TC@SQL>

TC@SQL> alter database default tablespace users;

Database altered.

TC@SQL>

TC@SQL> alter user tc quota unlimited on users;

User altered.

TC@SQL>

TC@SQL> create table t

  2  as

  3  select *

  4    from dba_objects;

Table created.

TC@SQL>

TC@SQL> alter session set resumable_timeout=0;

Session altered.

TC@SQL>

TC@SQL> begin

  2    --for i in 1..5

  3    loop

  4       insert /*+ append parallel(4)*/

  5         into t

  6       select *

  7         from t

  8        where rownum <= 1e6;

  9       commit;

10    end loop;

11  end;

12  /

begin

*

ERROR at line 1:

ORA-01653: unable to extend table TC.T by 1024 in tablespace USERS

ORA-06512: at line 4

TC@SQL>

TC@SQL> select tablespace_name, sum(bytes)/power(2,20)

  2    from dba_segments

  3   group by rollup(tablespace_name)

  4   order by 2;

TABLESPACE_NAME            SUM(BYTES)/POWER(2,20)

------------------------------ ----------------------

SYSTEM                         234.4375

SYSAUX                         289.9375

USERS                         1016

                         1540.375

TC@SQL>

TC@SQL> set longc 100000 long 100000

TC@SQL>

TC@SQL> select xmltype(cursor(select * from v$containers)) from dual;

XMLTYPE(CURSOR(SELECT*FROMV$CONTAINERS))

----------------------------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0"?>

<ROWSET>

<ROW>

  <CON_ID>6</CON_ID>

  <DBID>255210601</DBID>

  <CON_UID>255210601</CON_UID>

  <GUID>3F2E574E38C31CDFE0530100007F3B96</GUID>

  <NAME>PDB_TC</NAME>

  <OPEN_MODE>READ WRITE</OPEN_MODE>

  <RESTRICTED>NO</RESTRICTED>

  <OPEN_TIME>19.10.2016 08:01:01.611 +07:00</OPEN_TIME>

  <CREATE_SCN>1692032</CREATE_SCN>

  <TOTAL_SIZE>611614720</TOTAL_SIZE>

  <BLOCK_SIZE>8192</BLOCK_SIZE>

  <RECOVERY_STATUS>ENABLED</RECOVERY_STATUS>

  <SNAPSHOT_PARENT_CON_ID>0</SNAPSHOT_PARENT_CON_ID>

</ROW>

</ROWSET>

TC@SQL>

TC@SQL> col property_name for a20

TC@SQL> col property_value for a20

TC@SQL> select property_name, property_value from database_properties where property_name ='MAX_PDB_STORAGE';

PROPERTY_NAME         PROPERTY_VALUE

-------------------- --------------------

MAX_PDB_STORAGE      629145600

TC@SQL>

TC@SQL> col description for a100

TC@SQL>

TC@SQL> select patch_uid, description from dba_registry_sqlpatch;

PATCH_UID DESCRIPTION

---------- ----------------------------------------------------------------------------------------------------

  20400035 Database PSU 12.1.0.2.160719, Oracle JavaVM Component (JUL2016)

  20247727 DATABASE BUNDLE PATCH: 12.1.0.2.160719 (23144544)

Message was edited by: Mikhail Velikikh Corrected the SQL*Plus listing

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2016
Added on Oct 17 2016
4 comments
2,310 views