当前位置:Gxlcms > 数据库问题 > Oracle 表空间不足引起的问题及解决方法

Oracle 表空间不足引起的问题及解决方法

时间:2021-07-01 10:21:17 帮助过:53人阅读

-- 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; 

 

Oracle 表空间不足引起的问题及解决方法

标签:taf   nbsp   home   files   alter   大小   name   where   方法   

人气教程排行