从操作系统rm数据文件后,利用句柄与rman恢复的过程。(已验证)
以下操作代码的流程是配的,但是相应的文件名,啥的 必须改动。
故障现象
数据文件被误删除
具体情况
接到反馈说,数据文件data20120512.dbf被误删除,需要恢复
数据库提示
ERROR at line 1:
ORA-01116: error in opening database file 16
ORA-01110: data file 16:
‘/u01/app/oracle/product/11.2.0/oradata/ebridge/data20120512.dbf
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
数据库还没有被关闭
解决过程
恢复的原理是,在Linux操作系统中,如果文件从操作系统级别被rm掉,之前打开该文件的进程仍然持有相应的文件句柄,所指向的文件仍然可以读写,并且该文件的文件描述符可以从/proc目录中获得。但是要注意的是,此时如果关闭数据库,则此句柄会消失.
检查dbwr的进程PID
[root@jingyong ~]# ps -ef|grep dbw0|grep -v grep
oracle 2236 1 0 06:40 ? 00:00:01 ora_dbw0_jingyong
dbwr会打开所有数据文件的句柄。在proc目录中可以查到,目录名是进程PID,fd表示文件描述符
[root@jingyong ~]# cd /proc/2236/fd
[root@jingyong fd]# ls -l
total 0
lr-x—— 1 oracle oinstall 64 May 31 08:15 0 -> /dev/null
l-wx—— 1 oracle oinstall 64 May 31 08:15 1 -> /dev/null
l-wx—— 1 oracle oinstall 64 May 31 08:15 10 -> /u01/app/oracle/diag/rdbms/jingyong/jingyong/trace/jingyong_ora_2213.trc
l-wx—— 1 oracle oinstall 64 May 31 08:15 11 -> /u01/app/oracle/diag/rdbms/jingyong/jingyong/trace/jingyong_ora_2213.trm
lr-x—— 1 oracle oinstall 64 May 31 08:15 12 -> /u01/app/oracle/product/11.2.0/db/rdbms/mesg/oraus.msb
lr-x—— 1 oracle oinstall 64 May 31 08:15 13 -> /dev/zero
lr-x—— 1 oracle oinstall 64 May 31 08:15 14 -> /proc/2236/fd
lr-x—— 1 oracle oinstall 64 May 31 08:15 15 -> /dev/zero
lrwx—— 1 oracle oinstall 64 May 31 08:15 16 -> /u01/app/oracle/product/11.2.0/db/dbs/hc_jingyong.dat
lrwx—— 1 oracle oinstall 64 May 31 08:15 17 -> /u01/app/oracle/product/11.2.0/db/dbs/lkJINGYONG
lrwx—— 1 oracle oinstall 64 May 31 08:15 18 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/control01.ctl
lrwx—— 1 oracle oinstall 64 May 31 08:15 19 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/control02.ctl
l-wx—— 1 oracle oinstall 64 May 31 08:15 2 -> /dev/null
lrwx—— 1 oracle oinstall 64 May 31 08:15 20 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/system01.dbf
lrwx—— 1 oracle oinstall 64 May 31 08:15 21 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/sysaux01.dbf
lrwx—— 1 oracle oinstall 64 May 31 08:15 22 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/undotbs01.dbf
lrwx—— 1 oracle oinstall 64 May 31 08:15 23 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/users01.dbf (deleted)
lrwx—— 1 oracle oinstall 64 May 31 08:15 24 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/example01.dbf
lrwx—— 1 oracle oinstall 64 May 31 08:15 25 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/jy01.dbf
lrwx—— 1 oracle oinstall 64 May 31 08:15 26 -> /u01/app/oracle/product/11.2.0/oradata/jingyong/temp01.dbf
lr-x—— 1 oracle oinstall 64 May 31 08:15 27 -> /u01/app/oracle/product/11.2.0/db/rdbms/mesg/oraus.msb
l-wx—— 1 oracle oinstall 64 May 31 08:15 3 -> /u01/app/oracle/product/11.2.0/db/rdbms/log/jingyong_ora_2213.trc
lr-x—— 1 oracle oinstall 64 May 31 08:15 4 -> /dev/null
lr-x—— 1 oracle oinstall 64 May 31 08:15 5 -> /dev/null
lr-x—— 1 oracle oinstall 64 May 31 08:15 6 -> /dev/null
lrwx—— 1 oracle oinstall 64 May 31 08:15 7 -> /u01/app/oracle/product/11.2.0/db/dbs/hc_jingyong.dat
注意其中”/u01/app/oracle/product/11.2.0/oradata/jingyong/users01.dbf (deleted)”字样,表示该文件已经被删除,
直接cp该句柄文件名回原位置
注意(这一步先略过,执行下一步,如果下一步报错如 : cp: cannot create symbolic link `/u01/app/oracle/dradata/orcl/demo01.dbf': No such file or directory,再放过来执行这一步) ———————— : [root@jingyong ]# mkdir -p /u01/app/oracle/product/11.2.0/oradata/jingyong/users01.dbf
[root@jingyong fd]# cp -R 23 /u01/app/oracle/product/11.2.0/oradata/jingyong/users01.dbf
进行数据文件恢复
[oracle@jingyong ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 31 08:24:35 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database datafile 4 offline;
Database altered.
SQL> recover datafile 4;
Media recovery complete.
SQL> alter database datafile 4 online;
Database altered.
从操作系统rm数据文件后,利用句柄与rman恢复的过程。(已验证)的更多相关文章
- 测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程
测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程 最近系统出现问题,由于数据库产生的日志量太大无法开启归档模式,导致offline的 ...
- Oracle误删数据文件后出现oracle initialization or shutdown in progress解决
一.错误分析 1.首先本人在出现这种情况的背景是执行如下SQL语句后生成的表空间 --自定义表空间 数据表空间 临时表空间 CREATE TEMPORARY TABLESPACE HOUSE_TEMP ...
- primary库新增数据文件后,standby库无法创建文件并终止数据同步
主库是RAC环境,使用asm存放数据文件,备库是操作系统本地文件系统存放数据文件.在主库执行以下操作: SQL> alter tablespace ysdv add datafile '+dat ...
- linux误用rm删除文件后恢复
linux 系统:ubuntu16.04 误把/usr/local local文件删除了,要疯 步骤: 1.对于文件系统为ext3文件系统 sudo apt-get install ext3grep ...
- ORACLE模拟一个数据文件坏块并使用RMAN备份来恢复
1.创建一个实验用的表空间并在此表空间上创建表 create tablespace blocktest datafile '/u01/oradata/bys1/blocktest.dbf' size ...
- Linux系统下rm删除文件后空间没有释放问题解决办法
一.问题描述 今日收到zabbix监控报警,发现生产环境一台服务器的磁盘空间不足,需要进行处理,登录后发现可利用率不足20%,进行相关查看和处理工作:但是操作删除了一些备份文件和日志信息后,查看空间仍 ...
- 运维笔记--ubuntu rm删除文件后 恢复
待补充 特别注意:umount分区,尝试恢复文件,文件夹(目录),全部文件 https://www.cnblogs.com/wangxiaoqiangs/p/5630288.html https:// ...
- C# 利用FTP自动下载xml文件后利用 FileSystemWatcher 监控目录下文件变化并自动更新数据库
using FtpLib; using System; using System.Collections.Generic; using System.ComponentModel; using Sys ...
- Discuz使用tools修复数据文件后,访问URL多出/source/plugin/tools,导致文章栏目无法访问
今天我的婚嫁亲子网数据库出了点错误,于是就用dz官方的tool工具修复了以下,然后就发生了这个错误.. 本来频道页面的地址是:http://www.ifen8.com/article/ 结果自动跳转成 ...
随机推荐
- OC Copy基本使用(深拷贝和浅拷贝)
首先,什么是copy? Copy的字面意思是“复制”.“拷贝”,是一个产生副本的过程. 常见的复制有:文件复制,作用是利用一个源文件产生一个副本文件. 特点:1.修改源文件的内容,不会影响副本文件: ...
- 文件属性,获取,设置文件属性chown stat函数
转载:http://c.biancheng.net/cpp/html/326.html man 2 stat查看手册 int stat(const char *path, struct stat *b ...
- BlockingQueue-----多线程(一)
前言: 在新增的Concurrent包中,BlockingQueue很好的解决了多线程中,如何高效安全“传输”数据的问题.通过这些高效并且线程安全的队列类,为我们快速搭建高质量的多线程程序带来极大的便 ...
- css 页面定位position
position的四个属性值 relative absolute fixed static 参看实例 <div id="parent"> <div id='su ...
- module_param和module_param_array用法
如何向模块传递参数? Linux kernel 提供了一个简单的框架.利用module_param和module_param_arra来实现. 1. module_param(name, type, ...
- css居中参考
http://www.cnblogs.com/asqq/archive/2012/04/09/2438745.html
- Python的generator生成器
generator保存的是算法,元素仅在使用的时候生成,占用内存小,总元素的个数可以是无限个. 简单的生成器与列表生成式,区别仅在于将中括号[ ],换成小圆括号( ). In [1]: g=(x*x+ ...
- Linux内核参数优化记录
//fs.file-max 最大打开文件数 //fs.nr_open=20480000 单个进程允许打开的文件句柄上限 //信号量及共享内存,可以使用ipcs -l来获取 //kernel.sem 信 ...
- vue 设置代理后 后端获取不到登录的session处理方法
代理设置的 名称 必须是 远程后端的 项目名称 session才生效.
- Eclipse Error: The refactoring does not change any source code
最近在做android项目的过程中遇到这样一个问题,新增一个activity的时候添加不成,eclipse提示The refactoring does not change any source co ...