UNDO表空间失败的处理方法

  本文档中,测试环境是AIX6.1,日文系统。
一、UNDO表空间异常的现象
  1、表空间文件,如果被我们自己无意中删除,或者被其他程序破坏的话,Oracle将无法正常启动,也无法正常退出。
SQL> shutdown immediate
ORA-00376: ファイル12を読み込むことはできません。
ORA-01110: データファイル12: '/opt/oradata/DTCDB/undotbs_01.dbf'
  2、通过Oracle命令删除UNDO表空间,同样也会出现错误。
$ sqlplus /nolog
con
SQL*Plus: Release 11.1.0.6.0 - Production on 水 3月 14 17:52:46 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


SQL> conn /as sysdba
Connected to an idle instance.


SQL> startup

ORACLE instance started.
Total System Global Area 3874926592 bytes
Fixed Size                  2144080 bytes
Variable Size            1761609904 bytes
Database Buffers         2097152000 bytes
Redo Buffers               14020608 bytes
Database mounted.
Database opened.


SQL> drop tablespace undotbs;

drop tablespace undotbs
*
ERROR at line 1:
ORA-01548:
アクティブなロールバック・セグメント'_SYSSMU11_1331712400$'があります。表領域の
削除を終了しました
  3、通过创建UNDO表空间,由于表空间名称已经存在,同样也不可能成功的。
SQL> create undo tablespace undotbs1 datafile '/opt/oradata/DTCDB/undotbs_01.dbf' size 10m autoextend on next 1m maxsize 1024m;
create undo tablespace undotbs1 datafile '/opt/oradata/DTCDB/undotbs_01.dbf' size 10m autoextend on next 1m maxsize 1024m
*
ERROR at line 1:
ORA-01537: ファイル'/opt/oradata/DTCDB/undotbs_01.dbf'を追加できません -
すでにデータベースの一部として存在します
  4、如果创建一个新的UNDO表空间,即UNDO表空间名换一个新的,不在使用默认的表空间名称;然后删除原来默认表空间,同样出错。
SQL> create undo tablespace undotbs1 datafile '/opt/oradata/DTCDB/undotbs_02.dbf' size 10m autoextend on next 1m maxsize 1024m;
Tablespace created.


SQL> drop tablespace undotbs;

drop tablespace undotbs
*
ERROR at line 1:
ORA-01548:
アクティブなロールバック・セグメント'_SYSSMU11_1331712400$'があります。表領域の
削除を終了しました
  5、直接向UNDO表空间中添加数据库文件,还是出错。
SQL> alter tablespace undotbs add datafile '/opt/oradata/DTCDB/undotbs_01.dbf' size 10m autoextend on next 1m maxsize 1024m;
alter tablespace undotbs add datafile '/opt/oradata/DTCDB/undotbs_01.dbf' size 10m autoextend on next 1m maxsize 1024m
*
ERROR at line 1:
ORA-01537: ファイル'/opt/oradata/DTCDB/undotbs_01.dbf'を追加できません -
すでにデータベースの一部として存在します


SQL> alter tablespace undotbs mv datafile '/opt/oradata/DTCDB/undotbs_01.dbf';

alter tablespace undotbs mv datafile '/opt/oradata/DTCDB/undotbs_01.dbf'
                        *
ERROR at line 1:
ORA-02142: ALTER TABLESPACEオプションがないか、または無効です。
二、处理方法
  经过实践,按照下面的方法,可以解决上述UNDO表空间异常的问题。
  1、强制关闭数据库。
SQL> shutdown abort
ORACLE instance shut down.
  2、查看UNDO表空间参数,并修改UNDO表空间参数,关闭数据库。
$ sqlplus /nolog
SQL*Plus: Release 11.1.0.6.0 - Production on 木 3月 15 13:50:57 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

SQL> conn /as sysdba;
Connected.


SQL> show parameter undo;

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
undo_management                      string
AUTO
undo_retention                       integer
900
undo_tablespace                      string
UNDOTBS


SQL> alter system set undo_management=manual scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
  3、重启数据库,并确认修改后的UNDO表空间参数。
SQL> startup;
ORACLE instance started.
Total System Global Area 3874926592 bytes
Fixed Size                  2144080 bytes
Variable Size            1728055472 bytes
Database Buffers         2130706432 bytes
Redo Buffers               14020608 bytes
Database mounted.
Database opened.


SQL> show parameter undo;

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
undo_management                      string
MANUAL
undo_retention                       integer
900
undo_tablespace                      string
UNDOTBS
  4、删除UNDO表空间,创建新的UNDO表空间,并恢复UNDO表空间的参数信息,关闭数据库。
SQL> drop tablespace undotbs including contents and datafiles;
Tablespace dropped.

SQL> create undo tablespace undotbs datafile '/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/undotbs01.dbf' size 1024m autoextend on next 10m maxsize unlimited;
Tablespace created.

SQL> alter system set undo_management=auto scope=spfile;
System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
  5、重启数据库,确认UNDO表空间参数。
SQL> startup;
ORACLE instance started.
Total System Global Area 3874926592 bytes
Fixed Size                  2144080 bytes
Variable Size            1728055472 bytes
Database Buffers         2130706432 bytes
Redo Buffers               14020608 bytes
Database mounted.
Database opened.


SQL> show parameter undo

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
undo_management                      string
AUTO
undo_retention                       integer
900
undo_tablespace                      string
UNDOTBS


SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
三、系统表空间异常的应对总结
  Oracle系统表空间信息,应该借助于自身系统命令进行操作,不应该直接执行OS命令,导致系统不一致的异常发生。
  1、回滚段视图查询状态
SQL> startup
ORACLE instance started.
Total System Global Area 3874926592 bytes
Fixed Size                  2144080 bytes
Variable Size            1761609904 bytes
Database Buffers         2097152000 bytes
Redo Buffers               14020608 bytes
Database mounted.
Database opened.


SQL> conn /as sysdba;

Connected.


SQL> select segment_name,status from dba_rollback_segs;

SEGMENT_NAME
------------------------------------------------------------
STATUS
--------------------------------
SYSTEM
ONLINE
_SYSSMU11_1331720312$
ONLINE
_SYSSMU12_1331720312$
ONLINE
SEGMENT_NAME
------------------------------------------------------------
STATUS
--------------------------------
_SYSSMU13_1331720312$
ONLINE
_SYSSMU14_1331720312$
ONLINE
_SYSSMU15_1331720312$

ONLINE

SEGMENT_NAME

------------------------------------------------------------
STATUS
--------------------------------
_SYSSMU16_1331720312$
ONLINE
_SYSSMU17_1331720312$
ONLINE
_SYSSMU18_1331720312$
ONLINE
SEGMENT_NAME
------------------------------------------------------------
STATUS
--------------------------------
_SYSSMU19_1331720312$
ONLINE
_SYSSMU20_1331720312$
ONLINE
11 rows selected.


SQL> select file#,name,status from v$datafile;

    FILE#
----------
NAME
--------------------------------------------------------------------------------
STATUS
--------------
        1
/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/system01.dbf
SYSTEM
        2
/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/sysaux01.dbf
ONLINE
    FILE#
----------
NAME
--------------------------------------------------------------------------------
STATUS
--------------
        3
/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/undotbs_01.dbf
ONLINE
        4
/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/users01.dbf
    FILE#
----------
NAME
--------------------------------------------------------------------------------
STATUS
--------------
ONLINE
  2、打开pfile,删除处于OFFLINE的段信息。
     文件init.ora.0222010145832的内容。
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################


###########################################

# Cache and I/O
###########################################
db_block_size=8192
 
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
 
###########################################
# Database Identification
###########################################
db_domain=""
db_name=DTCDB
 
###########################################
# File Configuration
###########################################
control_files=("/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/control01.ctl", "/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/control02.ctl", "/opt/oracle/product/11.1.0/db_1/oradata/DTCDB/control03.ctl")
 
###########################################
# Miscellaneous
###########################################
compatible=11.1.0.0.0
diagnostic_dest=/opt/oracle/product/11.1.0/db_1
memory_target=3172990976
 
###########################################
# NLS
###########################################
nls_language="JAPANESE"
nls_territory="JAPAN"
 
###########################################
# Processes and Sessions
###########################################
processes=750
sessions=830
 
###########################################
# Security and Auditing
###########################################
audit_file_dest=/opt/oracle/product/11.1.0/db_1/admin/DTCDB/adump
audit_trail=db
remote_login_passwordfile=EXCLUSIVE
 
###########################################
# Shared Server
###########################################
dispatchers="(PROTOCOL=TCP) (SERVICE=DTCDBXDB)"
 
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=manual
undo_retention=10800
undo_tablespace=UNDOTBS
_CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU12_1331712400$,_SYSSMU13_1331712400$,_SYSSMU14_1331712400$,_SYSSMU15_1331712400$,_SYSSMU16_1331712400$,_SYSSMU17_1331712400$,_SYSSMU18_1331712400$,_SYSSMU19_1331712400$,_SYSSMU20_1331712400$,_SYSSMU21_1331718949$,_SYSSMU22_1331718949$,_SYSSMU23_1331718949$,_SYSSMU24_1331718949$,_SYSSMU25_1331718949$,_SYSSMU26_1331718949$,_SYSSMU27_1331718949$,_SYSSMU28_1331718949$,_SYSSMU29_1331718949$,_SYSSMU30_1331718949$)
  3、使用profile启动,使数据库恢复到正常的回滚位置。
$ sqlplus /nolog
SQL*Plus: Release 11.1.0.6.0 - Production on 水 3月 14 18:33:58 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected.


SQL> startup pfile=/opt/oracle/product/11.1.0/db_1/admin/DTCDB/pfile/init.ora.0222010145832

ORACLE instance started.
Total System Global Area 3173429248 bytes
Fixed Size                  2142392 bytes
Variable Size            1694502728 bytes
Database Buffers         1459617792 bytes
Redo Buffers               17166336 bytes
Database mounted.
Database opened.

你可能感兴趣的:(UNDO表空间失败的处理方法)