本文共 3440 字,大约阅读时间需要 11 分钟。
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命令。 - ASMCMD> help
-
- asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege ] [-p] [command]
- asmcmd_no_conn_str
-
- Starts asmcmd (if no parameters) or executes the command with given parameters
-
- asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege ] [-p] [command]
-
- Specify the connect string after the -c option to use the listener to
- connect. By default, ASMCMD asks for a password in a non-echoing
- prompt, unless the password is specified as part of the connect string.
-
- The connect identifier is in the form of "host:port:sid", with the
- host and the port being option. Host defaults to "localhost" and port
- to 1521. If the sid is not specified as a part of the connect
- identifier, then it is read from the environment variable ORACLE_SID.
-
- If no connect string is used, then environment variables
- ORACLE_HOME and ORACLE_SID determine the instance to which the program
- connects, and asmcmd establishes a bequeath connection to the it, in
- the same manner as a SQLPLUS / AS SYSASM. The user must be a member
- of the SYSDBA group to exercise this option.
-
- Specifying the -V option prints the asmcmd version number and
- exits immediately.
-
- Specifying the -v option prints extra information that can help
- advanced users diagnose problems.
-
- Specify the --privilege option to choose the type of connection. There are
- only two possibilities: connecting as SYSASM or as SYSDBA.
- The default value if this option is unspecified is SYSASM:
-
- Specifying the -p option allows the current directory to be displayed
- in the command prompt, like so:
-
- ASMCMD [+DATA/ORCL/CONTROLFILE] >
-
- The parameter command specifies one of the following commands, along
- with its parameters.
-
- Type "help [command]" to get help on a specific ASMCMD command.
-
- commands:
- --------
-
- md_backup, md_restore
-
- lsattr, setattr
-
- cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
- mkdir, pwd, rm, rmalias
-
- chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
- offline, online, rebal, remap, umount
-
- dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
- spmove, spset, startup
-
- chtmpl, lstmpl, mktmpl, rmtmpl
-
- chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
- mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr
-
- volcreate, voldelete, voldisable, volenable, volinfo
- volresize, volset, volstat
2、如果在服务器上有多个ASM实例,那么在进入ASM之前需要用export ORACLE_SID=***,将ORACLE_SID变量设置为你想访问的ASM实例。 3、ASMCMD中的命令分成如下几类: 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等命令查看文件或目录时就会发现路径及文件名全是你输入的小写,而不是系统默认的大小形式。 转载地址:http://otuoo.baihongyu.com/