登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

飞哥的技术博客

世上无难事,只怕有心人!

 
 
 

日志

 
 
 
 

oracle database storage administrator's guide 11gR2-13  

2009-10-18 17:02:03|  分类: Oracle |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

About 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.

You can run the ASMCMD utility in either interactive or noninteractive mode.

This section contains the following topics:

Types of ASMCMD Commands

The types of ASMCMD commands are listed in Table 12-1.

About Oracle ASM Files, Filenames, Directories, and Aliases

ASMCMD works with Oracle ASM files, directories, and aliases. Before using ASMCMD, you should understand how these common computing concepts apply to the Oracle ASM environment.

This section contains the following topics about some key definitions:

System-Generated Filename or Fully Qualified Filename

Every file created in Oracle ASM gets a system-generated filename, otherwise known as a fully qualified filename. This is the same as a complete path name in a local file system.

Oracle ASM generates filenames according to the following scheme:

+diskGroupName/databaseName/fileType/fileTypeTag.fileNumber.incarnation  

An example of a fully qualified filename is the following:

DE<+data/orcl/CONTROLFILE/Current.256.541956473DE<

In the previous fully qualified filename, DE<dataDE< is the disk group name, DE<orclDE< is the database name, DE<CONTROLFILEDE< is the file type, and so on.

Only the slash (/) is supported by ASMCMD. Filenames are not case sensitive, but are case retentive. If you type a path name as lowercase, ASMCMD retains the lowercase.

For more information about Oracle ASM filenames, refer to "Fully qualified File Name Form".

Directory

As in other file systems, an Oracle ASM directory is a container for files, and an Oracle ASM directory can be part of a tree structure of other directories. The fully qualified filename represents a hierarchy of directories in which the plus sign (+) represent the root directory. In each disk group, Oracle ASM automatically creates a directory hierarchy that corresponds to the structure of the fully qualified filenames in the disk group. The directories in this hierarchy are known as system-generated directories.

ASMCMD enables you to move up and down in this directory hierarchy with the DE<cdDE< (change directory) command. The ASMCMD DE<lsDE< (list directory) command lists the contents of the current directory, while the DE<pwdDE< command prints the name of the current directory.

When you start ASMCMD, the current directory is set to root (+). For an Oracle ASM instance with two disk groups, for example, DE<dataDE< and DE<fraDE<, entering an DE<lsDE< command with the root directory as the current directory produces the following output:


DE<ASMCMD> lsDE<
DE<data/DE<
DE<fra/DE<

The following example demonstrates navigating the Oracle ASM directory tree (refer to the fully qualified filename shown previously):


DE<ASMCMD> cd +data/orcl/CONTROLFILEDE<
DE<ASMCMD> lsDE<
DE<Current.256.541956473DE<
DE<Current.257.541956475DE<

You can create your own directories as subdirectories of the system-generated directories using the ASMCMD DE<mkdirDE< command. The directories that you create can have subdirectories, and you can navigate the hierarchy of both system-generated directories and user-created directories with the DE<cdDE< command.

The following example creates the directory DE<mydirDE< under DE<orclDE< in the disk group DE<dataDE<:

DE<ASMCMD> mkdir +data/orcl/mydirDE<

Note:

The directory DE<orclDE< is a system-generated directory. The contents of DE<dataDE< represent the contents of disk group DE<dataDE<.

If you start ASMCMD with the DE<-pDE< flag, then ASMCMD shows the current directory as part of its prompt. See "Including the Current Directory in the ASMCMD Prompt".


DE<ASMCMD [+] > cd data/orclDE<
DE<ASMCMD [+data/orcl] >DE<

ASMCMD retains the case of the directory that you entered.

Alias

Aliases are filenames that are references or pointers to system-generated filenames. However, aliases are user-friendly names. Aliases are similar to symbolic links in UNIX or Linux computers. You can create aliases to simplify Oracle ASM filename administration. You can create aliases with the DE<mkaliasDE< ASMCMD command or a SQL DE<ALTERDE< DE<DISKGROUPDE< command.

An alias has at a minimum the disk group name as part of its complete path. You can create aliases at the disk group level or in any system-generated or user-created subdirectory. The following are examples of aliases:


DE<+data/ctl1.fDE<
DE<+data/orcl/ctl1.fDE<
DE<+data/mydir/ctl1.fDE<

If you run the ASMCMD DE<lsDE< (list directory) with the DE<-lDE< flag, each alias is listed with the system-generated file to which the alias refers.

DE<ctl1.f => +data/orcl/CONTROLFILE/Current.256.541956473DE<

For more information about aliases, refer to "Alias Oracle ASM Filename Forms".

Absolute Path and Relative Path

When you run an ASMCMD command that accepts a filename or directory name as an argument, you can use the name as either an absolute path or a relative path.

An absolute path refers to the full path of a file or directory. An absolute path begins with a plus sign (+) followed by a disk group name, followed by subsequent directories in the directory tree. The absolute path includes directories until the file or directory of interest is reached. A complete system-generated filename, otherwise known as the fully qualified filename, is an example of an absolute path to a file.

Using an absolute path enables the command to access the file or directory regardless of where the current directory is set. The following DE<rmDE< command uses an absolute path for the filename:

DE<ASMCMD [+] > rmDE< DE<+data/orcl/datafile/users.259.555341963DE<

The following DE<cdDE< command uses an absolute path to the directory.

DE<ASMCMD [+data/mydir] > cd +data/orcl/CONTROLFILEDE<

A relative path includes only the part of the filename or directory name that is not part of the current directory. That is, the path to the file or directory is relative to the current directory.

In the following example, the DE<rmDE< command operates on the file DE<undotbs1.272.557429239DE<, which in this case is a relative path. ASMCMD appends the current directory to the command argument to obtain the absolute path to the file. In this example this is DE<+data/orcl/DATAFILE/undotbs1.272.557429239DE<.


DE<ASMCMD [+] > cd +dataDE<
DE<ASMCMD [+data] > cd orcl/DATAFILEDE<
DE<ASMCMD [+data/orcl/DATAFILE] > lsDE<
DE<EXAMPLE.269.555342243DE<
DE<SYSAUX.257.555341961DE<
DE<SYSTEM.256.555341961DE<
DE<UNDOTBS1.258.555341963DE<
DE<UNDOTBS1.272.557429239DE<
DE<USERS.259.555341963DE<
DE<ASMCMD [+data/orcl/DATAFILE] >DE< DE<rm undotbs1.272.557429239DE<

Paths to directories can also be relative. You can go up or down the hierarchy of the current directory tree branch by providing a directory argument to the DE<cdDE< command whose path is relative to the current directory.

In addition, you can use the pseudo-directories "DE<.DE<" and "DE<..DE<" in place of a directory name. The "DE<.DE<" pseudo-directory is the current directory. The "DE<..DE<" pseudo-directory is the parent directory of the current directory.

The following example demonstrates how to use relative directory paths and pseudo-directories:


DE<ASMCMD [+data/orcl] > cd DATAFILEDE<
DE<ASMCMD [+data/orcl/DATAFILE] >cd ..DE<
DE<ASMCMD [+data/orcl] >DE<

Wildcard Characters

The wildcard characters DE<*DE< and DE<%DE< match zero or more characters anywhere within an absolute or relative path, which saves typing of the full directory or file name. The two wildcard characters behave identically. There are various ASMCMD commands that accept wildcards. These include DE<cdDE<, DE<duDE<, DE<findDE<, DE<lsDE<, DE<lsattrDE<, DE<lsdgDE<, DE<lsdskDE<, DE<lsgrpDE<, DE<lsusrDE<, and DE<rmDE<.

If a wildcard pattern matches only one directory when using wildcard characters with DE<cdDE<, then DE<cdDE< changes the directory to that destination. If the wildcard pattern matches multiple directories, then ASMCMD does not change the directory but instead returns an error.

Example 12-1 illustrates the use of wildcards.

Example 12-1 Using Wildcards With ASMCMD

ASMCMD [+] > cd +data/orcl/*FILE  ASMCMD-08005: +data/orcl/*FILE: ambiguous    ASMCMD [+] > cd +data/orcl/C*  ASMCMD [+data/orcl/CONTROLFILE] >    ASMCMD [+] > ls +fra/orcl/A%  2009_07_13/  2009_07_14/    ASMCMD [+] >  ls +fra/orcl/ARCHIVELOG/2009%    +fra/orcl/ARCHIVELOG/2009_07_13/:  thread_1_seq_3.260.692103543  thread_1_seq_4.261.692108897  thread_1_seq_5.262.692125993  thread_1_seq_6.263.692140729  thread_1_seq_7.264.692143333     +fra/orcl/ARCHIVELOG/2009_07_14/:  thread_1_seq_8.271.692158265  thread_1_seq_9.272.692174597    ASMCMD [+] > ls data/orcl/*    +data/orcl/CONTROLFILE/:  Current.260.692103157    +data/orcl/DATAFILE/:  EXAMPLE.265.692103187  SYSAUX.257.692103045  SYSTEM.256.692103045  UNDOTBS1.258.692103045  USERS.259.692103045    +data/orcl/ONLINELOG/:  group_1.261.692103161  group_2.262.692103165  group_3.263.692103169    +data/orcl/PARAMETERFILE/:  spfile.266.692103315    +data/orcl/TEMPFILE/:  TEMP.264.692103181  spfileorcl.ora  

Preparing to Run ASMCMD

You can run the ASMCMD utility in either interactive or noninteractive mode.

Before running ASMCMD, review the items in the following list.

  • Log in to the host which contains the Oracle ASM instance that you plan to administer.

    You must log in as a user that has DE<SYSASMDE< or DE<SYSDBADE< privileges through operating system authentication. The DE<SYSASMDE< privilege is the required connection to administer the Oracle ASM instance. See "Authentication for Accessing Oracle ASM Instances".

    See Also:

    Refer to the Oracle Database Administrator's Guide for information about operating system authentication
  • To connect to the Oracle ASM instance, run ASMCMD that is located in the DE<binDE< subdirectory of the Oracle grid infrastructure home (Oracle ASM home).

    Connect as SYSASM, the default connection, to administer an Oracle ASM instance.

    Ensure that the DE<ORACLE_HOMEDE< and DE<ORACLE_SIDDE< environment variables to refer to the Oracle ASM instance. Depending on your operating system, you might have to set other environment variables to properly connect to the Oracle ASM instance.

    Ensure that the DE<binDE< subdirectory of your Oracle grid infrastructure home is in your DE<PATHDE< environment variable.

    See Also:

    Refer to the Oracle Database Administrator's Guide for more information about setting environment variables

    The default value of the Oracle ASM SID for a single-instance database is DE<+ASMDE<. In Real Application Clusters environments, the default value of the Oracle ASM SID on any node is DE<+ASMDE<DE<node#DE<.

  • To use most of the ASMCMD commands, ensure that the Oracle ASM instance is started and the Oracle ASM disk groups are mounted.

    If the Oracle ASM instance is not running or if the DE<ORACLE_SIDDE< is set incorrectly, ASMCMD runs only those commands that do not require an Oracle ASM instance. The commands include DE<startupDE<, DE<shutdownDE<, DE<lsdskDE<, DE<helpDE<, and DE<exitDE<. If you attempt to run other ASMCMD commands, an error message displays.

  • You can connect to the database instance as SYSDBA by running ASMCMD that is located in the DE<binDE< directory of the Oracle Database home.

    Ensure that the DE<ORACLE_HOMEDE< and DE<ORACLE_SIDDE< environment variables to refer to the database instance. Depending on your operating system, you might have to set other environment variables to properly connect to the database instance.

    You must include the DE<-aDE< option to connect as SYSDBA. See "Specifying the Type of Connection".

    With this connection, there are a limited set of operations that can be run. For more information, see "The SYSDBA Privilege for Managing Oracle ASM Components".

    When administering disk groups, Oracle recommends that you run ASMCMD from the database home of the database instance that is the owner of the files in the disk group.

Running ASMCMD in Interactive Mode

The interactive mode of the ASMCMD utility provides a shell-like environment where you are prompted to enter ASMCMD commands. The syntax for starting ASMCMD in interactive mode is:


DE<asmcmdDE< [DE<-VDE<]
DE<asmcmdDE< [DE<-vDE<] [ DE<-aDE< DE<connection_typeDE< ] [DE<-pDE<]

Table 12-2 summarizes the ASMCMD options.

Table 12-2 ASMCMD Interactive Options

Option Description

-DE<VDE<

Displays the version of ASMCMD and then exits.

DE<-vDE<

Displays additional information with some commands to help users diagnose problems.

DE<-aDE< DE<connection_typeDE<

Specifies the privilege to connect as when accessing an Oracle ASM or database instance. Can be either SYSASM or SYSDBA. The default is SYSASM and should be used when administering the Oracle ASM instance.

DE<-pDE<

Displays the current directory in the prompt.


ASMCMD can be started with multiple options. For example:


DE<asmcmdDE< DE<-pDE< DE<-vDE<

For the majority of the examples in this chapter, ASMCMD was started with the DE<-pDE< and DE<-vDE< options

Running ASMCMD Without Any Options

To run ASMCMD in interactive mode without any options:

  1. Enter the following at the operating system command prompt:

    DE<asmcmdDE<

    Oracle displays an ASMCMD command prompt as follows:

    DE<ASMCMD>DE<

  2. Enter an ASMCMD command and press DE<EnterDE<. The command runs and displays its output, if any, and then ASMCMD prompts for the next command.

  3. Continue entering ASMCMD commands until you have completed the tasks.

  4. Enter the DE<exitDE< or DE<quitDE< command to exit ASMCMD.

Specifying the Type of Connection

You can specify the DE<-aDE< option to choose the type of connection, either DE<SYSASMDE< or DE<SYSDBADE<. The default value is DE<SYSASMDE< and should be used when administering an Oracle ASM instance. Connect as DE<SYSDBADE< when connecting to the database instance.

For example:

DE<$ asmcmd -a sysasmDE<

Specifying the Verbose Mode

You can specify the DE<-vDE< option with the DE<asmcmdDE< command to display additional information with some commands to help users diagnose problems as shown in the following example:


DE<$ asmcmd -vDE<

Including the Current Directory in the ASMCMD Prompt

You can specify the DE<-pDE< option with the DE<asmcmdDE< command to include the current directory in the ASMCMD prompt as shown in the following example:


DE<$ asmcmd -pDE<
DE<ASMCMD [+] > cd dataDE<
DE<ASMCMD [+data] >DE<

Displaying the ASMCMD Version Number

You can specify the DE<-VDE< option when starting DE<asmcmdDE< to displays the DE<asmcmdDE< version number. After displaying the version number, DE<asmcmdDE< immediately exits.

For example:


DE<$ asmcmd -VDE<
DE<asmcmd version 11.2.0.1.0DE<
DE<$DE<

Running ASMCMD in Noninteractive Mode

In noninteractive mode, you run a single ASMCMD command by including the command and command options on the command line that invokes ASMCMD. ASMCMD runs the command, generates output if any, and then exits. The noninteractive mode is especially useful for running scripts.

To run ASMCMD in noninteractive mode where DE<commandDE< is any valid ASMCMD command and DE<optionsDE< is a list of command options, at the command prompt enter the following:

DE<asmcmdDE< DE<commandDE< DE<optionsDE<

Example 12-2 shows how to run ASMCMD in the noninteractive mode. The first example uses the DE<lsDE< command to list the disk groups for the Oracle ASM instance. The second example redirects the output of the DE<lsodDE< command to the DE<my_lsod_testDE< file.

Example 12-2 Running ASMCMD in Noninteractive Mode

$ asmcmd ls -l  State    Type    Rebal  Name  MOUNTED  NORMAL  N      DATA/  MOUNTED  NORMAL  N      FRA/    $ asmcmd lsod -H -G data --process LGWR > my_lsod_test  

Getting Help

Type DE<helpDE< at the ASMCMD prompt or as a command in noninteractive mode to view general information about ASMCMD and a list of available ASMCMD commands.

You can type DE<helpDE< DE<commandDE< to display help text for a specific command, including usage information about how to run the command with its options.

The following is an example of the use of the DE<helpDE< command.

Example 12-3 Displaying ASMCMD Help Text

ASMCMD [+] > help startup          startup [--nomount] [--restrict] [--pfile <pfile.ora>]             Start the ASM instance.             [--nomount]           specifies the nomount option.          [--restrict]          start the instance in restricted mode.          [--pfile <pfile.ora>] specifies the location of the pfile.



引文来源  About ASMCMD
  评论这张
 
阅读(734)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018