-- 1 向數據庫導入數據時報了ORA-01653: unable to extend table錯誤,網上查了下原因是由於表空間不足引起的;
查詢表空間使用情況語句
select a.tablespace_name,a.bytes/1024/1024 total, (a.bytes-b.bytes)/1024/1024 used, b.bytes/1024/1024 free, round((a.bytes-b.bytes)/a.bytes*100,2) used_rate
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;
-- 2 以上語句可以查詢出表空間使用情況,如果發現表空間容量不足,查看數據文件文件所在位置及文件編號
查看數據文件位置
select file#, name from v$datafile;
-- 3 修改表空間大小有兩種方法
修改數據文件大小
alter database datafile '/usr/oracle/app/oradata/orcl/Test.dbf' resize 20480M; 修改后的大小要比實際大小大至少50%,最好大一倍以上
增加數據文件
alter tablespace XXX add datafile '/home/oracle/data/XXX_1.dbf' size 1024M;