一、相关步骤:
1、查看undo相关参数
SQL>show parameter undo
2、创建新的undo空间
SQL>create undo tablespace undotbs2
datafile '/xxx/xxx/xxx/undo2.dbs size 4096M
3、修改spfile
SQL>alter system set undo_tablespace=undotbs2 scope=both;
4、删除undotbs1表空间
SQL>drop tablespace undotbs1 including contents and datafiles;
如果出现ora-30013, 说明undo正在使用不能删除,则需要以下语句判断是哪些session正在使用undo
5、查看哪些session正在使用undo
SQL>select rn.name,rs.status, sn.username, sn.sid, sn.serial#
from v$rollname rn, v$rollstat rs, v$transaction ts, v$session sn
where rn.usn=rs.usn
and rn.usn=ts.xidusn
and ts.sess_addr= sn.saddr
and rn.name in ( select segment_name from dba_segments
where tablespace_name='UNDOTBS1')
6、让sid用户自己退出,或者直接删除SESSION
SQL>alter system kill session 'sid, serial#';
7、直接等待undo_retentation=900秒时间,然后再删除undotbs1表空间就能成功
二、适用范围:
因为业务要求,我们创建了一个很大的undo表空间,业务完成后,我们需要缩小undo空间,可采用以上步骤。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/354732/viewspace-668242/
,如需转载,请注明出处,否则将追究法律责任。