abmr:在asm 环境中测试automatic block recover 特性的方法 参考原文: abmr: how to test automatic block recover feature with asm setup (doc id 1510090.1) 适用于: oracle database - enterprise edition - version 11.2.0.3 and later information
abmr:在asm 环境中测试automatic block recover 特性的方法
参考原文:
abmr: how to test automatic block recover feature with asm setup (doc id 1510090.1)
适用于:
oracle database - enterprise edition - version 11.2.0.3 and later
information in this document applies to any platform.
目标:
警告---注意:本文提供的步骤仅限于测试abmr特性的目的,并且仅能在测试环境中执行。
本文描述了:在一个standby 环境中,产生block corruption 的步骤 以及 recover 坏块,
recover 坏块 使用的是abmr ( auto bmr background process ) 特性
本文只用于测试目的下的 使用外部冗余的asm 环境。
作为一个预先需求,主库和备库应该被适当配置并工作正常(即:同步正常)
环境是实时应用下的 physical standby database:
sql> select database_role, open_mode from v$database; --> from standby
database_role open_mode
---------------- --------------------
physical standby read only with apply
解决方案:
1) 在asm中建立一个tablespace,
sql> create tablespace test datafile '+/..../datafile/test1.dbf' size 1m autoextend on;
2)在上一步建立的表空间中建立表,并在表中注入测试数据。
sql> create table abmr_test tablespace test as select * from all_objects;
sql> commit;
--->注意:commit可以不要,因为ddl是隐含提交的。原文如此。
3)offline the tablespace,然后把datafile 拷贝到文件系统中。
sql> alter tablespace test offline;
4)调用asmcmd
$ asmcmd -p
asmcmd [+] > cp +/.../datafile/test1.dbf /tmp/.
5)破坏这个datafile
dd of=/tmp/test1.dbf bs=8192 conv=notrunc seek=11
6)运行dbv 确认该文件损坏(corruption)
dbv file=/tmp/test1.dbf blocksize=8192 feedback=10000
7) 把这个文件拷贝回asm,然后使用dbv验证坏块
$ asmcmd -p
asmcmd [+] > cp /tmp/test1.dbf +/.../datafile/test1.dbf
$ dbv file= /tmp/test1.dbf +/.../datafile/test1.dbf userid=../.. blocksize=8192 feedback=10000
8)online datafile
sql> alter tablespace test online;
9)查询表--验证 automatic block recovery启动并修复了损坏的blocks
sql> select * from abmr_test;
10)tail -f alert.log,会看到ambr进程正在工作:
automatic block media recovery service is active.
automatic block media recovery requested for (file# 9, block# 11)
..........
automatic block media recovery successful for (file# 9, block# 11)
上面的测试过程是于abmr 相关的。
当使用rman 引入(制造)一个坏块,通过拷贝file到os,损坏该文件,然后restore 到原来位置,这么制造坏块,abmr是不工作的
这是因为当restore时,rman本身会检测到corrupt 并且会在alert中爆出ora-01578错误
当rman 检测到corrupt时, the 'auto bmr' 特性不会被触发。
参考:
note : 1266059.1 abmr: how to test automatic block recover feature