[20160816]11G dataguard壞塊修複.txt
--11GR2 不僅僅支援在備庫在隻讀的情況下,日志應用(ACTIVE Data Guard),還提供主備庫的壞塊修複.自己以前也做過相關測試,
--我記得上次測試的僅僅是主庫資料塊損壞,沒有測試備庫的資料塊損壞.補充一些測試:
1.環境:
SYS@test> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.3.0 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
DGMGRL> show configuration
Configuration - study
Protection Mode: MaxPerformance
Databases:
test - Primary database
testdg - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
2.建立測試資料塊:
create table empx tablespace testmssm as select * fromo emp ;
SCOTT@test> select rowid,empx.* from empx where rownum=1;
ROWID EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
------------------ ---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
AABLsNAAJAAAACJAAA 7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
SCOTT@test> @ &r/rowid AABLsNAAJAAAACJAAA
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
310029 9 137 0 0x2400089 9,137 alter system dump datafile 9 block 137 ;
--//安全起見,備份資料檔案.
RMAN> backup datafile 9 format '/data/testtest/testmssm_%U';
Starting backup at 2016-08-16 10:11:44
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/app/oracle11g/oradata/test/testmssm01.dbf
channel ORA_DISK_1: starting piece 1 at 2016-08-16 10:11:46
channel ORA_DISK_1: finished piece 1 at 2016-08-16 10:11:49
piece handle=/data/testtest/testmssm_bhrdcsr2_1_1 tag=TAG20160816T101145 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2016-08-16 10:11:50
Starting Control File and SPFILE Autobackup at 2016-08-16 10:11:51
piece handle=/u01/app/oracle11g/flash_recovery_area/TEST/autobackup/2016_08_16/o1_mf_s_920023912_cv4xmb2m_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2016-08-16 10:11:55
SCOTT@test> alter system checkpoint;
System altered.
SCOTT@test> alter system flush buffer_cache;
3.使用bbed破壞(主庫):
BBED> set dba 9,137
DBA 0x02400089 (37748873 9,137)
BBED> corrupt
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.
--測試:
select rowid,empx.* from empx where rownum=1
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 9, block # 137)
ORA-01110: data file 9: '/u01/app/oracle11g/oradata/test/testmssm01.dbf'
--檢查主庫alert*.log
Tue Aug 16 10:13:11 2016
Errors in file /u01/app/oracle11g/diag/rdbms/test/test/trace/test_ora_11093_127_0_0_1.trc (incident=3145807):
Incident details in: /u01/app/oracle11g/diag/rdbms/test/test/incident/incdir_3145807/test_ora_11093_i3145807.trc
Tue Aug 16 10:13:16 2016
Sweep [inc][3145807]: completed
Dumping diagnostic data in directory=[cdmp_20160816101316], requested by (instance=1, osid=11093), summary=[incident=3145807].
Tue Aug 16 10:13:17 2016
Sweep [inc2][3145807]: completed
Checker run found 1 new persistent data failures
Tue Aug 16 10:13:26 2016
Errors in file /u01/app/oracle11g/diag/rdbms/test/test/trace/test_ora_11093_127_0_0_1.trc (incident=3145808):
Incident details in: /u01/app/oracle11g/diag/rdbms/test/test/incident/incdir_3145808/test_ora_11093_i3145808.trc
Tue Aug 16 10:13:28 2016
Dumping diagnostic data in directory=[cdmp_20160816101328], requested by (instance=1, osid=11093), summary=[incident=3145808].
Starting background process ABMR
Tue Aug 16 10:13:29 2016
ABMR started with pid=46, OS id=17268
Automatic block media recovery service is active.
Automatic block media recovery requested for (file# 9, block# 137)
Tue Aug 16 10:13:30 2016
Automatic block media recovery successful for (file# 9, block# 137)
4.使用bbed破壞(備庫):
SCOTT@testdg> select rowid,empx.* from empx where rownum=1;
--檢查備庫alert*.log
Dumping diagnostic data in directory=[cdmp_20160816101617], requested by (instance=1, osid=6960), summary=[incident=152714].
Errors in file /u01/app/oracle11g/diag/rdbms/testdg/testdg/trace/testdg_ora_6960_127_0_0_1.trc (incident=152715):
Incident details in: /u01/app/oracle11g/diag/rdbms/testdg/testdg/incident/incdir_152715/testdg_ora_6960_i152715.trc
Tue Aug 16 10:16:20 2016
Dumping diagnostic data in directory=[cdmp_20160816101621], requested by (instance=1, osid=6960), summary=[incident=152715].
--仔細檢查可以發現如果備庫發現問題,不會啟動ambr程序,而是通過主庫傳輸
--備庫:
$ ps -ef | grep abm[r]
--主庫:
503 17268 1 0 10:13 ? 00:00:00 ora_abmr_test