oracle undo表空间爆满的解决步骤:1. 启动sqlplus,并用sys登陆到数据库。#su - oracle $gt;sqlplus / as sysdba2. 查找数据库
oracle undo表空间爆满的解决步骤:
1. 启动sqlplus,并用sys登陆到数据库。
#su - oracle
$>sqlplus / as sysdba
2. 查找数据库的undo表空间名,确定当前例程正在使用的undo表空间:
show parameter undo_tablespace。
3. 确认undo表空间;
sql> select name from v$tablespace;
name
------------------------------
undotbs1
4. 检查数据库undo表空间占用空间情况以及数据文件存放位置;
sql>select file_name,bytes/1024/1024 from dba_data_files where tablespace_name like 'undotbs%';
5. 查看回滚段的使用情况,哪个用户正在使用回滚段的资源,如果有用户最好更换时间(特别是生产环境)。
sql> select s.username, u.name from v$transaction t,v$rollstat r, v$rollname u,v$session s
where s.taddr=t.addr and t.xidusn=r.usn and r.usn=u.usn order by s.username;
6. 检查undo segment状态;
sql> select usn,xacts,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks
from v$rollstat order by rssize;
usn xacts rssize/1024/1024/1024 hwmsize/1024/1024/1024 shrinks
1 0 0 0.000358582 0.000358582 0
2 14 0 0.796791077 0.796791077 735
3 44 1 0.00920867919921875 3.99295806884766 996
这还原表空间中还存在3个回滚的对象。
7. 创建新的undo表空间,并设置自动扩展参数;
sql> create undo tablespace undotbs2 datafile '/opt/oracle/oradata/ge01/undotbs2.dbf' size 100m reuse autoextend on next 50m maxsize 5000m;
tablespace created.
8. 切换undo表空间为新的undo表空间 , 动态更改spfile配置文件;
sql> alter system set undo_tablespace=undotbs2 scope=both;
system altered.
9.验证当前数据库的 undo表空间 【linux公社 】
sql> show parameter undo
name type value
------------------------------------ ----------- --------------
undo_management string auto
undo_retention integer 900
undo_tablespace string undotbs2
9. 等待原undo表空间所有undo segment offline;
select usn,xacts,status,rssize/1024/1024,hwmsize/1024/1024, shrinks from v$rollstat order by rssize;
select t.segment_name,t.tablespace_name,t.segment_id,t.status from dba_rollback_segs t;
segment_name tablespace_name segment_id status
1 system system 0 online
2 _syssmu1$ undotbs1 1 offline
3 _syssmu2$ undotbs1 2 offline
4 _syssmu47$ undotbs1 47 offline
上面对应的undotbs1还原表空间所对应的回滚段均为offline
10.到$oracle_home/dbs/init$oracle_sid.ora如下内容是否发生变更:
#cat $oracle_home/dbs/initddptest.ora
……
*.undo_management=’auto’
*.undo_retention=10800
*.undo_tablespace=’undotbs2’
……
如果没有发生变更请执行如下语句:
sql> create pfile from spfile;
file created.
11. 删除原有的undo表空间;
sql> drop tablespace undotbs1 including contents;
最后需要在重启数据库或者重启计算机后到存储数据文件的路径下删除数据文件(为什么要手动删除呢:以上步骤只是删除了oracle中undo表空间的逻辑关系,即删除了数据文件在数据字典中的关联,,不会自动删除项关联的数据文件)。
drop tablespace undotbs1 including contents and datafiles;