Automatic Block Repair
Automatic Block Repair
Reovery in
ACTIVE DATAGUARD
Automatic Block Repair
Automatic block repair allows corrupt data blocks to be automatically repaired as soon as
the corruption is detected.
Automatic block repair requires the use of the Oracle Active Data Guard option so
that you can open a physical standby database for read-write I/O. Also, note that this
feature requires that Oracle Data Guard is running in maximum availability mode
and has the LOG_ARCHIVE_DEST_n initialization parameter set to the SYNC redo
transport mode.
• The physical standby database must be operating in real-time query mode, which
requires an Active Data Guard license.
• The physical standby database must be running real-time apply.
• Automatic repair is supported with any Data Guard protection mode. However, the
effectiveness of repairing a corrupt block at the primary using the noncorrupt
version of the block from the standby depends on how closely the standby apply is
synchronized with the redo generated by the primary.
• When an automatic block repair has been performed, a message is written to the
database alert log.
• If automatic block repair is not possible, an ORA-1578 error is returned
ON PRIMARY
System altered.
SQL>
SQL> ALTER SYSTEM set log_archive_Dest_STATE_2=ENABLE;
System altered.
NAME
——————————
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
6 rows selected.
SQL>
SQL> create tablespace DEMO_CORRUPT datafile
‘/u01/app/oradata/DEMOP/demo_c_01.dbf’ size 500m;
Tablespace created.
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL>
SQL> /
System altered.
MAX(SEQUENCE#)
————–
85
SQL>
SQL>
SQL> create table t (int int) tablespace DEMO_CORRUPT;
Table created.
SQL>
SQL>
SQL> insert into t values (1);
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL>
SQL>
SQL>
SQL> commit;
Commit complete.
COUNT(*)
———-
12
SQL> select min(dbms_rowid.rowid_block_number(rowid))from t;
MIN(DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID))
—————————————–
132
NAME
——————————————————————————–
/u01/app/oradata/DEMOP/system01.dbf
/u01/app/oradata/DEMOP/sysaux01.dbf
/u01/app/oradata/DEMOP/undotbs01.dbf
/u01/app/oradata/DEMOP/users01.dbf
/u01/app/oradata/DEMOP/example01.dbf
/u01/app/oradata/DEMOP/demo_c_01.dbf
6 rows selected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@DGPRIM BACKUP]$
[oracle@DGPRIM BACKUP]$ su –
Password:
[root@DGPRIM ~]#
[root@DGPRIM ~]# dd if=/dev/zero of=/u01/app/oradata/DEMOP/demo_c_01.dbf
bs=8192 conv=notrunc seek=134 count=1
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 3.9642e-05 s, 207 MB/s
[root@DGPRIM ~]#
[root@DGPRIM ~]# logout
[oracle@DGPRIM BACKUP]$
[oracle@DGPRIM BACKUP]$
[oracle@DGPRIM BACKUP]$
[oracle@DGPRIM BACKUP]$ !sql
sqlplus “/as sysdba”
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@DGPRIM BACKUP]$ dbv file=/u01/app/oradata/DEMOP/demo_c_01.dbf
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Commit complete.
System altered.
COUNT(*)
———-
12
no rows selected
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ON STANDBY
NAME
——————————
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
6 rows selected.
OPEN_MODE
——————–
MOUNTED
SQL> alter database recover managed standby database using current logfile disconnect
from session;
Database altered.
NAME
——————————
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
DEMO_CORRUPT
7 rows selected.
MAX(SEQUENCE#)
————–
84
COUNT(*)
———-
12
SQL> select count(*) from t;
COUNT(*)
———-
12
SQL> /
COUNT(*)
———-
12
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options