Use ODU to list and extract any files in ASM diskgroups
Posted: February 18th, 2012Sometimes, ASM diskgroups can not be mounted for some reason, but the database related files are still intact in them, in that situation we can use ODU to extract any files in the ASM diskgroups which can not be mounted to the file system.
When an ASM diskgroup is mounting, Oracle needs to verify the numerous ASM metadata, if some ASM metadata are corrupted, then the ASM diskgroup can not be mounted. But ODU may still be able to extract data files in that situation because we just only need one type of the ASM metadata to complete the extract function. At the same time, ODU can extract any files in ASM diskgroups, including data files, archive log files, parameter file, online log files, control files and RMAN backup files.
Below is an example to demonstrate how to use ODU to list and extract files in ASM diskgroups. Note: the ODU trial version can only list the files (can not extract) in ASM diskgroups.
First of all, you need to configure the asmdisk.txt file (the details of the asmdisk.txt and config.txt are not detailed here, please refer to the ODU user’s guide):
[oracle@xty odu]$ cat asmdisk.txt
# disk# path group_name meta_block_size ausize disk_size header_offset
1 /dev/sdb1
2 /dev/sdb2
3 /dev/sdb3
Enter into the ODU:
[oracle@xty odu]$ ./odu
Oracle Data Unloader:Release 4.2.3
Copyright (c) 2008,2009,2010,2011 XiongJun. All rights reserved.
Web: http://www.oracleodu.com
Email: magic007cn@gmail.com
loading default config…….
byte_order little
block_size 8192
db_timezone -7
Invalid db timezone:-7
client_timezone 8
Invalid client timezone:8
asmfile_extract_path /oradata/asmfile
data_path data
lob_path /odu/data
charset_name ZHS16GBK
ncharset_name AL16UTF16
output_format text
lob_storage infile
clob_byte_order big
trace_level 1
delimiter |
unload_deleted no
file_header_offset 0
is_tru64 no
record_row_addr no
convert_clob_charset yes
use_scanned_lob yes
trim_scanned_blob yes
lob_switch_dir_rows 1000
db_block_checksum yes
db_block_checking yes
rdba_file_bits 10
compatible 10
trace.trace_filename odu_trace.txt
trace.build_hash_table 0
trace.trace_asm 4
load config file ‘config.txt’ successful
loading default asm disk file ……
grp# dsk# bsize ausize disksize diskname groupname path
—- —- —– —— ——– ————— ————— ——————————————–
1 1 4096 1024K 1024 DGDATA_0001 DGDATA /dev/sdb1
1 0 4096 1024K 1024 DGDATA_0000 DGDATA /dev/sdb2
1 2 4096 1024K 1024 DGDATA_0002 DGDATA /dev/sdb3
load asm disk file ‘asmdisk.txt’ successful
loading default control file ……
ts# fn rfn bsize blocks bf offset filename
—- —- —- —– ——– — —— ——————————————–
0 1 1 8192 44800 N 0 +DGDATA/xty/datafile/system.260.745630773
1 2 2 8192 25600 N 0 +DGDATA/xty/datafile/undotbs1.261.745630805
2 3 3 8192 16640 N 0 +DGDATA/xty/datafile/sysaux.262.745630817
4 4 4 8192 1440 N 0 +DGDATA/xty/datafile/users.264.745630833
load control file ‘oductl.dat’ successful
loading dictionary data……done
loading scanned data……done
Enter asmcmd in “ODU>” command prompt to enter into the asmcmd command module:
ODU> asmcmd
Entering asmcmd module.
Use the ls command to list the directories and files, use the pwd command to view the current directory, use the cd command to enter into the directory. Note that, when you at the top of the virtual directory <root> and you want to enter into a diskgroup, you must add "+" before the diskgroup name. In addition, the files and directory names in an ASM diskgroup are not case-sensitive.
ASMCMD> ls
Current directory: <root>
Disk Group
————————————
DGDATA
ASMCMD> cd +dgdata
Current directory: +DGDATA
ASMCMD> pwd
Current directory: +DGDATA
ASMCMD> ls
Current directory: +DGDATA
Name
—————————————-
XTY <DIR>
TESTDIR <DIR>
TestDIR2 <DIR>
ASMCMD> cd XTY
Current directory: +DGDATA/XTY
ASMCMD> ls
Current directory: +DGDATA/XTY
Name
—————————————-
CONTROLFILE <DIR>
ONLINELOG <DIR>
DATAFILE <DIR>
TEMPFILE <DIR>
PARAMETERFILE <DIR>
spfilexty.ora => +DGDATA.265.745631905
ASMCMD> pwd
Current directory: +DGDATA/XTY
Use the cp command to extract (copy) files to file system:
ASMCMD> cp spfilexty.ora to /oracle/spfile.ora
starting copy asm file ‘+DGDATA/XTY/spfilexty.ora’ to ‘/oracle/spfile.ora’,file size is 4608
asm file copy completed.
ASMCMD> cd controlfile
Current directory: +DGDATA/XTY/CONTROLFILE
ASMCMD> ls
Current directory: +DGDATA/XTY/CONTROLFILE
Name
—————————————-
Current.256.745630761
ASMCMD> cp Current.256.745630761 to /oracle/control.ora
starting copy asm file ‘+DGDATA/XTY/CONTROLFILE/Current.256.745630761’ to ‘/oracle/control.ora’,file size is 7618560
asm file copy completed.
We can check the extracted file:
[oracle@xty odu]$ cd /oracle
[oracle@xty ~]$ strings spfile.ora
xty.__db_cache_size=369098752
xty.__java_pool_size=4194304
xty.__large_pool_size=4194304
xty.__shared_pool_size=138412032
xty.__streams_pool_size=0
*.audit_file_dest=’/oracle/app/oracle/admin/xty/adump’
*.background_dump_dest=’/oracle/app/oracle/admin/xty/bdump’
*.compatible=’10.2.0.5.0′
…忽略部分输出…
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_target=524288000
*.standby_archive_dest=’/arch/xty_stb’
*.standby_file_management=’auto’
*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS1′
*.user_dump_dest=’/oracle/app/oracle/admin/xty/udump’
The first parameter of the cp command, means the target ASM files which stored in the ASM diskgroup you want to extract, can be a relative path, also can be an absolute path, can be the actual file name, can also be an alias:
spfilexty.ora => +DGDATA.265.745631905
The above output shows that the spfilexty.ora is an alias, the actual file is the file 265 in the ASM diskgroup DGDATA.
Run the exit command to exit the asmcmd module, back to the ODU prompt:
ASMCMD> exit
Exiting asmcmd module.
Now we make another demo, we extract a datafile and do a verification to show the ODU cp command really works:
ODU> asmcmd
Entering asmcmd module.
ASMCMD> cp +dgdata/xty/datafile/SYSTEM.260.745630773 to /oracle/system.dbf
starting copy asm file ‘+dgdata/xty/datafile/SYSTEM.260.745630773’ to ‘/oracle/system.dbf’,file size is 367009792
asm file copy completed.
ASMCMD> exit
Exiting asmcmd module.
ODU> exit
[oracle@xty odu]$ dbv file=/oracle/system.dbf blocksize=8192
DBVERIFY: Release 10.2.0.5.0 – Production on Sat Feb 18 18:30:07 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY – Verification starting : FILE = /oracle/system.dbf
DBVERIFY – Verification complete
Total Pages Examined : 44800
Total Pages Processed (Data) : 28974
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 4641
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1823
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 9362
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 391159 (0.391159)
As you can see, the SYSTEM data file which is extracted by ODU is intact.