Asm Cheat Sheet



  • ASM 8086 Cheat Sheet by Mikael Peigney (Mika56) via cheatography.com/3808/cs/839/ Colors Deci mal Hexa Binary Color 0 00h 0000b Black 1 01h 0001b Blue 2 02h 0010b Green 3 03h 0011b Colbalt blue 4.
  • ASM 8086 Cheat Sheet by Deathtitan77 (Deathtitan77) via cheatography.com/122246/cs/22730/ Index Registers (cont) DI This is the destin ation index register. It is of 16 bits. It is used in the pointer.
  • Addressing Memory. Modern x86-compatible processors are capable of addressing up to 2 32 bytes of memory: memory addresses are 32-bits wide. In the examples above, where we used labels to refer to memory regions, these labels are actually replaced by the assembler with 32-bit quantities that specify addresses in memory.

You can check the effects, flag results, cycle counts etc. of all GBz80 instructions here.
Notes:

  • immX means a X-bit immediate value.
  • regX means a X-bit register. (Note: af isn't part of the reg16 group)
  • opX means either a regX, or an immX.
  • mem16 means a 16-bit immediate value, that is used to address memory.
  • M-Cycles are 1MHz cycles, not the 4MHz clock cycles.
  • Flag alterations are noted as such: - means 'unaffected', 0 or 1 means the flag is set to that value, and anything else describes what value the flag is set to.

Data manipulation

Intel Assembler x86 CodeTable: Handy overview containing all instructions (transfer, arithmetic, logic, jumps), flags, registers, demo program. Free PDF file, fits on one single sheet.

This chapter describes the Automatic Storage Management Command-Line Utility (ASMCMD). It contains the following topics:

About ASMCMD

ASMCMD is a command-line utility that you can use to easily view and manipulate files and directories within Automatic Storage Management (ASM) disk groups. It can list the contents of disk groups, perform searches, create and remove directories and aliases, display space utilization, and more.

Note:

You cannot use ASMCMD to create or drop disk groups or to add or drop disks in a disk group. For these operations, you must use SQL commands.

See Also:

Oracle Database Administrator's Guide for general information on Automatic Storage Management.

About ASM Files, Filenames, Directories, and Aliases

ASMCMD works with Automatic Storage Management (ASM) files, directories, and aliases. Before using ASMCMD, you must understand how these common computing concepts apply to the unique ASM environment. The following are some key definitions.

Note:

The forward slash (/) and backward slash () are interchangeable in filenames. Also, filenames are case insensitive, but case retentive.

System-generated filename or 'fully qualified filename'

Every file created in ASM gets a system-generated filename, otherwise known as a fully qualified filename. This is analogous to a complete path name in a local file system. An example of a fully qualified filename is the following:

ASM generates filenames according to the following scheme:

In the previous fully qualified filename, dgroup2 is the disk group name, sample is the database name, controlfile is the file type, and so on.

See Oracle Database Administrator's Guide for more detailed information on fully qualified filenames.

Directory

As in other file systems, an ASM directory is a container for files, and it can be part of a tree structure of other directories.

The fully qualified filename in fact represents a hierarchy of directories, with the plus sign (+) as the root. In each disk group, ASM 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 this directory hierarchy with the cd (change directory) command. The ASMCMD ls (list directory) command lists the contents of the current directory, while the pwd command prints the name of the current directory.

When you start ASMCMD, the current directory is set to root (+). For an ASM instance with two disk groups, dgroup1 and dgroup2, entering an ls command with the root directory as the current directory produces the following output:

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

You can also create your own directories as subdirectories of the system-generated directories. You do so with the ALTER DISKGROUP command or with the ASMCMD mkdir command. Your user-created directories can have subdirectories, and you can navigate the hierarchy of both system-generated directories and user-generated directories with the cd command. See Oracle Database Administrator's Guide for more information on ASM directories.

The following example creates the directory mydir in the disk group dgroup1:

(Note that the directory dgroup1 is a system-generated directory. Its contents represent the contents of the disk group dgroup1.)

If you start ASMCMD with the -p flag, ASMCMD always shows the current directory as part of its prompt.

Note:

ASM does not place system-generated files into your user-created directories; it places them only in system-generated directories. You add aliases (described next) or other directories to a user-created directory.

Alias

An alias is a filename that is a reference (or pointer) to a system-generated filename, but with a more user-friendly name. It is similar to a symbolic link in Unix operating systems. You create aliases to make it easier to work with ASM filenames. You can create an alias with an ALTER DISKGROUP command or with the mkalias ASMCMD 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:

Oracle 12c Asm Cheat Sheet

If you run the ASMCMD ls (list directory) with the -l flag, each alias is listed with the system-generated file that it references.

See Oracle Database Administrator's Guide for more information on aliases.

Absolute path and Relative path

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

An absolute path refers to the full path to 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 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 rm command uses an absolute path for the filename:

The following command uses an absolute path to the directory.

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 rm command operates on the file undotbs1.272.557429239, which in this case is a relative path. ASMCMD prepends the current directory to the command argument to obtain the absolute path to the file, which is +dgroup1/sample/datafile/undotbs1.272.557429239.

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 cd (change directory) command whose path is relative to the current directory.

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

The following example demonstrates using relative directory paths and pseudo-directories:

Wildcard

The wildcard characters '*' and '%' match zero or more characters anywhere within an absolute or relative path. The two characters behave identically. The ASMCMD commands that accept wildcards are ls, du, rm, and find. The following examples illustrate the use of wildcards.

Running ASMCMD

You can run the ASMCMD utility in either interactive or noninteractive mode. Before running ASMCMD, you must ensure that you are logged in properly and that your environment is properly configured.

Preparing to Run ASMCMD

To prepare to run ASMCMD:

  • Ensure that the ASM instance is started and the ASM disk groups are mounted. (You cannot use ASMCMD to mount disk groups.)

  • Log in to the host that is running the ASM instance that you want to work with. You must log in as a user that has SYSDBA privileges through operating system authentication.

    See Oracle Database Administrator's Guide for information on operating system authentication.

  • Set the ORACLE_HOME and ORACLE_SID environment variables to select the ASM instance. Depending on your operating system, you may have to set other environment variables to properly connect to the ASM instance. See Oracle Database Administrator's Guide for more information on setting environment variables.

    The default value of the ASM SID for a single instance database is +ASM. On a Real Application Clusters system, the default value of the ASM SID on any node is +ASMnode#.

  • Ensure that bin subdirectory of your Oracle home is in your PATH environment variable.

Running ASMCMD in Interactive Mode

Asm Cheat Sheet

The interactive mode of the ASMCMD utility provides a shell-like environment where you are prompted to enter ASMCMD commands.

To run ASMCMD in interactive mode:

  1. At the operating system command prompt, enter:

    asmcmd

    An ASMCMD command prompt is displayed.

  2. Enter an ASMCMD command and press the Enter key.

    The command runs and displays its output, if any, and then ASMCMD prompts for the next command.

  3. Continue entering ASMCMD commands. Enter the command exit to exit ASMCMD.

Including the Current Directory in the ASMCMD Prompt

You can specify the -p option with the asmcmd command to include the current directory in the ASMCMD prompt, as shown in the following example:

Running ASMCMD in Noninteractive Mode

In noninteractive mode, you run a single ASMCMD command by including the command and command arguments 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:

  • At the command prompt, enter:

    asmcmdcommandarguments

    where:

    command is any valid ASMCMD command. arguments is a list of command flags and arguments.

The following example demonstrates running ASMCMD in the noninteractive mode.

Getting Help

Type help at the ASMCMD prompt or as a command in noninteractive mode to view general ASMCMD help and a list of available commands.

ASMCMD Command Reference

This section describes each individual ASMCMD command in detail. Table 20-1 provides a summary of all ASMCMD commands.

Table 20-1 Summary of ASM Commands

CommandDescription
cd
Changes the current directory to the specified directory.
du
Displays the total disk space occupied by ASM files in the specified ASM directory and all its subdirectories, recursively.
exit
Exits ASMCMD.
find
Lists the paths of all occurrences of the specified name (with wildcards) under the specified directory.
help
Displays the syntax and description of ASMCMD commands.
ls
Lists the contents of an ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.
lsct
Lists information about current ASM clients.
lsdg
Lists all disk groups and their attributes.
mkalias
Creates an alias for a system-generated filename.
mkdir
Creates ASM directories.
pwd
Displays the path of the current ASM directory.
rm
Deletes the specified ASM files or directories.
rmalias
Deletes the specified alias, retaining the file that the alias points to.

cd

Purpose

Changes the current directory to the specified directory.

Syntax and Description

dir may be specified as either an absolute path or a relative path, including the pseudo-directories '.' and '..'.

Examples

du

Purpose

Displays the total space used for files in the specified directory and in the entire directory tree under it.

Syntax and Description

This command is similar to the du -s command in UNIX. If you do not specify dir, information about the current directory is displayed. dir can contain wildcard characters.

The following two values are displayed, both in units of MB.

Used_MB—This value does not take the mirroring into account. Mirror_used_MB—This value takes mirroring into account.

For example, if a normal redundancy disk group contains 100 MB of data, then assuming that each file in the disk group is 2-way mirrored, Used_MB is 100 MB and Mirror_used_MB is roughly 200 MB.

The -H flag suppresses column headings from the output.

Example

The following example shows disk space used in the SAMPLE directory in DGROUP1, including all directories below SAMPLE.

exit

Purpose

Exits ASMCMD and returns to the operating system command line prompt.

Syntax

find

Purpose

Displays the absolute paths of all occurrences of the specified name (with wildcards) in a specified directory and its subdirectories.

Syntax and Description

This command searches the specified directory and all subdirectories below it in the directory tree for the supplied name. name can be a directory name or a filename, and can include wildcard characters. dir may also include wildcards. In the output of the command, directory names are suffixed with the slash character (/) to distinguish them from filenames.

You use the -t flag to find all the files of a particular type (specified as type). For example, you can search for control files by specifying type as CONTROLFILE. Valid values for type are the following:

Note:

These are the values from the type column of the V$ASM_FILE view.

Examples

The following example searches the dgroup1 disk group for files that begin with 'undo':

The following example returns the absolute path of all the control files in the +dgroup1/sample directory.

help

Purpose

Displays the syntax of a command and a description of the command parameters.

Syntax and Description

If command is not specified, the help command displays a list of all the ASMCMD commands and general information about using the ASMCMD utility.

Example

ls

Purpose

Lists the contents of an ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.

Syntax and Description

name can be a filename or directory name, including wildcard characters.

If name is a directory name, ASMCMD lists the contents of the directory, and, depending on flag settings, information about each directory member. Directories are listed with a trailing slash (/) to distinguish them from files.

If name is a filename, ASMCMD lists the file, and, depending on flag settings, information about the file. The file must be located in the current directory if the filename is specified with a relative path.

Command flags enable you to modify and customize the output of the command. The following table lists the flags and their descriptions.

Table 20-2 Flags for the ls command

FlagDescription
(none)Displays only filenames and directory names.
-lDisplays extended file information, including striping and redundancy attributes and whether the file was system-generated (indicated by Y under the SYS column) or user-created (as in the case of an alias, indicated by N under the SYS column). When used in the 'ls -l +' command, displays extended disk group information. Note that not all possible file attributes or disk group attributes are included. To view the complete set of attributes for a file or a disk group, query the V$ASM_FILE and V$ASM_DISKGROUP views.
-sDisplays file space information.
-dIf the name argument is a directory, displays information about that directory, rather than the directory contents. Typically used with another flag, such as the -l flag.
-rReverses the sort order of the listing.
-tSorts the listing by timestamp (latest first) instead of by name.
-LIf the name argument is an alias, displays information on the file that it references. Typically used with another flag, such as the -l flag.
-aFor each listed file, displays the absolute path of the alias that references it, if any.
-HSuppresses column headings.

If you specify all flags, then the command shows a union of their attributes, with duplicates removed. If you enter ls +, then the command returns information on all disk groups, including whether or not they are mounted.

Examples

lsct

Purpose

Lists information about current ASM clients. A client is a database that uses disk groups managed by the ASM instance that ASMCMD is currently connected to.

Syntax and Description

If group is specified, information about only that disk group is displayed. The -H flag suppresses column headings.

Example

This example displays information about the client accessing the dgroup1 disk group.

lsdg

Purpose

Lists all disk groups and their attributes.

Syntax and Description

Table 20-3 shows the attributes listed for each disk group.

Table 20-3 Attribute descriptions for lsdg command output

Attribute NameDescription
StateMounted/connected state of the disk group
TypeDisk group redundancy (NORMAL, HIGH, EXTERNAL)
RebalY if a rebalance operation is in progress
UnbalY if the disk group is in need of rebalancing
SectorSector size in bytes
BlockBlock size in bytes
AUAllocation Unit size in bytes
Total_MBSize of the disk group in MB
Free_MBFree space in the disk group in MB, without regard to redundancy. From the V$ASM_DISKGROUP view.
Req_mir_free_MBAmount of space that must be available in the disk group to restore full redundancy after the worst failure that can be tolerated by the disk group. This is the REQUIRED_MIRROR_FREE_MB column from the V$ASM_DISKGROUP view.
Usable_file_MBAmount of free space, adjusted for mirroring, that is available for new files. From the V$ASM_DISKGROUP view.
Offline_disksNumber of offline disks in the disk group. Offline disks are eventually dropped.
NameDisk group name

See Oracle Database Administrator's Guide for more information on the attributes that are designated in Table 20-3 as being from the V$ASM_DISKGROUP view.

If group is specified, information about only that disk group is listed. The -H flag suppresses column headings.

Example

The following example lists the attributes of the dgroup2 disk group.

mkalias

Purpose

Creates an alias for the specified system-generated filename.

Syntax and Description

alias must be in the same disk group as the system-generated file. Only one alias is permitted for each ASM file.

Note:

The SQL*Plus equivalent of the mkalias command is:

Example

The following example creates the sysaux.f alias for the fully qualified filename +DGROUP1/SAMPLE/DATAFILE/SYSAUX.257.555341961.

mkdir

Purpose

Creates ASM directories under the current directory.

Syntax and Description

The current directory can be a system-created or user-created directory. You cannot create a directory at the root (+) level.

Note:

The SQL*PLUS equivalent of the mkdir command is ALTER DISKGROUPdg_nameADD DIRECTORYdir, dir . . .

Example

The following example creates the directories subdir1 and subdir2 at the disk group level in the disk group dgroup1.

pwd

Asm Cheat Sheet

Purpose

Displays the absolute path of the current directory.

Syntax and Description

Asm Cheat Sheet Oracle

Example

rm

Purpose

Deletes the specified ASM files and directories.

Syntax and Description

If name is a file or alias, rm can delete it only if it is not currently in use by a client database. If name is a directory, rm can delete it only if it is empty (unless the -r flag is used) and it is not a system-generated directory. If name is an alias, rm deletes both the alias and the file that the alias references. (To delete just an alias and retain the file that the alias references, use the rmalias command.)

Note:

The SQL*Plus equivalents of the rmCheat command are:

Asm Commands Cheat Sheet

If you use a wildcard, rm deletes all matches except non-empty directories (unless the -r flag is used).

To recursively delete, use the -r flag. This enables you to delete a non-empty directory, including all files and directories in it and in the entire directory tree underneath it.

If you use the -r flag or a wildcard character, rm prompts you to confirm deletion before proceeding, unless you specify the -f flag.If a wildcard character matches an alias or a system-generated file that has an alias, both the alias and the system-generated file that it references are deleted. When using the -r flag, either the system-generated file or the alias needs to be present in the directory in which you run the rm command.

For example, if you have a user alias, +dg1/dir1/file.alias that points to +dg/ORCL/DATAFILE/System.256.146589651, then running the rm -r +dg1/dir1 command will remove +dg1/dir1/file.alias as well as +dg/ORCL/DATAFILE/System.256.146589651.

Example

The following example deletes the alias alias293.f.

rmalias

Purpose

Deletes the specified aliases, retaining the files that the aliases reference.

Syntax and Description

Note:

The SQL*Plus equivalent of the rmalias command is:

To recursively delete, use the -r flag. This enables you to delete all aliases in the current directory and in the entire directory tree beneath the current directory. If any user-created directories become empty as a result of deleting aliases, they are deleted also. System-created files and directories are not deleted.

Example

The following example deletes the alias sysaux.f, retaining the datafile that it references.