Extracting Datafile Blocks From ASM
来源:互联网 发布:vscode 标签自动补全 编辑:程序博客网 时间:2024/06/05 06:58
This note explains how to use RMAN to copy an ASM based datafile onto the file system. Once the datafile is on the file system, the OS command dd can be used to extract the block(s) from the datafile.
-- 注意,用dd 命令修复坏块 只适用与逻辑坏块。 物理坏块不适用。
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:
SQL> SELECT COUNT(*) FROM T1;
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.
SQL> alter database datafile 7 offline;
Database altered.
3. Use RMAN 'BACKUP AS COPY DATAFILE' command to extract the datafile from ASM onto the file system:
RMAN> CONNECT TARGET;
connected to target database: AA10G (DBID=1449158500)
RMAN> BACKUP AS COPY DATAFILE 7 FORMAT '/tmp/df_%f';
Starting backup at <date>
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 <date>
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:
$ dd if=df_7 of=f7b65.dd count=1 skip=65 bs=8192
5. Lets say that at this step the block has been examined and patched.
6. Put the patched block back into df_7:
$ dd if=f7b65.dd of=df_7 bs=8192 seek=65 count=1 conv=notrunc
7. Restore the patched datafile from the file system back into ASM:
RMAN> CONNECT TARGET;
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 <date>
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 <date>
Starting recover at <date>
using channel ORA_DISK_1
starting media recovery
media recovery complete
Finished recover at <date>
sql statement: ALTER DATABASE DATAFILE 7 ONLINE
RMAN>
8. Once the patched datafile has been restored, select from table T1 works as expected:
SQL> SELECT COUNT(*) FROM T1;
COUNT(*)
--------
1536
From Oracle
-------------------------------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
Email: dvd.dba@gmail.com
DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群: 83829929 DBA5群: 142216823
聊天 群:40132017 聊天2群:69087192
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
- Extracting Datafile Blocks From ASM
- Moving a datafile from Filesystem to ASM
- Extracting DDLs from Oracle
- Extracting Metada From Files
- How to move a datafile from a file system to ASM
- How to move a datafile from ASM to the file system
- How to copy a datafile from ASM to a file system not using RMAN
- How to move a datafile from a file system to ASM (Doc ID 390274.1)
- How to move a datafile from a file system to ASM (Doc ID 390274.1)
- How to move a datafile from a file system to ASM
- Extracting Files from RPM Packages
- Python.Extracting Data from XML
- Python.Extracting Data from JSON
- dd复制ASM中的datafile
- How to copy a datafile from ASM to a file system not using RMAN (Doc ID 428893.1)
- Extracting Multiple Resultsets from a DataReader
- Extracting Structured Data from Web Pages
- Extracting Information from Text With NLTK
- eclipse插件开发流程
- java 中 char 和 byte 的转换
- Borland® AppServer™ v6.7
- eclipse插件开发总结
- Java单例模式:饿汉式和懒汉式的实现
- Extracting Datafile Blocks From ASM
- asp.net state manage
- 内核模块相关命令:lsmod,depmod,modprob...
- Red Hat Linux Enterprise 4上安装swftools-0.9.1 版本
- iPad应用开发实战
- CWINDOWSsystem32 1025, 1028, 1031, 1033, 1037, 1041, 1053, 2052 & 3076
- Flex和Java通信之开发方式和工具准备(myeclipse6.5+flex Builder3.0+BlazeDS+tomcat6.0)
- 记录一下近况 11.04.22
- VMware虚拟机联网的几种可选方法