从操作系统rm数据文件后,利用句柄与rman恢复的过程。(已验证)

时间:2022-09-15 17:04:00

以下操作代码的流程是配的,但是相应的文件名,啥的   必须改动。

故障现象

数据文件被误删除

具体情况

接到反馈说,数据文件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恢复的过程。(已验证)的更多相关文章

  1. 测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程

    测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程 最近系统出现问题,由于数据库产生的日志量太大无法开启归档模式,导致offline的 ...

  2. Oracle误删数据文件后出现oracle initialization or shutdown in progress解决

    一.错误分析 1.首先本人在出现这种情况的背景是执行如下SQL语句后生成的表空间 --自定义表空间 数据表空间 临时表空间 CREATE TEMPORARY TABLESPACE HOUSE_TEMP ...

  3. primary库新增数据文件后,standby库无法创建文件并终止数据同步

    主库是RAC环境,使用asm存放数据文件,备库是操作系统本地文件系统存放数据文件.在主库执行以下操作: SQL> alter tablespace ysdv add datafile '+dat ...

  4. linux误用rm删除文件后恢复

    linux 系统:ubuntu16.04 误把/usr/local local文件删除了,要疯 步骤: 1.对于文件系统为ext3文件系统 sudo apt-get install ext3grep ...

  5. ORACLE模拟一个数据文件坏块并使用RMAN备份来恢复

    1.创建一个实验用的表空间并在此表空间上创建表 create tablespace blocktest datafile '/u01/oradata/bys1/blocktest.dbf' size ...

  6. Linux系统下rm删除文件后空间没有释放问题解决办法

    一.问题描述 今日收到zabbix监控报警,发现生产环境一台服务器的磁盘空间不足,需要进行处理,登录后发现可利用率不足20%,进行相关查看和处理工作:但是操作删除了一些备份文件和日志信息后,查看空间仍 ...

  7. 运维笔记--ubuntu rm删除文件后 恢复

    待补充 特别注意:umount分区,尝试恢复文件,文件夹(目录),全部文件 https://www.cnblogs.com/wangxiaoqiangs/p/5630288.html https:// ...

  8. C# 利用FTP自动下载xml文件后利用 FileSystemWatcher 监控目录下文件变化并自动更新数据库

    using FtpLib; using System; using System.Collections.Generic; using System.ComponentModel; using Sys ...

  9. Discuz使用tools修复数据文件后,访问URL多出/source/plugin/tools,导致文章栏目无法访问

    今天我的婚嫁亲子网数据库出了点错误,于是就用dz官方的tool工具修复了以下,然后就发生了这个错误.. 本来频道页面的地址是:http://www.ifen8.com/article/ 结果自动跳转成 ...

随机推荐

  1. Web 安全:隐藏服务版本号

    前述 为了防止一些恶意用户对 apache.nginx.php 等显示出来的版本信息进行攻击,生产环境需要关闭 web 服务的版本信息: apache 隐藏版本号 修改 httpd.conf,添加如下 ...

  2. asp.net限时发送手机验证码

    html代码 <p> <strong>手机验证码:</strong> <asp:TextBox ID="code" runat=&quot ...

  3. Cocos2d-x开发实例介绍特效演示

    下面我们通过一个实例介绍几个特效的使用,这个实例下图所示,下图是一个操作菜单场景,选择菜单可以进入到下图动作场景,在下图动作场景中点击Go按钮可以执行我们选择的特性动作,点击Back按钮可以返回到菜单 ...

  4. 数论&sol;the second wave

    扩展欧几里得算法. void exgcd(int a,int b,int&x,int&y){ if(!b) { x=1;y=0;return ; } exgcd(b,a%b,x,y); ...

  5. Oracle使用并行索引需要注意的问题

    当索引的结构.我们要建立索引快.它将并行加,加平行后.这将平行的列索引. 当并行度索引访问,CBO你可能会考虑并行运行,这可能会导致一些问题.作为server候用并行会引起更加严重的争用.当使用并行后 ...

  6. &period;net下灰度模式图像

    .net下灰度模式图像在创建Graphics时出现:无法从带有索引像素格式的图像创建graphics对象 问题的解决方案. Posted on 2013-07-13 14:23 Imageshop 阅 ...

  7. 中文代码示例之Angular入门教程尝试

    原址: https://zhuanlan.zhihu.com/p/30853705 原文: 中文代码示例教程之Angular尝试 为了检验中文命名在Angular中的支持程度, 把Angular官方入 ...

  8. &lbrack;转&rsqb;pymongo常用操作函数

    pymongo 是 mongodb 的 python Driver Editor.记录下学习过程中感觉以后会常用多一些部分,以做参考. 1. 连接数据库 要使用pymongo最先应该做的事就是先连上运 ...

  9. MongoDB超级简明入门教程

    1.概念篇 MongoDB和MySQL分别作为非关系型数据库和关系型数据库的代表,通过它们之间的对比可以很快的建立起对MongoDB的认知. MongoDB MySQL 数据库(Database) 数 ...

  10. Spring Boot事务管理(中)

    在上一篇 Spring Boot事务管理(上)的基础上介绍Spring Boot事务属性和事务回滚规则 . 4 Spring Boot事务属性 什么是事务属性呢?事务属性可以理解成事务的一些基本配置, ...