热门标签 | HotTags
当前位置:  开发笔记 > 运维 > 正文

一次数据文件头不一致恢复

SYS@orcl11galterdatabasedatafile6online;alterdatabasedatafile6online*ERRORatline1:ORA-01113:file6needsmediarecoveryORA-01110:datafile6:optoracleoradataorcl11gzbdba01.dbf有时候我们数据文件offline之后,再online需要

SYS@orcl11galter database datafile 6 online;alter database datafile 6 online*ERROR at line 1:ORA-01113: file 6 needs media recoveryORA-01110: data file 6: /opt/oracle/oradata/orcl11g/zbdba01.dbf 有时候我们数据文件offline之后,再online需要

SYS@orcl11g>alter database datafile 6 online;
alter database datafile 6 online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/opt/oracle/oradata/orcl11g/zbdba01.dbf'
有时候我们数据文件offline之后,再online需要介质恢复
SYS@orcl11g>select file#,name,status from v$datafile;
     FILE# NAME                                                         STATUS
---------- ------------------------------------------------------------ ------------------------------------------------------------
         1 /opt/oracle/oradata/orcl11g/system01.dbf                     SYSTEM
         2 /opt/oracle/oradata/orcl11g/sysaux01.dbf                     ONLINE
         3 /opt/oracle/oradata/orcl11g/undotbs01.dbf                    ONLINE
         4 /opt/oracle/oradata/orcl11g/users01.dbf                      ONLINE
         5 /opt/oracle/oradata/orcl11g/zbdba.dbf                        ONLINE
         6 /opt/oracle/oradata/orcl11g/zbdba01.dbf                      RECOVER
         7 /opt/oracle/oradata/orcl11g/test.dbf                         ONLINE


但是我们归档已经丢失,无法完成介质恢复:
SYS@orcl11g>recover datafile 6;
ORA-00279: change 1986632 generated at 10/28/2014 05:16:11 needed for thread 1
ORA-00289: suggestion : /opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_28/o1_mf_1_74_b4yqrglr_.arc
ORA-00280: change 1986632 for thread 1 is in sequence #74


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00308: cannot open archived log '/opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_28/o1_mf_1_74_b4yqrglr_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
所以这时候我们直接修改文件头进行online:
[oracle@ogg1 lib]$ bbed parfile=par.txt
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Tue Oct 28 05:20:19 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED>
BBED>
BBED> info all
File#  Name                                                        Size(blks)
-----  ----                                                        ----------
     1  /opt/oracle/oradata/orcl11g/system01.dbf                             0
     2  /opt/oracle/oradata/orcl11g/sysaux01.dbf                             0
     3  /opt/oracle/oradata/orcl11g/undotbs01.dbf                            0
     4  /opt/oracle/oradata/orcl11g/users01.dbf                              0
     5  /opt/oracle/oradata/orcl11g/zbdba.dbf                                0
     6  /opt/oracle/oradata/orcl11g/zbdba01.dbf                              0
     7  /opt/oracle/oradata/orcl11g/test.dbf                                 0

BBED> set file 1 block 1
        FILE#           1
        BLOCK#          1

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001e526c
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x3362e202
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x0000004d
         ub4 kcrbabno                       @504      0x000001a6
         ub2 kcrbabof                       @508      0x0010
   ub1 kcvcpetb[0]                          @512      0x02
   ub1 kcvcpetb[1]                          @513      0x00
   ub1 kcvcpetb[2]                          @514      0x00
   ub1 kcvcpetb[3]                          @515      0x00
   ub1 kcvcpetb[4]                          @516      0x00
   ub1 kcvcpetb[5]                          @517      0x00
   ub1 kcvcpetb[6]                          @518      0x00
   ub1 kcvcpetb[7]                          @519      0x00

BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x000000f9

BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x000000f8

BBED> set file 6 block 1
        FILE#           6
        BLOCK#          1

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001e5048
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x3362e11b
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x0000004a
         ub4 kcrbabno                       @504      0x00005801
         ub2 kcrbabof                       @508      0x0010
   ub1 kcvcpetb[0]                          @512      0x02
   ub1 kcvcpetb[1]                          @513      0x00
   ub1 kcvcpetb[2]                          @514      0x00
   ub1 kcvcpetb[3]                          @515      0x00
   ub1 kcvcpetb[4]                          @516      0x00
   ub1 kcvcpetb[5]                          @517      0x00
   ub1 kcvcpetb[6]                          @518      0x00
   ub1 kcvcpetb[7]                          @519      0x00

BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x0000043c

BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x0000043b

BBED> modify /x 6c52 offset 484
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 1                Offsets:  484 to  995           Dba:0x01800001
------------------------------------------------------------------------
6c521e00 00000000 1be16233 01000000 4a000000 01580000 10000000 02000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0d000d00 0d000100 00000000 00000000 00000000 02008001 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> modify /x 02e2 offset 492
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 1                Offsets:  492 to 1003           Dba:0x01800001
------------------------------------------------------------------------
02e26233 01000000 4a000000 01580000 10000000 02000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100
00000000 00000000 00000000 02008001 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> modify /x f900 offset 140
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 1                Offsets:  140 to  651           Dba:0x01800001
------------------------------------------------------------------------
f9000000 7fe16233 3b040000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
06000000 05005a42 44424100 00000000 00000000 00000000 00000000 00000000
00000000 06000000 00000000 00000000 a3d96233 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 6b946b29 01000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 6c521e00 00000000
02e26233 01000000 4a000000 01580000 10000000 02000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100

<32 bytes per line>

BBED> modify /x f800 offset 148
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 1                Offsets:  148 to  659           Dba:0x01800001
------------------------------------------------------------------------
f8000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 06000000 05005a42
44424100 00000000 00000000 00000000 00000000 00000000 00000000 06000000
00000000 00000000 a3d96233 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 6b946b29 01000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 6c521e00 00000000 02e26233 01000000
4a000000 01580000 10000000 02000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 0d000d00 0d000100 00000000 00000000

<32 bytes per line>

BBED> sum apply
Check value for File 6, Block 1:
current = 0x1924, required = 0x1924

BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl11g/zbdba01.dbf
BLOCK = 1


DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED


BBED> show all
        FILE#           6
        BLOCK#          1
        OFFSET          148
        DBA             0x01800001 (25165825 6,1)
        FILENAME        /opt/oracle/oradata/orcl11g/zbdba01.dbf
        BIFILE          bifile.bbd
        LISTFILE        filelist.txt
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           80
        COUNT           512
        LOGFILE         log.bbd
        SPOOL           No

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001e526c
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x3362e202
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x0000004a
         ub4 kcrbabno                       @504      0x00005801
         ub2 kcrbabof                       @508      0x0010
   ub1 kcvcpetb[0]                          @512      0x02
   ub1 kcvcpetb[1]                          @513      0x00
   ub1 kcvcpetb[2]                          @514      0x00
   ub1 kcvcpetb[3]                          @515      0x00
   ub1 kcvcpetb[4]                          @516      0x00
   ub1 kcvcpetb[5]                          @517      0x00
   ub1 kcvcpetb[6]                          @518      0x00
   ub1 kcvcpetb[7]                          @519      0x00

BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x000000f9

BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x000000f8

BBED> 
修改完成后我们再次恢复该数据文件:
SYS@orcl11g>startup
ORACLE instance started.
Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             318769104 bytes
Database Buffers           92274688 bytes
Redo Buffers                4288512 bytes
Database mounted.
Database opened.
SYS@orcl11g>recover datafile 6;
Media recovery complete.
SYS@orcl11g>alter database datafile 6 online;

Database altered.






推荐阅读
  • 本文介绍了Linux内核中TCP的三种接收队列:Prequeue、sk_receive_queue和Backlog。这些队列在数据包处理过程中扮演着重要角色,帮助提高系统性能和效率。 ... [详细]
  • 工作中频繁在不同Linux服务器之间切换时,频繁输入密码不仅耗时还影响效率。本文介绍如何通过设置SSH密钥认证,简化登录流程,提高工作效率。 ... [详细]
  • 本文档提供了首次周测的答案解析,涵盖特殊符号、命令作用、路径说明以及实战练习等内容。 ... [详细]
  • 在日常运维中,频繁地对多台Linux服务器进行用户管理是一项耗时的任务。为了提高效率,可以通过编写Expect脚本来实现远程自动化操作,从而简化这一过程。 ... [详细]
  • 一键LNMP配置SSL证书实现全站HTTPS访问
    许多网站搭建者选择了便捷的一键LNMP安装包,但在网站部署完成后,配置SSL证书以支持HTTPS访问是一个不可或缺的步骤。本文将详细介绍如何通过简单的步骤完成这一过程。 ... [详细]
  • 现在的新手程序猿,动不动就是框架,就连外面培训的也是框架,我就问一句,没了框架是不是就啥也不会了 ... [详细]
  • 最新进展:作为最接近官方声明的信息源,本文吸引了大量关注。若需获取最新动态,请访问:lkhill.com/ccie-version-5-update ... [详细]
  • Kubernetes 实践指南:初次体验
    本文介绍了如何通过官方提供的简易示例,快速上手 Kubernetes (K8S),并深入理解其核心概念和操作流程。 ... [详细]
  • 微服务自动化.dockercompose
    目录一、docker-compose二、docker-compose安装与配置1、修改docker.service2、下载文件3、将刚才下载的docker-compose文 ... [详细]
  • 本文探讨了如何在Linux系统中利用iptables和NFQUEUE处理来自镜像端口的流量。当镜像端口的数据包目的MAC地址与主机MAC地址不符时,通常会导致流量无法被NFQUEUE捕获。文章提供了解决这一问题的方法。 ... [详细]
  • 分布式计算助力链力实现毫秒级安全响应,确保100%数据准确性
    随着分布式计算技术的发展,其在数据存储、文件传输、在线视频、社交平台及去中心化金融等多个领域的应用日益广泛。国际知名企业如Firefox、Google、Opera、Netflix、OpenBazaar等均已采用该技术,推动了技术创新和服务升级。 ... [详细]
  • 在Linux系统中使用EncFS实现文件夹加密
    为了保护个人隐私或敏感数据不被未经授权的访问,可以通过加密技术来增强安全性。本文介绍如何在Linux系统上使用EncFS工具创建和管理加密文件夹,以确保即使在系统登录状态下,特定文件夹中的数据也保持加密状态。 ... [详细]
  • 本文概述了在GNU/Linux系统中,动态库在链接和运行阶段的搜索路径及其指定方法,包括通过编译时参数、环境变量及系统配置文件等方式来控制动态库的查找路径。 ... [详细]
  • 本文概述了作者在2014年的几项目标与愿望,包括职业发展、个人成长及家庭幸福等方面的具体计划。 ... [详细]
  • Linux系统中的USB驱动架构
    USB系统采用了树状拓扑结构,其主机端和设备端分别配置了主机控制器(Host Controller)和USB设备控制器(USB Device Controller)。主机控制器负责整个USB系统的通信调度,确保数据的有效传输。 ... [详细]
author-avatar
o0大大脸么么小小鱼0o
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有