Total Pageviews

Sunday 28 December 2014

Automatic Storage Management : 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.
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:

% asmcmd -p
ASMCMD [+] > cd dgroup1/mydir
ASMCMD [+DGROUP1/MYDIR] >
ASMCMD Command Reference:

ASM generates filenames according to the following scheme:
+diskGroupName/databaseName/fileType/fileTypeTag.file.incarnation

ASMCMD command attributes:
========================
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.
When you start ASMCMD, the current directory is set to root (+). For an ASM instance with two disk groups, dgroup1 and dgroup2, entering an lscommand with the root directory as the current directory produces the following output:
ASMCMD> ls
DGROUP1/
DGROUP2/

DU command:
============
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.
The following example shows disk space used in the SAMPLE directory in DGROUP1, including all directories below SAMPLE.
ASMCMD [+DGROUP1/SAMPLE] > du
Used_MB      Mirror_used_MB
   1251                2507

Find command:
==============
Displays the absolute paths of all occurrences of the specified name (with wildcards) in a specified directory and its subdirectories.
Syntax and Description
find [-t type] dir name
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:
CONTROLFILE
DATAFILE
ONLINELOG
ARCHIVELOG
TEMPFILE
BACKUPSET
DATAFILE
PARAMETERFILE
DATAGUARDCONFIG
FLASHBACK
CHANGETRACKING
DUMPSET
AUTOBACKUP
XTRANSPORT
Examples
The following example searches the dgroup1 disk group for files that begin with 'undo':
ASMCMD> find +dgroup1 undo*
+dgroup1/SAMPLE/DATAFILE/UNDOTBS1.258.555341963
+dgroup1/SAMPLE/DATAFILE/UNDOTBS1.272.557429239
The following example returns the absolute path of all the control files in the +dgroup1/sample directory.
ASMCMD> find -t CONTROLFILE +dgroup1/sample *
+dgroup1/sample/CONTROLFILE/Current.260.555342185
+dgroup1/sample/CONTROLFILE/Current.261.555342183
ls command:
===========
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
ls [-lsdrtLaH] [name]
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.
Flag Description
(none)  Displays only filenames and directory names.
-l    ------> Displays 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.
-s  ---------> Displays file space information.
-d If 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.
-r -------->  Reverses the sort order of the listing.
-t  ---------> Sorts the listing by timestamp (latest first) instead of by name.
-L If ------> the name argument is an alias, displays information on the file that it references. Typically used with another flag, such as the -l flag.
-a  ---------> For each listed file, displays the absolute path of the alias that references it, if any.
-H  -------> Suppresses 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
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls
EXAMPLE.269.555342243
SYSAUX.257.555341961
SYSTEM.256.555341961
UNDOTBS1.258.555341963
UNDOTBS1.272.557429239
USERS.259.555341963
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -l
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    EXAMPLE.269.555342243
DATAFILE  MIRROR  COARSE   MAY 09 22:01:28  Y    SYSAUX.257.555341961
DATAFILE  MIRROR  COARSE   APR 19 19:16:24  Y    SYSTEM.256.555341961
DATAFILE  MIRROR  COARSE   MAY 05 12:28:42  Y    UNDOTBS1.258.555341963
DATAFILE  MIRROR  COARSE   MAY 04 17:27:34  Y    UNDOTBS1.272.557429239
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    USERS.259.555341963
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -lt
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   MAY 09 22:01:28  Y    SYSAUX.257.555341961
DATAFILE  MIRROR  COARSE   MAY 05 12:28:42  Y    UNDOTBS1.258.555341963
DATAFILE  MIRROR  COARSE   MAY 04 17:27:34  Y    UNDOTBS1.272.557429239
DATAFILE  MIRROR  COARSE   APR 19 19:16:24  Y    SYSTEM.256.555341961
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    USERS.259.555341963
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    EXAMPLE.269.555342243

ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -l undo*
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   MAY 05 12:28:42  Y    UNDOTBS1.258.555341963
DATAFILE  MIRROR  COARSE   MAY 04 17:27:34  Y    UNDOTBS1.272.557429239

ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -s
Block_Size  Blocks      Bytes       Space  Name
      8192   12801  104865792   214958080  EXAMPLE.269.555342243
      8192   48641  398467072   802160640  SYSAUX.257.555341961
      8192   61441  503324672  1011875840  SYSTEM.256.555341961
      8192    6401   52436992   110100480  UNDOTBS1.258.555341963
      8192   12801  104865792   214958080  UNDOTBS1.272.557429239
      8192     641    5251072    12582912  USERS.259.555341963
ASMCMD [+DGROUP1] > ls +DGROUP1/SAMPLE
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilesample.ora
ASMCMD [+DGROUP1] > ls -l +DGROUP1/SAMPLE
Type  Redund  Striped  Time  Sys Name
                             Y   CONTROLFILE/
                             Y   DATAFILE/
                             Y   ONLINELOG/
                             Y   PARAMETERFILE/
                             Y   TEMPFILE/
                             N   spfilesample.ora=>
                              +DGROUP1/SAMPLE/PARAMETERFILE/spfile.270.555342443
ASMCMD [+DGROUP1] > ls -r +DGROUP1/SAMPLE
spfilesample.ora
TEMPFILE/
PARAMETERFILE/
ONLINELOG/
DATAFILE/
CONTROLFILE/
ASMCMD [+DGROUP1] > ls -lL example_df2.f
Type      Redund  Striped  Time          Sys  Name
DATAFILE  MIRROR  COARSE   APR 27 11:04  N    example_df2.f => +DGROUP1/SAMPLE/DATAFILE/EXAMPLE.271.556715087
ASMCMD [+DGROUP1] > ls -a +DGROUP1/SAMPLE/DATAFILE/EXAMPLE.271.556715087
+DGROUP1/example_df2.f => EXAMPLE.271.556715087
ASMCMD [+DGROUP1] > ls -lH +DGROUP1/SAMPLE/PARAMETERFILE
PARAMETERFILE  MIRROR  COARSE   MAY 04 21:48  Y    spfile.270.555342443
ASMCMD [+DGROUP1] > ls -l +
State    Type    Rebal  Unbal  Name
MOUNTED  NORMAL  N      N      DGROUP1/
MOUNTED  NORMAL  N      N      DGROUP2/
MOUNTED  EXTERN  N      N      DGROUP3/
lsct command:
=============
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
lsct [-H] [group]
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.
ASMCMD [+] > lsct dgroup1
DB_Name   Status        Software_Version  Compatible_version  Instance_Name
sample    CONNECTED           10.2.0.0.0          10.2.0.0.0  sample
lsdg command:
==============
Purpose
Lists all disk groups and their attributes.
Syntax and Description
lsdg [-H] [group]
Attribute Name Description
State Mounted/connected state of the disk group
Type Disk group redundancy (NORMAL, HIGH, EXTERNAL)
Rebal Y if a rebalance operation is in progress
Unbal Y if the disk group is in need of rebalancing
Sector Sector size in bytes
Block Block size in bytes
AU Allocation Unit size in bytes
Total_MB Size of the disk group in MB
Free_MB Free space in the disk group in MB, without regard to redundancy. From the V$ASM_DISKGROUP view.
Req_mir_free_MB Amount 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_MB Amount of free space, adjusted for mirroring, that is available for new files. From the V$ASM_DISKGROUP view.
Offline_disks Number of offline disks in the disk group. Offline disks are eventually dropped.
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.
ASMCMD [+] > lsdg dgroup2
State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB
Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
MOUNTED  NORMAL  N      N         512   4096  1048576      4096     1208
           1024              92              0  DGROUP2/
mkalias command:
================
Purpose
Creates an alias for the specified system-generated filename.
mkalias file alias
alias must be in the same disk group as the system-generated file. Only one alias is permitted for each ASM file.
The SQL*Plus equivalent of the mkalias command is:
ALTER DISKGROUP dg_name ADD ALIAS user_alias FOR file
Example
The following example creates the sysaux.f alias for the fully qualified filename +DGROUP1/SAMPLE/DATAFILE/SYSAUX.257.555341961.
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > mkalias SYSAUX.257.555341961 sysaux.f
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -a
none => EXAMPLE.269.555342243
+DGROUP1/SAMPLE/DATAFILE/sysaux.f => SYSAUX.257.555341961
none => SYSTEM.256.555341961
none => UNDOTBS1.258.555341963
none => UNDOTBS1.272.557429239
none => USERS.259.555341963
sysaux.f
mkdir command:
==============
Creates ASM directories under the current directory.
mkdir dir [dir] . . .
The current directory can be a system-created or user-created directory. You cannot create a directory at the root (+) level.
The SQL*PLUS equivalent of the mkdir command is ALTER DISKGROUP dg_name ADD DIRECTORY dir, dir . . .
Example
The following example creates the directories subdir1 and subdir2 at the disk group level in the disk group dgroup1.
ASMCMD [+DGROUP1] > mkdir subdir1 subdir2
ASMCMD [+DGROUP1] > ls
SAMPLE/
example_df2.f
subdir1/
subdir2/
pwd command:
=============
Displays the absolute path of the current directory.
ASMCMD> pwd
+dgroup1/sample/controlfile

rm command
===========
Purpose
Deletes the specified ASM files and directories.
Syntax and Description
rm [-rf] name [name] . . .
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 rm command are:
ALTER DISKGROUP ... DROP FILE
ALTER DISKGROUP ... DROP DIRECTORY
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.
The following example deletes the alias alias293.f.
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rm alias293.f
rmalias command
=============
Purpose
Deletes the specified aliases, retaining the files that the aliases reference.
rmalias [-r] alias [alias] . . .
The SQL*Plus equivalent of the rmalias command is:
ALTER DISKGROUP dg_name DROP ALIAS user_alias
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.
The following example deletes the alias sysaux.f, retaining the datafile that it references.
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rmalias sysaux.f
lsdsk Command
================
Purpose
List the disks that are visible to ASM, using the V$ASM_DISK_STAT and V$ASM_DISK views. The V$ASM_DISK_STAT view is used by default.
lsdsk [-ksptagcHI] [-d diskg_roup_name] [pattern]
pattern restricts the output to only disks that matches the pattern specified. Wild-card characters and slashes (/ or \) can be part of the pattern. See "Wildcard Characters".
The k, s, p, and t flags modify how much information is displayed for each disk. If any combination of the flags are specified, then the output shows the union of the attributes associated with each flag. The flags are described in Table 7-7.
This command can run in connected or non-connected mode. The connected mode is always attempted first. The -I option forces the non-connected mode.
In connected mode, ASMCMD uses dynamic views to retrieve disk information.

In non-connected mode, ASMCMD scans disk headers to retrieve disk information, using an ASM disk string to restrict the discovery set.
(none)
Displays the PATH column of the V$ASM_DISK view.
-k
Displays the TOTAL_MB, FREE_MB, OS_MB,NAME, FAILGROUP, LIBRARY, LABEL, UDID, PRODUCT, REDUNDANCY, and PATH columns of the V$ASM_DISK view.
-s
Displays the READS, WRITES, READ_ERRS, WRITE_ERRS, READ_TIME, WRITE_TIME, BYTES_READ, BYTES_WRITTEN, and the PATH columns of the V$ASM_DISK view.
-p
Displays the GROUP_NUMBER, DISK_NUMBER, INCARNATION, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE, and the PATH columns of the V$ASM_DISK view.
-t
Displays the CREATE_DATE, MOUNT_DATE, REPAIR_TIMER, and the PATH columns of the V$ASM_DISK view.
-g
Selects from GV$ASM_DISK_STAT, or from GV$ASM_DISK if the -c flag is also specified. GV$ASM_DISK.INST_ID is included in the output.
-c
Selects from V$ASM_DISK, or from GV$ASM_DISK if the -g flag is also specified. This option is ignored if the ASM instance is version 10.1 or earlier.
-H
Suppresses column headings.
-I
Scans disk headers for information rather than extracting the information from an ASM instance. This option forces the non-connected mode.
-d
Restricts results to only those disks that belong to the group specified by disk_group_name.
ASMCMD> lsdsk -k -d DATA *_0001
ASMCMD> lsdsk -s -d DATA *_0001
ASMCMD> lsdsk -t -d DATA *_0001
ASMCMD> lsdsk -C -t -d DATA *_0001
ASMCMD> lsdsk -g -t -d DATA *_0001

2 comments:

  1. Prediksi Jadwal Sabung Ayam SV388 25 Februari 2019 - Senin, 25 Februari 2019 – Pada Hari Tersebut Akan Di Laksanakan Berbagai Pertandingan Sabung Ayam Secara Live di Arena Sabung Ayam Thailand.

    Judi Sabung Ayam – Jika ingin mendaftar Games Permainan Sabung Ayam Khusus SV388. Cara untuk deposit atau withdraw, Anda bisa langsung kunjungi website kami atau langsung hubungi Customer Service kami melalui Livechat yang tersedia di website ini untuk melakukan semua Jenis transaksi Yang Ada.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete
  2. Jadwal Pertandingan Ayam SV388 7 Maret 2019 - Minggu, Ujung Pandang 10 Maret 2019 – Pada Hari Tersebut Akan Di Laksanakan Berbagai Pertandingan Sabung Ayam Secara Live di Arena Sabung Ayam Thailand.

    Situs Judi Sabung Ayam Online SV388 Merupakan Situs Judi Asal Thailand Yang Sangat Terkenal Dengan Permainan Sabung Ayam Yang Fair dan Menghibur Para Penonton Judi Sabung Ayam.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete