原文博客链接地址:数据库open报错ORA-01555: snapshot too old

今天正在东莞蜜月的时候。一个学生说他管理的測试库出问题了,无法open,我们先来看看是什么问题:

Recovery of Online Redo Log: Thread 1 Group 4 Seq 4 Reading mem 0
Mem# 0: /onlinelog/shr/redo04.log
Completed redo application of 0.00MB
Completed crash recovery at
Thread 1: logseq 4, block 3, scn 7755957
0 data blocks read, 0 data blocks written, 0 redo k-bytes read
Thread 1 advanced to log sequence 5 (thread open)
Thread 1 opened at log sequence 5
Current log# 5 seq# 5 mem# 0: /onlinelog/shr/redo05.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Thu Jun 19 13:31:35 2014
SMON: enabling cache recovery
ORA-01555 caused by SQL statement below (SQL ID: 4krwuz0ctqxdt, SCN: 0x0000.007658ba):
select ctime, mtime, stime from obj$ where obj# = :1
Errors in file /oracle/diag/rdbms/shr/shr/trace/shr_ora_5262.trc:
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00604: error occurred at recursive SQL level 1
ORA-01555: snapshot too old: rollback segment number 6 with name "_SYSSMU6_1263032392$" too small
Errors in file /oracle/diag/rdbms/shr/shr/trace/shr_ora_5262.trc:
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00604: error occurred at recursive SQL level 1
ORA-01555: snapshot too old: rollback segment number 6 with name "_SYSSMU6_1263032392$" too small
Error 704 happened during db open, shutting down database
USER (ospid: 5262): terminating the instance due to error 704
Instance terminated by USER, pid = 5262
ORA-1092 signalled during: ALTER DATABASE OPEN...
opiodr aborting process unknown ospid (5262) as a result of ORA-1092
Thu Jun 19 13:31:37 2014
ORA-1092 : opitsk aborting process

从上面的错误来看,该数据库之所以open失败,是因为Oracle在bootstrap阶段运行递归SQL时出现ora-01555错误,

这样bootstrap过程无法继续下去。也就导致数据库无法open。我们能够看到报错的SQL语句例如以下:

select ctime, mtime, stime from obj$ where obj# = :1

这是非常熟悉的一个SQL,通过10046 trace跟踪Oracle open的过程你会发现该SQL。

针对该错误。也许有人以为是回滚段的问题,实际上并非。这样的情况下推进下SCN 就能够非常顺利的把数据库open。

可是这里有个问题:该兄弟的数据库是Oracle 11.2.0.4。已经不支持传统的10015 event的方式了。

以下我们通过oradebug 来解决该问题:

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started. Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 989856648 bytes
Database Buffers 3271557120 bytes
Redo Buffers 12107776 bytes
Database mounted.
SQL>
SQL> oradebug poke 0x06001AE70 4 0x859AFA
ORA-00074: no process has been specified
SQL> oradebug setmypid
Statement processed.
SQL> oradebug DUMPvar SGA kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
SQL> oradebug poke 0x06001AE70 4 0x859AFA
BEFORE: [06001AE70, 06001AE74) = 00000000
AFTER: [06001AE70, 06001AE74) = 00859AFA
SQL> alter database open; Database altered. SQL>

这里简单解释一下。4 为长度,0x859AFA是16进制。我在原来的v$datafile_header.checkpoint_change#的基础之上

加上上1000000得到该值。

我们能够看到。顺利打开了数据库。

最后再出观察下alert log发现竟然有ora-00600 4194错误。

Thu Jun 19 14:48:43 2014
Dumping diagnostic data in directory=[cdmp_20140619144843], requested by (instance=1, osid=9140 (MMON)), summary=[incident=132122].
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x3D6C3836] [PC:0x97F4DF6, kgegpa()+40] [flags: 0x0, count: 1]
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x3D6C3836] [PC:0x97F386A, kgebse()+776] [flags: 0x2, count: 2]
Thu Jun 19 14:48:46 2014
Flush retried for xcb 0x159c668c8, pmd 0x15870d270
Errors in file /oracle/diag/rdbms/shr/shr/trace/shr_pmon_9112.trc (incident=132017):
ORA-00600: internal error code, arguments: [4194], [], [], [], [], [], [], [], [], [], [], []
Incident details in: /oracle/diag/rdbms/shr/shr/incident/incdir_132017/shr_pmon_9112_i132017.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Thu Jun 19 14:48:47 2014
Errors in file /oracle/diag/rdbms/shr/shr/trace/shr_ora_9268.trc (incident=132209):
ORA-00600: internal error code, arguments: [4194], [], [], [], [], [], [], [], [], [], [], []
ORA-00001: unique constraint (SYSTEM.UNQ_PAIRS) violated
Incident details in: /oracle/diag/rdbms/shr/shr/incident/incdir_132209/shr_ora_9268_i132209.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Errors in file /oracle/diag/rdbms/shr/shr/trace/shr_pmon_9112.trc:
ORA-00600: internal error code, arguments: [4194], [], [], [], [], [], [], [], [], [], [], []
PMON (ospid: 9112): terminating the instance due to error 472
System state dump requested by (instance=1, osid=9112 (PMON)), summary=[abnormal instance termination].
System State dumped to trace file /oracle/diag/rdbms/shr/shr/trace/shr_diag_9122_20140619144848.trc
Dumping diagnostic data in directory=[cdmp_20140619144848], requested by (instance=1, osid=9112 (PMON)), summary=[abnormal instance termination].
Instance terminated by PMON, pid = 9112

这是一个很常见的错误了,最简单的方式就是通过重建undo或处理回滚段来解决,这里我们用最简单的方式:

改动undo_management=manual
undo_tablespace='system'
SQL> l
1* create pfile='/tmp/1.ora' from spfile
SQL> startup mount pfile='/tmp/1.ora';
ORACLE instance started. Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 989856648 bytes
Database Buffers 3271557120 bytes
Redo Buffers 12107776 bytes
Database mounted.
SQL> alter database open; Database altered. SQL> select name from v$datafile; NAME
--------------------------------------------------------------------------------
/oracle/oradata/shr/system01.dbf
/oracle/oradata/shr/sysaux01.dbf
/oracle/oradata/shr/undotbs01.dbf
/oracle/oradata/shr/users01.dbf
/oradata/shr/jy_shr01.dbf
/oradata/shr/jy_shr02.dbf
/oradata/shr/jy_shr03.dbf
/oradata/shr/eas_d_stand01.dbf
/oradata/shr/eas_d_stand02.dbf
/oradata/shr/eas_d_stand03.dbf
/backup/eas/eas_d_stand04.dbf NAME
--------------------------------------------------------------------------------
/backup/eas/eas_d_stand05.dbf
/backup/eas/eas_d_stand06.dbf 13 rows selected. SQL> show parameter undo NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string SYSTEM
SQL> create undo tablespace undotbs2 datafile '/oracle/oradata/shr/undotbs2_01.dbf' size 200m; Tablespace created. SQL> shutdown immediate

重建undo之后,再停库,改动undo參数就可以顺利打开数据库,例如以下:

SQL> create spfile from pfile='/tmp/1.ora';

File created.

SQL> startup mount
ORACLE instance started. Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 989856648 bytes
Database Buffers 3271557120 bytes
Redo Buffers 12107776 bytes
Database mounted.
SQL> alter database open; Database altered. SQL>

处理完毕之后alert log不再抛出不论什么错误。

数据库open报错ORA-01555: snapshot too old的更多相关文章

  1. 11gR2数据库日志报错:Fatal NI connect error 12170、

    11gR2数据库日志报错:Fatal NI connect error 12170.TNS-12535.TNS-00505 [问题点数:100分,结帖人MarkIII]             不显示 ...

  2. 4、Oracle 数据库 startup 报错:ORA-27102: out of memory

    1.数据库启动报错: ORA-: out of memory SQL> startup pfile='/db/oracle/init.ora'; ORA-: out of memory Linu ...

  3. 导入MySQL测试数据库employee报错

    导入MySQL测试数据库employee 报错 下载地址:https://launchpad.net/test-db/ 上传解压: [root@001 ~]# tar xf employees_db- ...

  4. 同时操作两个数据库:报错Illegal attempt to associate a collection with two open sessions

    今天我在一个操作两个数据库的SSH里 同时插入1条数据 报错 Illegal attempt to associate a collection with two open sessions 在这里有 ...

  5. 无法删除MySql数据库,报错1010 error dropping

    环境:MySQL.Navicat 8 操作:Drop database testDB 报错:1010 error dropping database 解决方法:          ps -ef | g ...

  6. 修改oracle数据库内存报错

    今天修改oracle数据库内存时, alter system set memory_max_target=10240M scope=spfile;语句正确修改:但重启时却报错 : SQL> al ...

  7. python+Django+test 测试数据库生成报错

    前提: 使用Django自带的test进行单元测试. 问题描述: 运行:python manage.py test,报错,出现数据库乱码的现象,报错如下: Creating test database ...

  8. 导入数据库备份报错1067 – Invalid default value for ‘create_time’

    通过navicat工具导入psc数据库备份文件,报错如下,mysql版本5.7 执行如下语句不通过 DROP TABLE IF EXISTS `guard_user`; CREATE TABLE `g ...

  9. 【redis数据库学习】用JAVA连接redis数据库各种报错

    最近项目中,需要用到redis数据库,然后使用Jedis让JAVA连接redis. 首先,安装redis数据库,参考的是:http://www.runoob.com/redis/redis-insta ...

随机推荐

  1. 【分块答案】【最小割】bzoj1532 [POI2005]Kos-Dicing

    引用zky的题解:http://blog.csdn.net/iamzky/article/details/39667859 每条S-T路径代表一次比赛的结果.最小割会尽量让一个人赢得最多. 因为二分总 ...

  2. [CSAcademy]Connected Tree Subgraphs

    题目大意: 给你一棵n个结点的树,求有多少种染色方案,使得染色过程中染过色的结点始终连成一块. 思路: 树形DP. 设f[x]表示先放x时,x的子树中的染色方案数,y为x的子结点. 则f[x]=pro ...

  3. 微服务之SpringCloud实战(一):SpringCloud简介

    什么是微服务架构 微服务架构就是系统架构设计的一种风格,它主旨将一个独立的系统,拆分成各个微服务,各个微服务独立运行,他们之间通过Http的Restful API进行通信,拆分出来的微服务是根据原系统 ...

  4. 优化apk

    1.首先找到Sdk的位置 2.在电脑中找到Sdk之后点击->bulid-tools 3.点击23.0.3,将需要优化的apk复制到23.0.3的目录下(比如aa.apk) 4.回到23.0.3之 ...

  5. javascript如何写一个for循环

    一个非常简单的for循环,也有不少的学问.假如,我们的目标是要遍历一个dom结点的所有孩子结点,然后打印结点的内容. 在javascript下,我刚学习的时间,我会这样写. for(var i = 0 ...

  6. P2P通信标准协议(四)之SIP

    在前面几篇文章中我们介绍了建立p2p通信的一般协议(簇),以及一种完整的NAT传输解决方案ICE, 但是对于多用户的通信情况,还有一些通用协议来实现标准化的管理,如之前讲过的SDP和SIP等,SIP( ...

  7. github清理,记录一些有趣的项目

    1. rhino 一种java做的开源javascript引擎 https://github.com/mozilla/rhino 2. jeewx 国人写的公众号管理后台,集成度有些高,不好剥离.还是 ...

  8. kettle新手教程

     1.kettle介绍 kettle是一个ETL(Extract, Transform and Load抽取.转换.加载)工具,ETL工具在数据仓库项目使用很频繁,kettle也能够应用在下面一些 ...

  9. centos7 安装nginx与配置

    第一步安装 使用Yum安装是推荐的方式,整体的流程非常的简单,也不容易出错,如果不需要什么特殊配置,建议使用Yum尽进行安装. 第一种安装方式,通过添加epel源 yum install epel-r ...

  10. docker 安装 gogs(go git server) 及问题解决

    docker安装gogs 参考官方说明 gogs mysql 支持 运行一个mysql image docker run --name gogs-mysql -e MYSQL_ROOT_PASSWOR ...