Home > Database > Mysql Tutorial > Oracle undo表空间爆满的处理方法

Oracle undo表空间爆满的处理方法

WBOY
Release: 2016-06-07 17:19:37
Original
1403 people have browsed it

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;

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template