共计 3758 个字符,预计需要花费 10 分钟才能阅读完成。
本篇内容主要讲解“Oracle 中 amdu_extract 命令有什么作用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让丸趣 TV 小编来带大家学习“Oracle 中 amdu_extract 命令有什么作用”吧!
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 命令有什么作用”有了更深的了解,不妨来实际操作一番吧!这里是丸趣 TV 网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
正文完