1.查看undo表空间
select file_id,file_name,tablespace_name,sum(bytes)/1024/1024 total_mb,autoextensible
from dba_data_files group by file_name,file_id,tablespace_name,autoextensible order by file_id;
2.关闭自动扩展
alter database datafile 'G:\APP\WUSHA\ORADATA\ORCL\UNDOTBS01.DBF' autoextend off;
3.增大undo表空间,其实就是增加多一份表空间文件,并设置大小
alter tablespace UNDOTBS1 add datafile '/u01/app/oracle/oradata/PROD/undotbs02.dbf' size 120M;
4.缩小undo 表空间,新建一张undo表空间,设置大小。进行切换,删除旧的
create undo tablespace UNDOTBS2 datafile 'G:\APP\WUSHA\ORADATA\ORCL\UNDOTBS02.DBF' size 10M;
alter system set undo_tablespace=UNDOTBS2;
drop tablespace UNDOTBS1 including contents
5.查看undo使用详细
select * from (select
a.tablespace_name,
sum(a.bytes)/(1024*1024) total_space_MB,
round(b.free,2) Free_space_MB,
round(b.free/(sum(a.bytes)/(1024*1024))* 100,2) percent_free
from dba_data_files a,
(select tablespace_name,sum(bytes)/(1024*1024) free from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name(+)
group by a.tablespace_name,b.free)
where tablespace_name = 'UNDOTBS2';