环境: Oracle 19.16 多租户架构
1.问题现象:
代码语言:javascript复制SQL>
create table T1 as select * from v$active_session_history
*
ERROR at line 1:
ORA-65114: space usage in container is too high
2.查看错误信息:
代码语言:javascript复制SQL> !oerr ora 65114
65114, 00000, "space usage in container is too high"
// *Cause: Space usage in the current container exceeded the value of
// MAX_PDB_STORAGE for the container.
// *Action: Specify a higher value for MAX_PDB_STORAGE using the ALTER
// PLUGGABLE DATABASE statement.
//
3.查询MAX_PDB_STORAGE设置
需要注意这里所说的MAX_PDB_STORAGE并不是一个参数,若直接show parameter MAX_PDB_STORAGE
是查不到的。
而是一个数据库的属性,使用这样的查询方法:
--PDB中查询:
select property_value from database_properties where property_name = 'MAX_PDB_STORAGE';
--CDB中查询:
select property_name, property_value, description, con_id from cdb_properties where property_name = 'MAX_PDB_STORAGE';
我这里在CDB中查询:
代码语言:javascript复制SQL> col PROPERTY_NAME for a22
SQL> col PROPERTY_VALUE for a22
SQL> col DESCRIPTION for a66
SQL> select property_name, property_value, description, con_id from cdb_properties where property_name = 'MAX_PDB_STORAGE';
PROPERTY_NAME PROPERTY_VALUE DESCRIPTION CON_ID
---------------------- ---------------------- ------------------------------------------------------------------ ----------
MAX_PDB_STORAGE 2147483648 Maximum Space Usage of Datafiles and Local Tempfiles in Container 6
MAX_PDB_STORAGE UNLIMITED Maximum Space Usage of Datafiles and Local Tempfiles in Container 3
MAX_PDB_STORAGE UNLIMITED Maximum Space Usage of Datafiles and Local Tempfiles in Container 4
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 READ WRITE NO
6 AWR READ WRITE NO
正好对应AWR这个PDB,MAX_PDB_STORAGE有限制2147483648大小。 进入AWR这个PDB,验证查询:
代码语言:javascript复制SQL> alter session set container=awr;
Session altered.
SQL> select sum(bytes/1024/1024/1024) from dba_data_files;
SUM(BYTES/1024/1024/1024)
-------------------------
2.08984375
SQL> select sum(bytes) from dba_data_files;
SUM(BYTES)
----------
2243952640
的确已经达到这个限制,所以不成功是正常的。
4.找出根因
咋会有这个限制呢?翻出之前建立这个PDB的创建语句,就会发现根因:
代码语言:javascript复制CREATE PLUGGABLE DATABASE awr
ADMIN USER awr IDENTIFIED BY awr
ROLES = (dba)
DEFAULT TABLESPACE tbs_awr
DATAFILE '/flash/oradata/DEMO/awr/awr01.dbf' SIZE 250M AUTOEXTEND ON maxsize 10G <--- 这里限制该数据文件上限大小10G
FILE_NAME_CONVERT = ('/flash/oradata/DEMO/pdbseed/',
'/flash/oradata/DEMO/awr/')
STORAGE (MAXSIZE 2G) <--- 这里限制了总大小2G,额。。
PATH_PREFIX = '/flash/oradata/DEMO/awr/';
5.解决问题
知道原因了,解决就很简单了,直接修正下,因为我测试环境空间有限,所以暂时就在此基础上先增加3G,也就是修改设置为5G。
代码语言:javascript复制ALTER PLUGGABLE DATABASE STORAGE (MAXSIZE 5G);
再次执行CTAS语句,不再报错,成功创建。