首页 > 代码库 > Oracle 表空间不足引起的问题及解决方法
Oracle 表空间不足引起的问题及解决方法
-- 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 表空间不足引起的问题及解决方法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。