ASMCMD简介(1)

001、在ASM实例中,所有的存储于ASM磁盘组中的文件对于操作系统命令而言是不可访问的,因此也无法使用常规的命令来操纵ASM磁盘中的文件。如此一来,势必要有可替代的工具来完成这部分操作,这个替代的工具就是asmcmd。
官方文档是这样描述的: ASMCMD is a command-line utility that you can use to manage Oracle ASM instances, disk groups, file access control for disk groups, files and directories within disk groups, templates for disk groups, and volumes.意即:ASMCMD是一个命令行实用工具,你可以使用它来管理Oracle ASM实例,磁盘组,磁盘组的文件访问控制,磁盘组中的文件和目录,磁盘组的模板和卷。

下面是进入asmcmd后输入help得到的帮助说明,帮助说明描述了asmcmd的一些基本语法和通过help能查看具体用法的asmcmd命令。

点击(此处)折叠或打开

  1. ASMCMD> help
  2.         
  3.             asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege ] [-p] [command]
  4. asmcmd_no_conn_str

  5.         Starts asmcmd (if no parameters) or executes the command with given parameters

  6.         asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege ] [-p] [command]

  7.         Specify the connect string after the -c option to use the listener to
  8.         connect. By default, ASMCMD asks for a password in a non-echoing
  9.         prompt, unless the password is specified as part of the connect string.

  10.         The connect identifier is in the form of "host:port:sid", with the
  11.         host and the port being option. Host defaults to "localhost" and port
  12.         to 1521. If the sid is not specified as a part of the connect
  13.         identifier, then it is read from the environment variable ORACLE_SID.

  14.         If no connect string is used, then environment variables
  15.         ORACLE_HOME and ORACLE_SID determine the instance to which the program
  16.         connects, and asmcmd establishes a bequeath connection to the it, in
  17.         the same manner as a SQLPLUS / AS SYSASM. The user must be a member
  18.         of the SYSDBA group to exercise this option.

  19.         Specifying the -V option prints the asmcmd version number and
  20.         exits immediately.

  21.         Specifying the -v option prints extra information that can help
  22.         advanced users diagnose problems.

  23.         Specify the --privilege option to choose the type of connection. There are
  24.         only two possibilities: connecting as SYSASM or as SYSDBA.
  25.         The default value if this option is unspecified is SYSASM:

  26.         Specifying the -p option allows the current directory to be displayed
  27.         in the command prompt, like so:

  28.         ASMCMD [+DATA/ORCL/CONTROLFILE] >

  29.         The parameter command specifies one of the following commands, along
  30.         with its parameters.

  31.         Type "help [command]" to get help on a specific ASMCMD command.

  32.         commands:
  33.         --------

  34.         md_backup, md_restore

  35.         lsattr, setattr

  36.         cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
  37.         mkdir, pwd, rm, rmalias

  38.         chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
  39.         offline, online, rebal, remap, umount

  40.         dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
  41.         spmove, spset, startup

  42.         chtmpl, lstmpl, mktmpl, rmtmpl

  43.         chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
  44.         mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

  45.         volcreate, voldelete, voldisable, volenable, volinfo
  46.         volresize, volset, volstat

2、如果在服务器上有多个ASM实例,那么在进入ASM之前需要用export ORACLE_SID=***,将ORACLE_SID变量设置为你想访问的ASM实例。

3、ASMCMD中的命令分成如下几类:
Category Commands

ASMCMD Instance Management Commands

dsgetdssetlsctlsoplspwusrorapwusrshutdownspbackup,spcopyspgetspmovespsetstartup



ASMCMD File Management Commands



cd
cpdufindlslsofmkaliaspwdrmrmalias



ASMCMD Disk Group Management Commands



chdg
chkdgdropdgiostatlsattrlsdglsdsklsodmd_backup,md_restoremkdgmountofflineonlinerebalremapsetattrumount

ASMCMD Template Management Commands

chtmpllstmplmktmplrmtmpl




ASMCMD File Access Control Commands

chgrpchmodchowngroupsgrpmodlsgrplsusrmkgrpmkusr,passwdrmgrprmusr



ASMCMD Volume Management Commands



volcreate
voldeletevoldisablevolenablevolinfovolresizevolset,volstat



4、ASMCMD工具有两种使用方式,一种是交互方式,即在命令行输入ASMCMD后就可以进入到ASMCMD的交互模式,另一种则是在每次输入ASMCMD的命令的开头都加上一个asmcmd(必须是小写,Linux上是区分大小写),即非交互模式。交互模式提供了一个可以类似shell的供你输入ASMCMD命令的环境;非交互式则适用于运行脚本。

5、在ASM中经常出现的“+”号代表着ASM目录层级中的根目录,就像文件系统中的根目录“/”一样,+data就等于文件系统中的/data。

6、fully qualified filename:完全限定的文件名

7、在命令行输入asmcmd -p,可以进入显示当前目录的asmcmd模式,如下图:


8、在ASMCMD中,文件名对大小写不敏感,但是是具记忆性的(retentive),ASMCMD中默认文件名和路径都是大写,但如果你输入的路径和文件名是小写,也不会影响命令的执行 ,但是这个时候你用ls或pwd等命令查看文件或目录时就会发现路径及文件名全是你输入的小写,而不是系统默认的大小形式。




来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29067253/viewspace-2088205/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29067253/viewspace-2088205/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值