UNDO表空间不足解决方法

发布时间:2020-08-19 12:04:26 作者:烟花丶易冷
来源:ITPUB博客 阅读:434
 

确认UNDO表空间名称

select name from v$tablespace;

 

检查数据库UNDO表空间占用空间情况以及数据文件存放位置;

select file_name,bytes/1024/1024 from dba_data_files where tablespace_name like 'UNDOTBS1';

 

UNDO表空间不够用,有两种处理方法,1,扩大表空间大小;2,创建新的UNDO表空间,删除原来的

 

一、扩大UNDO表空间

alter   database  UNDOTBS1 datafile   '/opt/oracle/oradata/inms/undotbs02.dbf'   resize   4000M;

 

二、创建新的UNDO表空间,删除原来的

1、创建新的UNDO表空间,并设置自动扩展参数;

create undo tablespace undotbs2 datafile '/oradata/oradata/ddptest/UNDOTBS1.dbf' size    2 1000m reuse autoextend on next 800m maxsize unlimited;

 

2、动态更改spfile配置文件;

alter system set undo_tablespace=undotbs2 scope=both;

 

3、删除原有的UNDO表空间;

drop tablespace undotbs1 including contents;

 

4、确认删除是否成功;

select name from v$tablespace;

 

5、确定$ORACLE_HOME/dbs/spfileoinms.ora内容是否发生变更:

 

$more spfileoinms.ora

 

*.undo_management='AUTO'

*.undo_retention=10800

*.undo_tablespace='UNDOTBS2'

 

如果没有发生变更请执行如下语句:

 

SQL> create pfile from spfile;

 

File created.

 

 

6、删除原UNDO表空间的数据文件,其文件名为步骤中执行的结果。

 

#rm $ORACLE_BASE/oradata/$ORACLE_SID/undotbs01.dbf

 

 

 

 

如何处理OracleUNDO表空间所对应的数据文件过大

[日期:2011-04-18]

来源:Linux社区  作者:Linux

google_protectAndRun("render_ads.js::google_render_ad", google_handleError, google_render_ad); 1 查看undo的表空间大小和最大值  
select   t.file_name,t.tablespace_name,  
t.bytes/1024/1024/1024 "GB",  t.maxbytes/1024/1024/1024   "Max GB" 
 from     dba_data_files     t     where    t.tablespace_name='UNDOTBS1' 

 


   

数据文件为:/oracle/oradata/undo/undotbs01.dbf  
   
2
创建一个新的undo表空间,用来替换原来的undo表空间  
create      undo     tablespace    UNDOTBS2  
datafile     '/oracle/oradata/log/undotbs02.dbf' 
size    10M    autoextend     on    maxsize    unlimited;  
3
把新的undo表空间设置成数据库的undo表空间  
alter     system     set undo_tablespace=UNDOTBS2     scope=both;  
4
再次验证数据库的undo表空间  
 show     parameter     undo_tablespace  
5
等待原UNDO表空间UNDOTBS1 is OFFLINE  
   
 SELECT    r.status    "Status",  
r.segment_name    "Name",  
r.tablespace_name     "Tablespace",  
s.extents     "Extents",  
TO_CHAR((s.bytes/1024/1024),'99999990.000')     "Size" 
FROM     sys.dba_rollback_segs      r, sys.dba_segments    s  
WHERE        r.segment_name = s.segment_name  
AND       s.segment_type IN ('ROLLBACK', 'TYPE2 UNDO')  
and       r.tablespace_name='UNDOTBS1'      and       status='ONLINE' 
如果上面有状态online的对象,可以查询具体对象的sidserial#  
5.1
查看当前是什么在使用这个回滚段  
 SELECT     r.NAME,s.sid,s.serial# Serial,  
s.username ,s.machine ,  
t.start_time,t.status ,  
t.used_ublk ,  
substr(s.program, 1, 15)    "operate" 
FROM      v$session    s, v$transaction    t, v$rollname    r,v$rollstat    g  
WHERE      t.addr = s.taddr  
AND      t.xidusn = r.usn  
AND     r.usn = g.usn  
ORDER     BY     t.used_ublk desc;  
--
比如:对象为:sid  474,serial  6794 
5.2
根据sid查出具体的sql  
select     sql_text    from     v$session a,v$sqltext_with_newlines     b  
  where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value  
  and      a.sid=&sid    order     by     piece  
如果该sql不重要,可以直接kill该会话。  
   
5.3  kill session  
alter system kill session '474,6794';  
5.4 
删除原undo表空间及其系统的数据问题  
drop tablespace UNDOTBS1 including contents and datafiles;  
(在AIX系统中,虽然已经删除了系统所对应的undo表空间的数据文件,但用df -g查看,该系统空间不能释放。  
主要是由于Oracle的一个进程在访问该文件。可以kill Oracle访问进程,或者重启数据库后,即可释放系统的空间。)  
   
   
6
新建立UNDOTBS1表空间  
create     undo     tablespace    UNDOTBS1  
datafile    '/oracle/oradata/undo/undotbs01.dbf' 
size    10M    autoextend   on    maxsize 12G;  
   
7
切换回UNTOTBS1  
alter system set undo_tablespace=UNDOTBS1 scope=both;  
8
等待UNDO表空间UNDOTBS2 is OFFLINE  
 SELECT r.status "Status",  
r.segment_name "Name",  
r.tablespace_name "Tablespace",  
s.extents "Extents",  
TO_CHAR((s.bytes/1024/1024),'99999990.000') "Size" 
FROM sys.dba_rollback_segs r, sys.dba_segments s  
WHERE r.segment_name = s.segment_name  
AND s.segment_type IN ('ROLLBACK', 'TYPE2 UNDO')  
and r.tablespace_name='UNDOTBS2' 
ORDER BY 5 DESC;  
9
删除  
drop    tablespace     UNDOTBS2    including    contents    and     datafiles; 

 

 

FROM:http://blog.chinaunix.net/uid-57485-id-3171219.html

推荐阅读:
  1. Undo表空间引发的灾难
  2. Oracle UNDO表空间的管理

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

undo 不足 解决

上一篇:oracle 11g dg broker 开启fast-start failover自动故障切换

下一篇:技术人生系列 · 我和数据中心的故事(第十一期)- 一次启停引发的故障

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》