首页 > 其他分享 >BBED修改文件头,将ASM非归档模式下offline的数据文件改回online状态

BBED修改文件头,将ASM非归档模式下offline的数据文件改回online状态

时间:2023-12-06 21:11:21浏览次数:29  
标签:datafile racdb 1040862 DG ONLINE online offline BBED DATA

1、故障概要

一套基于ASM的RAC数据库,处于非归档模式,现场人员误将其中的一个数据文件改成了offline状态,等到发现异常时,redo日志已经被覆盖,没有办法recover该数据文件。

本文主要记录测试环境模拟本故障,以及使用BBED修复的过程。

 

2、故障模拟及处理办法

(1)、准备环境,创建一个名为test的表空间,该表空间下有4个数据文件,然后在该表空间下存放一些数据:

drop user test cascade;

drop   tablespace test including contents and datafiles;

 

create tablespace test     datafile '+dg_data' size 10m;

alter  tablespace test add datafile '+dg_data' size 10m;

alter  tablespace test add datafile '+dg_data' size 10m;

alter  tablespace test add datafile '+dg_data' size 10m;

 

create user test identified by test;

grant dba to test;

conn test/test

create table mm tablespace test as select * from dba_objects;

 

(2)、模拟故障,将test表空间下的某个数据文件置于offline状态,同时多次切换日志,后期进行recover操作时,会提示无法找到日志文件。

alter database datafile 9 offline drop;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

 

SQL> select file_name, file_id, online_status from dba_data_files;

FILE_NAME                                                       FILE_ID ONLINE_

------------------------------------------------------------ ---------- -------

+DG_DATA/racdb/datafile/users.274.1154847857                          4 ONLINE

+DG_DATA/racdb/datafile/undotbs1.270.1154847857                       3 ONLINE

+DG_DATA/racdb/datafile/sysaux.259.1154847857                         2 ONLINE

+DG_DATA/racdb/datafile/system.275.1154847857                         1 SYSTEM

+DG_DATA/racdb/datafile/undotbs2.262.1154847967                       5 ONLINE

+DG_DATA/racdb/datafile/test.265.1154869715                           6 ONLINE

+DG_DATA/racdb/datafile/test.257.1154869715                           7 ONLINE

+DG_DATA/racdb/datafile/test.287.1154869717                           8 ONLINE

+DG_DATA/racdb/datafile/test.267.1154869719                           9 RECOVER

 

(3)、模拟常规的恢复步骤,recover数据文件时,由于是非归档模式,需要的redo日志已经被覆盖。

SQL> alter database datafile 9 online;

alter database datafile 9 online

*

ERROR at line 1:

ORA-01113: file 9 needs media recovery

ORA-01110: data file 9: '+DG_DATA/racdb/datafile/test.258.1154811361'

 

SQL>

SQL> recover datafile 9;

ORA-00279: change 971756 generated at 12/05/2023 20:56:01 needed for thread 1

ORA-00289: suggestion :

/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_5_1154807853.dbf

ORA-00280: change 971756 for thread 1 is in sequence #5

 

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log

'/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_5_1154807853.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

 

ORA-00308: cannot open archived log

'/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_5_1154807853.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

 

(4)、将数据文件从ASM 复制到文件系统中,bbed修复,修复完成后,再将修复后的数据文件复制回ASM。

[grid@11grac1 ~]$ asmcmd cp +DG_DATA/racdb/datafile/test.267.1154869719 /tmp/datafile9

 

bbed修改/tmp/datafile9这个文件的SCN号:

SQL> select file#,checkpoint_change# from v$datafile_header;

 

     FILE# CHECKPOINT_CHANGE#

---------- ------------------

         1            1040862

         2            1040862

         3            1040862

         4            1040862

         5            1040862

         6            1040862

         7            1040862

         8            1040862

         9            1040312

 

9 rows selected.

 

SQL>

 

1040862(十进制) =>  0FE1DE(十六进制)

 

set dba 9,1

set offset 484

m /x DEE10F

sum apply

 

[grid@11grac1 ~]$ asmcmd cp /tmp/datafile9 +DG_DATA

copying /tmp/datafile9 -> +DG_DATA/datafile9

 

SQL> alter database rename file '+DG_DATA/racdb/datafile/test.267.1154869719' to '+DG_DATA/datafile9';

 

Database altered.

 

SQL> select file#,checkpoint_change# from v$datafile_header;

 

     FILE# CHECKPOINT_CHANGE#

---------- ------------------

         1            1040862

         2            1040862

         3            1040862

         4            1040862

         5            1040862

         6            1040862

         7            1040862

         8            1040862

         9            1040862

 

9 rows selected.

 

SQL> recover datafile 9;

Media recovery complete.

SQL> alter database datafile 9 online;

 

Database altered.

 

SQL>

SQL> select file_name, file_id, online_status from dba_data_files;

 

FILE_NAME                                                       FILE_ID ONLINE_

------------------------------------------------------------ ---------- -------

+DG_DATA/racdb/datafile/users.274.1154847857                          4 ONLINE

+DG_DATA/racdb/datafile/undotbs1.270.1154847857                       3 ONLINE

+DG_DATA/racdb/datafile/sysaux.259.1154847857                         2 ONLINE

+DG_DATA/racdb/datafile/system.275.1154847857                         1 SYSTEM

+DG_DATA/racdb/datafile/undotbs2.262.1154847967                       5 ONLINE

+DG_DATA/racdb/datafile/test.265.1154869715                           6 ONLINE

+DG_DATA/racdb/datafile/test.257.1154869715                           7 ONLINE

+DG_DATA/racdb/datafile/test.287.1154869717                           8 ONLINE

+DG_DATA/datafile9                                                    9 ONLINE

 

3、建议

上述过程,是将整个数据文件复制到文件系统中进行修复,如果数据文件比较大,可以考虑将特定的数据块使用dd工具复制到文件系统中进行修改,修改完成后,再使用dd工具将数据块复制回ASM的磁盘中。

 

标签:datafile,racdb,1040862,DG,ONLINE,online,offline,BBED,DATA
From: https://www.cnblogs.com/missyou-shiyh/p/17880539.html

相关文章

  • Online Learning
    OnlineLearning1.网上学习比较普遍2.产生这种现象的原因3.这种现象可能带来的影响参考范文:OnlineLearningPerhapsthereissomethingyoudon'tknowhowtodoTTnthepast,youmightturntoafriendorarelative,attendanightclassorgotothelocallibr......
  • bbed包(linux和Windows).zip
     一.10glinux编译BBED[oracle@node3~]$cd$ORACLE_HOME/rdbms/lib[oracle@node3lib]$make-fins_rdbms.mkBBED=$ORACLE_HOME/bin/bbed$ORACLE_HOME/bin/bbed直接生成到bin下为可执行文件编译完成后:编译成功后登陆BBED,登陆时需要密码(BBED的默认密码是blockedit)[ora......
  • P7470 [NOI Online 2021 提高组] 岛屿探险
    我永远喜欢数据结构。题目传送门给出\(n\)个二元组\((a_i,b_i)\),有\(q\)次询问,每次给出\(l_i,r_i,c_i,d_i\),求有多少个\(j\)满足\(j\in[l_i,r_i]\)且\(a_j\oplusc_i\le\min\{b_j,d_i\}\)。\(n,q\le10^5\),设值域为\(V\),\(|V|\le2^{24}\)。\(2.00\,\text......
  • offline RL | BCQ:学习 offline dataset 的 π(a|s),直接使用 (s, π(s)) 作为 Q learni
    题目:Off-PolicyDeepReinforcementLearningwithoutExploration,ICLR2019pdf版本:https://arxiv.org/pdf/1812.02900.pdfhtml版本:https://ar5iv.labs.arxiv.org/html/1812.02900GitHub:https://github.com/sfujim/BCQ参考博客:https://zhuanlan.zhihu.com/p/493039753,......
  • offline RL | IQL:通过 sarsa 式 Q 更新避免 unseen actions
    题目:OfflineReinforcementLearningwithImplicitQ-Learning,SergeyLevine组,2022ICLR,568。pdf版本:https://arxiv.org/pdf/2110.06169.pdfhtml版本:https://ar5iv.labs.arxiv.org/html/2110.06169openreview:https://openreview.net/forum?id=68n2s9ZJWF8github:h......
  • offline RL | TD3+BC:在最大化 Q advantage 时添加 BC loss 的极简算法
    题目:AMinimalistApproachtoOfflineReinforcementLearning,NeurIPS2021,8775。pdf版本:https://arxiv.org/pdf/2106.06860.pdfhtml版本:https://ar5iv.labs.arxiv.org/html/2106.06860(感觉写的蛮好的)openreview:https://openreview.net/forum?id=Q32U7dzWXpcgithub......
  • Pset_AnnotationLineOfSight
    Pset_AnnotationLineOfSightPSET_TYPEDRIVENOVERRIDE / IfcAnnotation / LineOfSight注释视线:指定两个图元之间连接点处的视线特性。通常用于定义两条道路(尤其是通道和公共道路之间)交界处的视线可见性。: Définitiondel'IAI:spécifielespropriétésdu......
  • RLHF · PBRL | 发现部分 D4RL tasks 不适合做 offline reward learning 的 benchmark
    论文题目:BenchmarksandAlgorithmsforOfflinePreference-BasedRewardLearning,TMLR20230103发表。openreview:https://openreview.net/forum?id=TGuXXlbKsnpdf版本:https://arxiv.org/pdf/2301.01392.pdfhtml版本:https://ar5iv.labs.arxiv.org/html/2301.01392目......
  • [题解] P6569 [NOI Online #3 提高组] 魔法值
    P6569[NOIOnline#3提高组]魔法值不放简要题意了,题面写的很简要。看到数据范围自然可以想到矩阵快速幂优化。但乘法对异或没有分配律。所以直接拆位,把异或变成加法对二取模就有分配律了。还有一个优化就是提前预处理出矩阵的2的幂次方,然后询问时直接二进制分解乘起来就行......
  • [20231103]rename IDL_UB1$后使用bbed的恢复3.txt
    [20231103]renameIDL_UB1$后使用bbed的恢复3.txt--//上午解决renameIDL_UB1$后使用bbed的恢复问题,就是涉及到的5个索引4个需要修改,其中一个因为NULL值的缘故,不需要修改。--//主要原因是rename是delete再insertobj$,反过来思考,如果修改时长度等长,我仅仅需要name等于原来的字符......