ASMCMD簡介(1)

路途中的人2012發表於2016-04-25
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

,

,

,

,



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/,如需轉載,請註明出處,否則將追究法律責任。