千家信息网

Oracle中amdu_extract命令有什么作用

发表于:2024-11-12 作者:千家信息网编辑
千家信息网最后更新 2024年11月12日,本篇内容主要讲解"Oracle中amdu_extract命令有什么作用",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Oracle中amdu_extract
千家信息网最后更新 2024年11月12日Oracle中amdu_extract命令有什么作用

本篇内容主要讲解"Oracle中amdu_extract命令有什么作用",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Oracle中amdu_extract命令有什么作用"吧!

amdu_extract命令用来从磁盘组中抽取文件,其语法如下:

ASMCMD [+DATA/cs/DATAFILE] > help amdu_extractamdu_extract        Calls AMDU to extract  from Synopsis        amdu_extract   Description        The options for amdu_extract command are described below:        disk group - Name of the disk group containing the file to be extracted.                file       - Name of the file to be extracted. Can be specified as either an absolute or a relative path.        diskstring - Specifies the value for the discovery diskstring.Examples        The following example uses amdu_extract to extract the parameter file from the '+datafile'         disk group.        ASMCMD [+] > amdu_extract datafile +datafile/parameterfile/spfile.ora /devices/disk*

其中diskgroup为被抽取文件所在的磁盘组名字,file_name,被抽取文件的Oracle ASM别名,disk_string为Oracle ASM发现磁盘字符串。而且amdu_extract实际是调用的AMDU工具来抽取文件

查询数据库cs的所有数据文件,这里我们要抽取的文件名是JY.331.976296525

ASMCMD [+DATA/cs/DATAFILE] > ls -lrtWARNING:option 'r' is deprecated for 'ls'please use 'reverse'Type      Redund  Striped  Time             Sys  NameDATAFILE  UNPROT  COARSE   MAR 12 18:00:00  Y    SYSAUX.259.970598293DATAFILE  UNPROT  COARSE   MAR 12 18:00:00  Y    SYSTEM.258.970598233DATAFILE  UNPROT  COARSE   MAR 12 18:00:00  Y    UNDOTBS1.260.970598319DATAFILE  UNPROT  COARSE   MAR 12 18:00:00  Y    USERS.261.970598319DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    JY.331.976296525DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    SYSAUX.273.970601881DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    SYSTEM.272.970601831DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    TEST.326.976211663DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    UNDOTBS1.274.970601905DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    UNDOTBS2.284.970602381DATAFILE  UNPROT  COARSE   AUG 16 11:00:00  Y    USERS.275.970601909SQL> select name,file_number from v$asm_alias where file_number<>4294967295 and (name like '%jy%' or name like '%JY%');NAME                                                                                                                                         FILE_NUMBER-------------------------------------------------------------------------------------------------------------------------------------------- -----------JY.331.976296525                                                                                                                                     331ASMCMD [+DATA/cs/DATAFILE] > amdu_extract DATA +DATA/cs/DATAFILE/JY.331.976296525 /dev/asm*ASMCMD-8024: file number could not be determined for alias name '+DATA/cs/DATAFILE/JY.331.976296525' < ?pre>可以看到提示信息说通过文件别名不能判断文件号,实际上+DATA/cs/DATAFILE/JY.331.976296525是Oracle在ASM中创建的数据文件名,并不是别名。如是我们来手动为+DATA/cs/DATAFILE/JY.331.976296525增加别名jy01.dbf
SQL> alter diskgroup data add alias '+DATA/cs/DATAFILE/jy01.dbf' for '+DATA/cs/DATAFILE/JY.331.976296525';Diskgroup altered.SQL> select name,file_number from v$asm_alias where file_number<>4294967295 and (name like '%jy%' or name like '%JY%');NAME                                                                                                                                         FILE_NUMBER-------------------------------------------------------------------------------------------------------------------------------------------- -----------JY.331.976296525                                                                                                                                     331jy01.dbf                                                                                                                                             331ASMCMD [+DATA/cs/DATAFILE] > amdu_extract DATA +DATA/cs/DATAFILE/jy01.dbf /dev/asm*amdu_2018_08_16_19_17_42/
[grid@cs1 ~]$ ls -lrtdrwxr-xr-x 2 grid oinstall     40 Aug 16 19:17 amdu_2018_08_16_19_17_42[grid@cs1 ~]$ cd amdu_2018_08_16_19_17_42[grid@cs1 amdu_2018_08_16_19_17_42]$ ls -lrttotal 102416-rw-r--r-- 1 grid oinstall      8103 Aug 16 19:17 report.txt-rw-r--r-- 1 grid oinstall 104865792 Aug 16 19:17 DATA_331.f

使用amdu工具来抽取数据文件是指定Oracle ASM发现磁盘字符串和磁盘组.数据文件序号

[grid@cs2 ~]$ amdu -diskstring '/dev/asm*' -extract 'DATA.331'amdu_2018_08_16_19_20_59/AMDU-00204: Disk N0004 is in currently mounted diskgroup DATA.AMDU-00201: Disk N0004: '/dev/asmdisk04'[grid@cs2 ~]$ cd amdu_2018_08_16_19_20_59/[grid@cs2 amdu_2018_08_16_19_20_59]$ ls -lrttotal 102420-rw-r--r-- 1 grid oinstall      8291 Aug 16 19:21 report.txt-rw-r--r-- 1 grid oinstall 104865792 Aug 16 19:21 DATA_331.f

可以看到使用amdu与asmcmd的amdu_extract所抽取的同一个文件大小都是104865792。

到此,相信大家对"Oracle中amdu_extract命令有什么作用"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

0