undo在线切换步骤笔记

一、相关步骤:

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博客 ” ,链接:http://blog.itpub.net/354732/viewspace-668242/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/354732/viewspace-668242/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值