当然,我们也可以查看表空间及其对应的数据文件:select substr(file_name,1,60) UNDO_FILES from dba_data_files where tablespace_name = 'UNDOTBS1' order by 1;
查看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 = 'UNDOTBS1';
2、创建UNDO表空间:
create undo tablespace undotbs3 datafile '/data1/oradata/undotbs03_1.dbf' size 100M autoextend on next 20M maxsize 500M;
上面命令中,指定UNDO表空间名称、对应数据文件、初始大小、自动扩展、每次扩展大小、最大扩展到多大
给UNDO表空间增加数据文件:
ALTER TABLESPACE UNDOTBS3 ADD DATAFILE ''/data1/oradata/undotbs03_2.dbf' SIZE 1024M AUTOEXTEND ON NEXT 100M MAXSIZE 2048M;
3、切换默认UNDO表空间:
alter system set undo_tablespace = UNDOTBS3;