20170603星期六之redhat 6.5 asmcmd之一些新用法初識之一

wisdomone1發表於2017-06-03
測試結論
1,redhat 6.5 oracle 11.2.0.4之asmcmd -help顯示asmcmd具體用法


2,asmcmd info獲取具體命令的子項或子引數,可見asmcmd相當牛比,功能強大,見如下 第4


3,asmcmd 子引數或子項,會顯示具體的使用方法


[grid@zxy ~]$ asmcmd md_backup 
usage: md_backup backup_file [-G diskgroup [,diskgroup,...]]
help:  help md_backup




4,asmcmd help 子引數或子項 ,顯示具體命令的詳細用法


[grid@zxy ~]$ asmcmd help md_backup
        md_backup


        The md_backup command creates a backup file containing metadata 
        for one or more disk groups.
        Volume and Oracle Automatic Storage Management Cluster File System 
        (Oracle ACFS) file system information is not backed up.


        md_backup backup_file [-G diskgroup [,diskgroup,...]]


        The options for the md_backup command are described below.








5,asmcmd lsdsk -g ASM磁碟組 -p,同於v$asm_disk
[grid@zxy ~]$ asmcmd lsdsk -G asm_ocrvote -p
Group_Num  Disk_Num      Incarn  Mount_Stat  Header_Stat  Mode_Stat  State   Path
        1         0  3915950443  CACHED      MEMBER       ONLINE     NORMAL  /dev/asm_ocrvote


6,asmcmd lsdsk僅會顯示MOUNT的磁碟組之ASM磁碟
With the Automatic Storage Management option
[grid@zxy ~]$ asmcmd lsdsk -g
Inst_ID  Path
      1  /dev/asm_base
      1  /dev/asm_mount
      1  /dev/asm_ocrvote






7, asmcmd spget顯示ASM的SPFILE                      


[grid@zxy ~]$ asmcmd spget
+ASM_OCRVOTE/asm/asmparameterfile/registry.253.943931447




8,   asmcmd umount之umount asm磁碟組
[grid@zxy ~]$ asmcmd umount dg_mount


9,[grid@zxy ~]$ asmcmd mount dg_mount










測試明細
1,作業系統版本
[root@zxy ~]# more /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@zxy ~]# 


2,asmcmd -help獲取asmcmd具體用法
[grid@zxy ~]$ asmcmd -help
Unknown option: h
Unknown option: e
Unknown option: l
usage: asmcmd [-V] [-v ] [--privilege ] [-p] [command]
help:  help 
[grid@zxy ~]$ 


4,asmcmd info獲取具體命令的子項或子引數,可見asmcmd相當牛比,功能強大
[grid@zxy ~]$ asmcmd info
        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


[grid@zxy ~]$ 


5,asmcmd 子引數或子項,會顯示具體的使用方法


[grid@zxy ~]$ asmcmd md_backup 
usage: md_backup backup_file [-G diskgroup [,diskgroup,...]]
help:  help md_backup




6,asmcmd iostat顯示ASM磁碟組的讀寫效能
[grid@zxy ~]$ asmcmd iostat -G dg_mount
Group_Name  Dsk_Name       Reads   Writes  
DG_MOUNT    DG_MOUNT_0000  114688  593920  
DG_MOUNT    DG_MOUNT_0001  32768   16384




6,asmcmd help 子引數或子項 ,顯示具體命令的詳細用法


[grid@zxy ~]$ asmcmd help md_backup
        md_backup


        The md_backup command creates a backup file containing metadata 
        for one or more disk groups.
        Volume and Oracle Automatic Storage Management Cluster File System 
        (Oracle ACFS) file system information is not backed up.


        md_backup backup_file [-G diskgroup [,diskgroup,...]]


        The options for the md_backup command are described below.


        backup_file     - Specifies the backup file in which you want to 
                          store the metadata.
        -G diskgroup    - Specifies the disk group name of the disk group 
                          that must be backed up


        By default all the mounted disk groups are included in the backup file,
        which is saved in the current working directory.


        The first example shows the use of the backup command when you run it
        without the disk group option. This example backs up all of the mounted
        disk groups and creates the backup image in the current working 
        directory. The second example creates a backup of disk group DATA and
        FRA. The backup that this example creates is saved in the
        /tmp/dgbackup20090716 file.


        ASMCMD [+] > md_backup /tmp/dgbackup20090716
        ASMCMD [+] > md_backup /tmp/dgbackup20090716 -G DATA,FRA
        Disk group metadata to be backed up: DATA
        Disk group metadata to be backed up: FRA
        Current alias directory path: ASM/ASMPARAMETERFILE
        Current alias directory path: ORCL/DATAFILE
        Current alias directory path: ORCL/TEMPFILE
        Current alias directory path: ORCL/CONTROLFILE
        Current alias directory path: ORCL/PARAMETERFILE
        Current alias directory path: ASM
        Current alias directory path: ORCL/ONLINELOG
        Current alias directory path: ORCL
        Current alias directory path: ORCL/CONTROLFILE
        Current alias directory path: ORCL/ARCHIVELOG/2009_07_13
        Current alias directory path: ORCL/BACKUPSET/2009_07_14
        Current alias directory path: ORCL/ARCHIVELOG/2009_07_14
        Current alias directory path: ORCL
        Current alias directory path: ORCL/DATAFILE
        Current alias directory path: ORCL/ARCHIVELOG
        Current alias directory path: ORCL/BACKUPSET
        Current alias directory path: ORCL/ONLINELOG


[grid@zxy ~]$ 


7,asmcmd help lsdsk顯示ASM磁碟
[grid@zxy ~]$ 
[grid@zxy ~]$ asmcmd help lsdsk
        lsdsk


        List Oracle ASM disks.


        lsdsk [-kptgMI][-G diskgroup ] [--suppressheader] [ --member|--candidate] [--discovery][--statistics][pattern]


        The options for the lsdsk command are described below.


        (none)  - Displays the PATH column of the V$ASM_DISK_STAT 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.
        --statistics    - 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 --discovery flag is also specified. 
                  GV$ASM_DISK.INST_ID is included in the output.
        --discovery     - Selects from V$ASM_DISK, or from GV$ASM_DISK 
                  if the -g flag is also specified. This option is always 
                  enabled if the Oracle ASM instance is version 10.1 or 
                  earlier. This flag is disregarded if lsdsk is running 
                  in non-connected mode.
        -I      - Scans disk headers for information rather than 
                  extracting the information from an Oracle ASM instance. 
                  This option forces non-connected mode.
        -G      - Restricts results to only those disks that belong to
                  the group specified by diskgroup.
        -M      - Displays the disks that are visible to some but not 
                  all active instances. These are disks that, if included 
                  in a disk group, will cause the mount of that disk group 
                  to fail on the instances where the disks are not visible.
        --suppressheader       - Suppresses column headings.
        --candidate     - Restricts results to only disks having 
                  membership status equal to CANDIDATE.
        --member        - Restricts results to only disks having membership 
                  status equal to MEMBER.
        pattern - Returns only information about the specified disks 
                  that match the supplied pattern.


        The lsdsk command can run in connected or non-connected mode.
        The connected mode is always attempted first. The -I option 
        forces non-connected mode.


        In connected mode, lsdsk uses the V$ASM_DISK_STAT and V$ASM_DISK
        dynamic views to retrieve disk information. The V$ASM_DISK_STAT
        view is used by default.


        In non-connected mode, lsdsk scans disk headers to retrieve 
        disk information. Some information is not available in this
        mode and some options are not valid combinations with this mode.


        Note: The non-connected mode is not supported on Microsoft Windows.
        pattern restricts the output to only disks that match the pattern 
        specified. Wild-card characters and slashes (/ or \) can be part
        of the pattern. pattern should be specified as the last option for
        the command.


        The -k, -p, -t, and --statistics options modify how much information 
        is displayed for each disk. If any combination of the options are 
        specified, then the output shows the union of the attributes 
        associated with each flag.


        The following are examples of the lsdsk command. The first and second 
        examples list information about disks in the DATA disk group. The third
        example lists information about candidate disks.


ASMCMD [+] > lsdsk -t -G DATA
Create_Date  Mount_Date  Repair_Timer  Path
13-JUL-09    13-JUL-09   0             /devices/diska1
13-JUL-09    13-JUL-09   0             /devices/diska2
13-JUL-09    13-JUL-09   0             /devices/diska3
13-JUL-09    13-JUL-09   0             /devices/diskb1
13-JUL-09    13-JUL-09   0             /devices/diskb2
13-JUL-09    13-JUL-09   0             /devices/diskb3
13-JUL-09    13-JUL-09   0             /devices/diskc1
13-JUL-09    13-JUL-09   0             /devices/diskc2
...


ASMCMD [+] > lsdsk -p -G DATA /devices/diska*
Group_Num  Disk_Num      Incarn  Mount_Stat  Header_Stat  Mode_Stat  State   Path
        1         0  2105454210  CACHED      MEMBER       ONLINE     NORMAL  /devices/diska1
        1         1  2105454199  CACHED      MEMBER       ONLINE     NORMAL  /devices/diska2
        1         2  2105454205  CACHED      MEMBER       ONLINE     NORMAL  /devices/diska3


ASMCMD [+] > lsdsk --candidate -p
Group_Num  Disk_Num      Incarn  Mount_Stat  Header_Stat  Mode_Stat  State   Path
        0         5  2105454171  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diske1
        0        25  2105454191  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diske2
        0        18  2105454184  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diske3
        0        31  2105454197  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diskk1
        0        21  2105454187  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diskk2
        0        26  2105454192  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diskk3
        0        14  2105454180  CLOSED      CANDIDATE    ONLINE     NORMAL  /devices/diskl1
...


[grid@zxy ~]$ 






[grid@zxy ~]$ asmcmd lsdsk -G asm_ocrvote
Path
/dev/asm_ocrvote




[grid@zxy ~]$ asmcmd lsdsk -G asm_ocrvote -p
Group_Num  Disk_Num      Incarn  Mount_Stat  Header_Stat  Mode_Stat  State   Path
        1         0  3915950443  CACHED      MEMBER       ONLINE     NORMAL  /dev/asm_ocrvote






SQL> select group_number,name,state from v$asm_diskgroup;


GROUP_NUMBER NAME                           STATE
------------ ------------------------------ -----------
           1 ASM_OCRVOTE                    MOUNTED
           0 DG_MOUNT                       DISMOUNTED




SQL> alter diskgroup dg_mount mount;


Diskgroup altered.


8,asmcmd lsdsk僅會顯示MOUNT的磁碟組之ASM磁碟
With the Automatic Storage Management option
[grid@zxy ~]$ asmcmd lsdsk -g
Inst_ID  Path
      1  /dev/asm_base
      1  /dev/asm_mount
      1  /dev/asm_ocrvote




9,asmcmd spget顯示ASM的SPFILE                      


[grid@zxy ~]$ asmcmd spget
+ASM_OCRVOTE/asm/asmparameterfile/registry.253.943931447
[grid@zxy ~]$ sqlplus '/as sysasm'


SQL*Plus: Release 11.2.0.4.0 Production on Sat Jun 3 01:23:53 2017


Copyright (c) 1982, 2013, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option


SQL> show parameter spfile


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +ASM_OCRVOTE/asm/asmparameterf
                                                 ile/registry.253.943931447
SQL> 








10,asmcmd umount之umount asm磁碟組


[grid@zxy ~]$ asmcmd help umount
        umount


        Dismounts a disk group.


        umount { -a | [-f] diskgroup }


        The options for the umount command are described below.


        diskgroup       - Name of the disk group.
        -a              - Dismounts all mounted disk groups. These disk 
                          groups are listed in the output of the 
                          V$ASM_DISKGROUP view.
        -f              - Forces the dismount operation.


        The following are examples of the umount command. The first example 
        dismounts all disk groups mounted on the Oracle ASM instance. The 
        second example forces the dismount of the DATA disk group.


        ASMCMD [+] > umount -a
        ASMCMD [+] > umount -f DATA


[grid@zxy ~]$ 


[grid@zxy ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  2097152      5120     5052                0            5052              0             N  ASM_OCRVOTE/
MOUNTED  EXTERN  N         512   4096  1048576     20480    15165                0           15165              0             N  DG_MOUNT/
[grid@zxy ~]$ 


[grid@zxy ~]$ asmcmd umount dg_mount
[grid@zxy ~]$ 
[grid@zxy ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  2097152      5120     5052                0            5052              0             N  ASM_OCRVOTE/
[grid@zxy ~]$ 








11,asmcmd mount之MOUNT ASM磁碟組
[grid@zxy ~]$ asmcmd help mount
        mount


        Mounts a disk group.


        mount [--restrict] { [-a] | [-f] diskgroup[ diskgroup ...] }


        The options for the mount command are described below.


        diskgroup       - Name of the disk group.
        -a              - Mounts all disk groups.
        --restrict      - Mounts in restricted mode.
        -f              - Forces the mount operation.


        This operation mounts one or more disk groups. A disk group
        can be mounted with or without force or restricted options.


        The following are examples of the mount command showing the use of
        the -force, -restrict, and -a options.


        ASMCMD [+] > mount -f data
        ASMCMD [+] > mount --restrict data
        ASMCMD [+] > mount -a






[grid@zxy ~]$ asmcmd mount dg_mount
[grid@zxy ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  2097152      5120     5052                0            5052              0             N  ASM_OCRVOTE/
MOUNTED  EXTERN  N         512   4096  1048576     20480    15165                0           15165              0             N  DG_MOUNT/
[grid@zxy ~]$ 




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-2140249/,如需轉載,請註明出處,否則將追究法律責任。

相關文章