正文
最近在做 Star Schema Benchmark 测试,用到了 oracle 数据库,由于只是验证下数据集在 oracle 数据里查询结果的正确性,就简单处理,用docker 安装了一个 oracle 11g。一阵倒腾之后,出现了下面的错误:
ORA-01653: unable to extend table *.LINEORDER by 1024 in tablespace SYSTEM
这个错误其实表示表空间的存储不够了,首先,我们需要检查一下表空间的大小:
SELECT a.tablespace_name "表空间名", a.bytes / 1024 / 1024 "表空间大小(M)", (a.bytes - b.bytes) / 1024 / 1024 "已使用空间(M)", b.bytes / 1024 / 1024 "空闲空间(M)", round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "占比" FROM (SELECT tablespace_name, sum(bytes) bytes FROM dba_data_files GROUP BY tablespace_name) a, (SELECT tablespace_name, sum(bytes) bytes, max(bytes) largest FROM dba_free_space GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name ORDER BY ((a.bytes - b.bytes) / a.bytes) DESC
接下来查看一下,表空间里包含几个数据文件:
SELECT file_name, tablespace_name, bytes / 1024 / 1024 "bytes MB", maxbytes / 1024 / 1024 "maxbytes MB" FROM dba_data_files WHERE tablespace_name = 'SYSTEM';
接下来检查一下表空间自动扩展功能是否已经打开:
SELECT file_id, file_name, tablespace_name, autoextensible, increment_by FROM dba_data_files WHERE tablespace_name = 'SYSTEM' ORDER BY file_id desc;
接下来找出该表空间对应的数据文件及路径:
SELECT * FROM dba_data_files t WHERE t.tablespace_name='SYSTEM';
解决办法:
增大数据文件到 10 G:
alter database datafile '/u01/app/oracle/oradata/XE/system.dbf' resize 10240M;