[Oracle] Oracle ASM management and monitoring command

Oracle ASM management and monitoring command

purpose:

See current information related to Oracle ASM.

1. Check the disk group

[root@newarpdb01 ~]# su - oracle
[oracle@newarpdb01 ~]$ sqlplus "/as sysdba"
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE         TOTAL_MB    FREE_MB
------------ ------------------------------ ----------- ---------- ----------
           1 OCR                            MOUNTED          30720      29794
           2 DATA                           CONNECTED      2097152    1935206

You can see the current RAC数据库is DATAand OCRasm disk group. And data disk group, a total of about 2TB.

2. Review the current archive

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +DATA/archivelog
Oldest online log sequence     4695
Next log sequence to archive   4696
Current log sequence           4696

3. Check the ASM disk path

SQL> col name format a10;
SQL> col path format a20;
SQL> col STATE format a20;
SQL> select path, name ,STATE,TOTAL_MB,FREE_MB from v$asm_disk;

PATH                 NAME       STATE                  TOTAL_MB    FREE_MB
-------------------- ---------- -------------------- ---------- ----------
/dev/ocr1            OCR_0000   NORMAL                    10240       9933
/dev/ocr2            OCR_0001   NORMAL                    10240       9931
/dev/ocr3            OCR_0002   NORMAL                    10240       9930
/dev/datadisk2       DATA_0001  NORMAL                  1048576     967628
/dev/datadisk1       DATA_0000  NORMAL                  1048576     967578
/dev/datadisk8                  NORMAL                        0          0
/dev/datadisk6                  NORMAL                        0          0
/dev/datadisk3                  NORMAL                        0          0
/dev/datadisk5                  NORMAL                        0          0
/dev/datadisk10                 NORMAL                        0          0
/dev/datadisk9                  NORMAL                        0          0

PATH                 NAME       STATE                  TOTAL_MB    FREE_MB
-------------------- ---------- -------------------- ---------- ----------
/dev/datadisk4                  NORMAL                        0          0
/dev/datadisk7                  NORMAL                        0          0

13 rows selected.

4. asmcmd

4.1 into the asmcmd

[root@newarpdb01 ~]# su - grid
[grid@newarpdb01 ~]$ asmcmd
ASMCMD> help    ---可以看到asmcmd的帮助文档
 asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysasm|sysdba>] [-p] [command]
asmcmd_no_conn_str

        Starts asmcmd (if no parameters) or executes the command with given parameters

        asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysasm|sysdba>] [-p] [command]

        Specify the connect string after the -c option to use the listener to 
        connect.  By default, ASMCMD asks for a password in a non-echoing 
        prompt, unless the password is specified as part of the connect string.

        The connect identifier is in the form of "host:port:sid", with the
        host and the port being option.  Host defaults to "localhost" and port
        to 1521.  If the sid is not specified as a part of the connect 
        identifier, then it is read from the environment variable ORACLE_SID.

        If no connect string is used, then environment variables 
        ORACLE_HOME and ORACLE_SID determine the instance to which the program 
        connects, and asmcmd establishes a bequeath connection to the it, in 
        the same manner as a SQLPLUS / AS SYSASM.  The user must be a member 
        of the SYSDBA group to exercise this option.

        Specifying the -V option prints the asmcmd version number and
        exits immediately.

        Specifying the -v option prints extra information that can help
        advanced users diagnose problems.

        Specify the --privilege option to choose the type of connection. There are
        only two possibilities: connecting as SYSASM or as SYSDBA.
        The default value if this option is unspecified is SYSASM:

        Specifying the -p option allows the current directory to be displayed 
        in the command prompt, like so:

        ASMCMD [+DATA/ORCL/CONTROLFILE] >

        The parameter command specifies one of the following commands, along 
        with its parameters.

        Type "help [command]" to get help on a specific ASMCMD command.

        commands:
        --------

        md_backup, md_restore

        analyze

        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

4.2 lsdg view the disk group information

View lsdg help command

ASMCMD> help lsdg
        lsdg

        Lists disk groups and their information. lsdg queries 
        V$ASM_DISKGROUP_STAT by default. If the --discovery flag is specified,
        the V$ASM_DISKGROUP is queried instead. The output also includes 
        notification of any current rebalance operation for a disk group. If 
        a disk group is specified, then lsdg returns only information about 
        that disk group.

Use lsdg, view details asm disk group, such as disk size, available size.

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  1048576   2097152  1935206                0         1935206              0             N  DATA/
MOUNTED  NORMAL  N         512   4096  1048576     30720    29794            10240            9777              0             Y  OCR/

Other commands, and related commands similar to linux. Self-exploration.

For example: find the location of the archive logs in the Oracle asm. as follows:

[grid@newarpdb01 ~]$ asmcmd
ASMCMD> ls
DATA/
OCR/
ASMCMD> cd DATA
ASMCMD> ls
NEWARPDB/
archivelog/
ASMCMD> cd archivelog
ASMCMD> ls -l arch_5136_1002312928_0002.arc
Type        Redund  Striped  Time             Sys  Name
                                              N    arch_5136_1002312928_0002.arc => +DATA/NEWARPDB/ARCHIVELOG/2019_11_26/thread_2_seq_5136.1628.1025345465

Guess you like

Origin www.cnblogs.com/zhangshengdong/p/11935035.html