数据库无事务情况下丢失undo表空间数据文件

1. 查看当前undo表空间,并删除物理undo文件

SYS@userdata>show parameter undo_tablespace;

NAME                     TYPE                   VALUE
------------------------------------ --------------------------------- ------------------------------
undo_tablespace string UNDOTBS1
SYS@userdata>select file_name,tablespace_name,status from dba_data_files where tablespace_name='UNDOTBS1'; FILE_NAME TABLESPACE_NAME STATUS
------------------------------------------------------------ ------------------------------------------------------------------------------------------ ---------------------------
/u01/app/oracle/oradata/userdata/undotbs01.dbf UNDOTBS1 AVAILABLE SYS@userdata>host rm -rf /u01/app/oracle/oradata/userdata/undotbs01.dbf SYS@userdata>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

2.将数据库正常启动,可以看到缺少undo表空间数据文件的报错

SYS@userdata>startup;
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '/u01/app/oracle/oradata/userdata/undotbs01.dbf' SYS@userdata>show parameter back; NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/oracle/admin/userdata
/bdump
backup_tape_io_slaves boolean FALSE
db_flashback_retention_target integer 1440
fast_start_parallel_rollback string LOW
rollback_segments string
transactions_per_rollback_segment integer 5
SYS@userdata>host tail -n 10 /u01/app/oracle/admin/userdata/bdump/alert_userdata.log
Mon Oct 2 10:53:58 2017
ALTER DATABASE OPEN
Mon Oct 2 10:53:58 2017
Errors in file /u01/app/oracle/admin/userdata/bdump/userdata_dbw0_8121.trc:
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '/u01/app/oracle/oradata/userdata/undotbs01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-1157 signalled during: ALTER DATABASE OPEN...

3.因为undo表空间此时不包含数据,drop undo表空间

SYS@userdata>alter database datafile 2 offline drop;

Database altered.

4. 将undo管理改为manual

SYS@userdata>alter system set undo_management='MANUAL' scope=spfile;

System altered.

5. 重启数据库

SYS@userdata>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@userdata>startup;
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
Database opened.
SYS@userdata>show parameter undo; NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string UNDOTBS1

6. 将丢失文件的undo表空间drop后重建

SYS@userdata>drop tablespace UNDOTBS1;

Tablespace dropped.

SYS@userdata>create undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/userdata/undotbs01.dbf' size 100m autoextend on;

Tablespace created.

7. 查看目前的数据库undo设置,需要将undo_management 改为auto

SYS@userdata>alter system set undo_management='AUTO' scope=spfile;

System altered.

SYS@userdata>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@userdata>startup;
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
Database opened.
SYS@userdata>select name,status,enabled from v$datafile; NAME STATUS ENABLED
-------------------------------------------------- --------------------- ------------------------------
/u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE
/u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE
/u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE
/u01/app/oracle/oradata/userdata/users01.dbf ONLINE READ WRITE
/u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE

数据库有事务情况下丢失undo表空间数据文件

1. undo表空间数据文件丢失后启动数据库

SYS@userdata>startup
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '/u01/app/oracle/oradata/userdata/undotbs01.dbf' SYS@userdata>alter database datafile 2 offline drop; Database altered. SYS@userdata>alter system set undo_management='MANUAL' scope=spfile; System altered. SYS@userdata>shutdown immediate;
ORA-01109: database not open Database dismounted.
ORACLE instance shut down.
SYS@userdata>startup;
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced

2. 查看跟踪日志的详细报错

SYS@userdata>host tail -n 10 /u01/app/oracle/admin/userdata/bdump/alert_userdata.log
Database Characterset is AL32UTF8
Mon Oct 2 11:20:10 2017
Errors in file /u01/app/oracle/admin/userdata/udump/userdata_ora_8444.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: '/u01/app/oracle/oradata/userdata/undotbs01.dbf'
Error 604 happened during db open, shutting down database
USER: terminating instance due to error 604
Instance terminated by USER, pid = 8444
ORA-1092 signalled during: ALTER DATABASE OPEN... SYS@userdata>host tail -n 10 /u01/app/oracle/admin/userdata/udump/userdata_ora_8444.trc
Longest hash chain = 1
Average hash chain = 20/20 = 1.0
Max compares per lookup = 1
Avg compares per lookup = 95/195 = 0.5
----------------------------------------------
tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x1)
tkcrrpa: (WARN) Failed initial attempt to send ARCH message (message:0x1)
ORA-00604: error occurred at recursive SQL level 1
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: '/u01/app/oracle/oradata/userdata/undotbs01.dbf'

3. 加undo隐藏参数重新启动数据库

SYS@userdata>select ksppinm from x$ksppi where ksppinm like '%roll%';

KSPPINM
--------------------------------------------------
transactions_per_rollback_segment
rollback_segments
_rollback_segment_initial
_rollback_segment_count
_offline_rollback_segments
_corrupted_rollback_segments
_cleanup_rollback_entries
_rollback_stopat
fast_start_parallel_rollback
_mv_rolling_inv 10 rows selected. SYS@userdata>alter system set "_offline_rollback_segments"=true scope=spfile; System altered. SYS@userdata>alter system set "_corrupted_rollback_segments"='_SYSSMU1$','_SYSSMU2$','_SYSSMU3$','_SYSSMU4$','_SYSSMU5$','_SYSSMU6$','_SYSSMU7$','_SYSSMU8$','_SYSSMU9$','_SYSSMU10$' scope=spfile; System altered. SYS@userdata>shutdown abort;
ORACLE instance shut down.
SYS@userdata>startup;
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
Database opened.

4.将丢失文件的undo表空间drop后重建

SYS@userdata>drop tablespace UNDOTBS1;

Tablespace dropped.

SYS@userdata>create undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/userdata/undotbs01.dbf' size 100m autoextend on;

Tablespace created.

5.将undo管理方式修改为auto

SYS@userdata>alter system set undo_management='AUTO' scope=spfile;

System altered.

6.将隐藏参数恢复为默认值

SYS@userdata>alter system reset "_offline_rollback_segments" scope=spfile sid='*';

System altered.

SYS@userdata>alter system reset "_corrupted_rollback_segments" scope=spfile sid='*';

System altered.

7.重启数据库

SYS@userdata>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@userdata>startup;
ORACLE instance started. Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 255853816 bytes
Database Buffers 50331648 bytes
Redo Buffers 6303744 bytes
Database mounted.
Database opened. SYS@userdata>select name,status,enabled from v$datafile; NAME STATUS ENABLED
-------------------------------------------------- --------------------- ------------------------------
/u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE
/u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE
/u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE
/u01/app/oracle/oradata/userdata/users01.dbf ONLINE READ WRITE
/u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE

模拟数据库丢失undo表空间的更多相关文章

  1. UNDO表空间损坏,爆满,ORA-600[4194]/[4193]错误解决

    模拟手工删除UNDO表空间 在ORADATA 中把UNDOTBS01.DBF 删除 模拟启库 SQL> STARUP; * 第 1 行出现错误: ORA-01157: 无法标识/锁定数据文件 2 ...

  2. 重建UNDO表空间遭遇ORA-01548

    今天开发那边的一套数据库的undo表空间不知道被谁设置成了自动扩展,然后所谓的屋漏偏逢连夜雨的是, 开发人员今天跑了一个很大的事物,然后直接后果就是undo表空间不断被扩展,直到把文件系统写爆了.没办 ...

  3. undo表空间

    undo表空间undo表空间的管理,主要包括创建.删除.修改.切换.其中需要注意的是不能在undo表空间创建数据库对象,还有就是只能是单文件或大文件表空间. 创建创建主要有两种方法,一种是在创建数据库 ...

  4. Oracle 释放过度使用的Undo表空间

    故障现象:UNDO表空间越来越大,长此下去最终数据因为磁盘空间不足而崩溃: 问题分析:产生问题的原因主要以下两点: 1. 有较大的事务量让Oracle Undo自动扩展,产生过度占用磁盘空间的情况: ...

  5. UNDO表空间不足解决方法

    确认UNDO表空间名称 select name from v$tablespace; 检查数据库UNDO表空间占用空间情况以及数据文件存放位置: select file_name,bytes/1024 ...

  6. 项目中遇到的undo表空间不足的替换

    1.查找数据库的UNDO表空间名                                      select name from v$tablespace;                 ...

  7. Oracle数据库 ORA-01555 快照过旧 (undo表空间:撤销表空间)

    UNDO表空间用于存放UNDO数据,当执行DML操作时,oracle会将这些操作的旧数据写入到UNDO段,以保证可以回滚或者一致读等,而临时表空间主要用来做查询和存放一些缓冲区数据.你听说UNDO也是 ...

  8. 总结Oracle8i 的UNDO表空间损坏(ORA-01092及ORA-00600【4193】)情况下的数据库不完全恢复的经历

    服务器断电重启导致备份生产环境的恢复目录库无法进行启动,提示Ora-01092例程终止.强行断开连接 查看跟踪日志: Wed Jan 10 08:41:37 2018 Errors in file d ...

  9. UNDO表空间损坏导致数据库无法OPEN

    在数据库undo表空间文件损坏.或者undo表空间文件缺失的情况下.无法打开数据库. 这两种情况都能够视为一种情况处理,解决方法一样. 场景:在23:10的时候新建一个undo表空间undotbs02 ...

随机推荐

  1. 《C语言程序设计》指针篇<一>

    指针 指针是C语言的精华,同时也是其中的难点和重点,我在近日对这一部分内容进行了重新的研读,把其中的一些例子自己重新编写和理解了一遍.此篇博客的内容即是我自己对此书例子的一些理解和总结. 一.大问题: ...

  2. win10 右键菜单很慢的解决方式

    本来想用 win7 的,不想花很多时间折腾了.现在新电脑主板硬盘CPU都在排挤 win7 ,真是可怜呀.正题: 新电脑的性能应该还算不错的, 18 年跑分 29w 以上,但在图标上面右键却都要转圈几秒 ...

  3. CSS基本内容

    CSS样式表的三种引入方式: 1.外部样式表——即将CSS样式写在单独的一个.css文件中: <link rel="stylesheet" type="text/c ...

  4. 查看iis对应w3wp.exe显示的进程ID号

    1.任务管理器,查看,选择列,选择PID(进程标识符) 2.通过cmd查询: 管理员身份运行cmd,跳转到C:\Windows\System32\inetsrv目录,然后运行appcmd list w ...

  5. P4001 [BJOI2006]狼抓兔子

    传送门 思路: 不少题解都是用网络流来做最小割(网络流是什么),但对于一个不会网络流的蒟蒻来做这题相当困难. 听机房daolao说可以重构图做最短路.然后就baidu将平面图转换成一个对偶图,因为网络 ...

  6. MD5加密与Hash加密

    一.Md5加密 MD5算法具有以下特点: 1.压缩性:任意长度的数据,算出的MD5值长度都是固定的. 2.容易计算:从原数据计算出MD5值很容易. 3.抗修改性:对原数据进行任何改动,哪怕只修改1个字 ...

  7. ssh连接服务器

    1.命令行操作 第一步输入  :ssh 用户名@服务器外网ip 第二步:输入密码,回车 看到welcome提示信息即为登陆成功 输入:exit 退出 2.客户端操作 windows下载ssh软件,安装 ...

  8. 你真的了解restful api吗?

    前言 在以前,一个网站的完成总是“all in one”,页面,数据,渲染全部在服务端完成,这样做的最大的弊端是后期维护,扩展极其痛苦,开发人员必须同时具备前后端知识.于是慢慢的后来兴起了前后端分离的 ...

  9. top 命令常用操作

    1.显示进程参数 top -c 下面操作为top命令后操作 2.按cpu/mem排序 shift + p/m 3.高亮 排序列 按x键 4.高亮 变化进程行 按b键 5.显示cpu每核的运行状态 按1 ...

  10. python+selenium2(一)

    一.安装python (1)在官网下载python的安装包,这里使用的是python3.5.安装一路下一步,安装路径我的是D:\Python35. (2)在计算机的path变量中添加D:\Python ...