In this Document
Purpose
Scope and Application
Extracting Datafile Blocks From ASM
References
Applies to:
Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.1.0.7Information in this document applies to any platform.
Purpose
Scope and Application
The approach presented here may be used with any ASM redundancy. It should be noted that this method requires the free space on the file system equivalent to the size of datafile being extracted.
This method can be used for datafiles, datafile copies and archived redo log files stored within ASM.
Extracting Datafile Blocks From ASM
Lets look at an example of corruption reported on an ASM datafile with normal redundancy. The objective is to extract the corrupted block from the datafile, patch it and put it back into the database.
1. Corruption reported:
SELECT COUNT(*) FROM T1
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 7, block # 65)
ORA-01110: data file 7: '+GROUPA/aa10g/datafile/ts_bane.267.3'
2. Take the file offline, to make sure there are no further changes while the block is being examined/patched.
Database altered.
3. Use RMAN 'BACKUP AS COPY DATAFILE' command to extract the datafile from ASM onto the file system:
connected to target database: AA10G (DBID=1449158500)
RMAN> BACKUP AS COPY DATAFILE 7 FORMAT '/tmp/df_%f';
Starting backup at
Uusing target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=215 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00007 name=+GROUPA/aa10g/datafile/ts_bane.267.3
output filename=/tmp/df_7 tag=TAG20041230T125410 recid=7 stamp=546267252
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at
4. Now that the file is on the file system, the OS command dd can be used to extract the block from the copy of the datafile:
5. Lets say that at this step the block has been examined and patched.
6. Put the patched block back into df_7:
7. Restore the patched datafile from the file system back into ASM:
connected to target database: AA10G (DBID=1449158500)
RMAN> run {
RESTORE DATAFILE 7 FROM TAG 'TAG20041230T125410';
RECOVER DATAFILE 7;
SQL "ALTER DATABASE DATAFILE 7 ONLINE";
}
Starting restore at
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=213 devtype=DISK
channel ORA_DISK_1: restoring datafile 00007
input datafilecopy recid=7 stamp=546267252 filename=/tmp/df_7
destination for restore of datafile 00007: +GROUPA/aa10g/datafile/ts_bane.267.3
channel ORA_DISK_1: copied datafilecopy of datafile 00007
output filename=+GROUPA/aa10g/datafile/ts_bane.267.3 recid=8 stamp=546267683
Finished restore at
Starting recover at
using channel ORA_DISK_1
starting media recovery
media recovery complete
Finished recover at
sql statement: ALTER DATABASE DATAFILE 7 ONLINE
RMAN>
8. Once the patched datafile has been restored, select from table T1 works as expected:
COUNT(*)
--------
1536
References
Oracle Database Recovery Manager Reference 10g Release 1 (10.1)Oracle Database Administrator's Guide 10g Release 1 (10.1),Chapter 12 Using Automatic Storage Management
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/38267/viewspace-743196/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/38267/viewspace-743196/