本篇内容主要讲解“Oracle中amdu_extract命令有什么作用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Oracle中amdu_extract命令有什么作用”吧!
成都创新互联公司是一家专业提供延庆企业网站建设,专注与成都网站设计、成都网站制作、外贸网站建设、H5建站、小程序制作等业务。10年已为延庆众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。
amdu_extract命令用来从磁盘组中抽取文件,其语法如下:
ASMCMD [+DATA/cs/DATAFILE] > help amdu_extract amdu_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 -lrt WARNING:option 'r' is deprecated for 'ls' please use 'reverse' Type Redund Striped Time Sys Name DATAFILE UNPROT COARSE MAR 12 18:00:00 Y SYSAUX.259.970598293 DATAFILE UNPROT COARSE MAR 12 18:00:00 Y SYSTEM.258.970598233 DATAFILE UNPROT COARSE MAR 12 18:00:00 Y UNDOTBS1.260.970598319 DATAFILE UNPROT COARSE MAR 12 18:00:00 Y USERS.261.970598319 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y JY.331.976296525 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y SYSAUX.273.970601881 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y SYSTEM.272.970601831 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y TEST.326.976211663 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y UNDOTBS1.274.970601905 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y UNDOTBS2.284.970602381 DATAFILE UNPROT COARSE AUG 16 11:00:00 Y USERS.275.970601909 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 331 ASMCMD [+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 331 jy01.dbf 331 ASMCMD [+DATA/cs/DATAFILE] > amdu_extract DATA +DATA/cs/DATAFILE/jy01.dbf /dev/asm* amdu_2018_08_16_19_17_42/
[grid@cs1 ~]$ ls -lrt drwxr-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 -lrt total 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 -lrt total 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命令有什么作用”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!