Conhecendo um pouco do OAKCLI - (Oracle Appliance Kit Command Line Interface)

O OAKCLI (Oracle Appliance Kit Command Line Interface) é uma interface de linha de comando para gerenciamento do Oracle Database Appliance (ODA) utilizada para execução de tarefas como, aplicação de patches, gerenciamento de maquinas virtuais, criação de databases, configuração de core keys, diagnostico de hardware, etc.
O "executável" fica localizado no diretório /opt/oracle/oak/bin/oakcli, sendo que o usuário root deve ter a variável de ambiente ORA_OAK_HOME definida com este diretório base (/opt/oracle/oak). Vale destacar que para ter permissão para executar todas as funcionalidades, é preciso que a execução seja realizada com o usuário root. 
Dependendo da versão do Oracle Appliance Manager e do Hardware utilizado, alguns comandos do oakcli podem não estar disponíveis ou mesmo, podem apresentar mais opções. Para verificar as opções disponíveis para execução do oakcli podemos executar um oakcli -h e ou oakcli show -h.
[root@ODA_TST01 ~]# oakcli -h
Usage:  oakcli show       - show disk, diskgroup, expander, controller, storage, version, fs, raidsyncstatus, dbhomes, dbstorage, databases, db_config_params, core_config_key, env_hw, asr
        oakcli configure  - configures the network or asr or additionalnet
        oakcli apply      - applies the core_config_key
        oakcli locate     - locates a disk
        oakcli deploy     - deploys the Database Appliance
        oakcli update     - updates the Database Appliance
        oakcli validate   - validates the Database Appliance
        oakcli manage     - manages the oak repository, diagcollect e.t.c
        oakcli unpack     - unpack the given package to oak repository
        oakcli copy       - copies the deployment config file
        oakcli upgrade    - upgrades database
        oakcli stordiag   - run storage diagnostic tool on both node
        oakcli test       - test asr
        oakcli orachk     - performs configuration settings check on ODA
        oakcli create     - creates database, dbstorage, snapshotdb, dbhome, db_config_params file
        oakcli delete     - deletes database, dbstorage, dbhome, db_config_params file
        oakcli resize     - resizes dbstorage
[root@ODA_TST01 ~]#
[root@ODA_TST01 ~]# oakcli show -h
Usage:
oakcli show {disk|diskgroup|expander|fs|raidsyncstatus|controller|storage|core_config_key|version|dbhomes|dbstorage|databases|db_config_params|asr|env_hw} [<options>]
where:
        disk                     - About the disk
        diskgroup                - Asm disk group
        expander                 - Expander
        fs                       - Filesystem
        controller               - Controller
        storage                  - All storage components
        version                  - Running software version
        dbhomes                  - Installed oracle database homes
        dbstorage                - Details of ACFS storage setup for the databases
        databases                - Database names
        db_config_params         - db_config_params file
        asr                      - Asr configuration
        env_hw                   - Environment and Hardware information
        raidsyncstatus           - RAID sync status information
        core_config_key          - Core configuration
For detailed help on each command and object and its options use:
oakcli <command> <object> -h
Vale lembrar que, sempre que existir uma duvida quando a sintaxe utiliza, podemos e devems utilizar o comando help, que nos mostrara as "opções" disponíveis para cada comando. Por exemplo, precisamos realizar o diagnostico de um disco especifico e não lembramos a sintaxe do comando. Abaixo não será mostrado todo o resultado do comando devido ao seu temanho.
[root@ODA_TST01  ~]# oakcli stordiag -h
Usage:
      oakcli stordiag -h | n
                      -h : Help Message
                       n : oakd disk resource name
    resource name format : pd_[0..23]
[root@ODA_TST01  ~]#
[root@ODA_TST01  ~]# oakcli stordiag pd_01
 Node Name : ODA_TST01 
 Test : Diagnostic Test Description

   1  : OAK Check
        NAME            PATH            TYPE            STATE           STATE_DETAILS
        pd_01           /dev/sdm        HDD             ONLINE          Good

   2  : ASM Check
        ASM Disk Status                        :  group_number   state   mode_s  mount_s header_s
        /dev/mapper/HDD_E0_S01_1199124347p2    :         2       NORMAL  ONLINE  CACHED  MEMBER
        /dev/mapper/HDD_E0_S01_1199124347p1    :         1       NORMAL  ONLINE  CACHED  MEMBER

   3  : Multipathd Status
        multipathd running on system
.
.
.
Também podemos listar todos os discos existentes através do comando show disk, podemos listar os discos de um diskgroup específico com o comando show diskgroup.    
[root@ODA_TST01 ~]# oakcli show disk
        NAME            PATH            TYPE            STATE           STATE_DETAILS

        pd_00           /dev/sdc        HDD             ONLINE          Good
        pd_01           /dev/sdm        HDD             ONLINE          Good
        pd_02           /dev/sdo        HDD             ONLINE          Good
        pd_03           /dev/sdy        HDD             ONLINE          Good
        pd_04           /dev/sdd        HDD             ONLINE          Good
        pd_05           /dev/sdn        HDD             ONLINE          Good
        pd_06           /dev/sdp        HDD             ONLINE          Good
        pd_07           /dev/sdz        HDD             ONLINE          Good
        pd_08           /dev/sde        HDD             ONLINE          Good
        pd_09           /dev/sdk        HDD             ONLINE          Good
        pd_10           /dev/sdq        HDD             ONLINE          Good
        pd_11           /dev/sdw        HDD             ONLINE          Good
        pd_12           /dev/sdf        HDD             ONLINE          Good
        pd_13           /dev/sdl        HDD             ONLINE          Good
        pd_14           /dev/sdr        HDD             ONLINE          Good
        pd_15           /dev/sdx        HDD             ONLINE          Good
        pd_16           /dev/sdg        HDD             ONLINE          Good
        pd_17           /dev/sdi        HDD             ONLINE          Good
        pd_18           /dev/sds        HDD             ONLINE          Good
        pd_19           /dev/sdu        HDD             ONLINE          Good
        pd_20           /dev/sdh        SSD             ONLINE          Good
        pd_21           /dev/sdj        SSD             ONLINE          Good
        pd_22           /dev/sdt        SSD             ONLINE          Good
        pd_23           /dev/sdv        SSD             ONLINE          Good
[root@ODA_TST01 ~]# oakcli show diskgroup
DiskGroups
----------
DATA
RECO
REDO
[root@ODA_TST01 ~]# oakcli show diskgroup RECO
        ASM_DISK        PATH                                            DISK            STATE           STATE_DETAILS

        reco_00         /dev/mapper/HDD_E0_S00_1199244847p2             pd_00           ONLINE          Good
        reco_01         /dev/mapper/HDD_E0_S01_1199124347p2             pd_01           ONLINE          Good
        reco_02         /dev/mapper/HDD_E1_S02_1095363320p2             pd_02           ONLINE          Good
        reco_03         /dev/mapper/HDD_E1_S03_682322803p2              pd_03           ONLINE          Good
        reco_04         /dev/mapper/HDD_E0_S04_1199114147p2             pd_04           ONLINE          Good
        reco_05         /dev/mapper/HDD_E0_S05_1199254039p2             pd_05           ONLINE          Good
        reco_06         /dev/mapper/HDD_E1_S06_1199134763p2             pd_06           ONLINE          Good
        reco_07         /dev/mapper/HDD_E1_S07_1199106347p2             pd_07           ONLINE          Good
        reco_08         /dev/mapper/HDD_E0_S08_1199225207p2             pd_08           ONLINE          Good
        reco_09         /dev/mapper/HDD_E0_S09_1199241551p2             pd_09           ONLINE          Good
        reco_10         /dev/mapper/HDD_E1_S10_1199105123p2             pd_10           ONLINE          Good
        reco_11         /dev/mapper/HDD_E1_S11_1199117223p2             pd_11           ONLINE          Good
        reco_12         /dev/mapper/HDD_E0_S12_497670107p2              pd_12           ONLINE          Good
        reco_13         /dev/mapper/HDD_E0_S13_1199226407p2             pd_13           ONLINE          Good
        reco_14         /dev/mapper/HDD_E1_S14_1199226287p2             pd_14           ONLINE          Good
        reco_15         /dev/mapper/HDD_E1_S15_1199248043p2             pd_15           ONLINE          Good
        reco_16         /dev/mapper/HDD_E0_S16_1199132243p2             pd_16           ONLINE          Good
        reco_17         /dev/mapper/HDD_E0_S17_1199118199p2             pd_17           ONLINE          Good
        reco_18         /dev/mapper/HDD_E1_S18_1199118299p2             pd_18           ONLINE          Good
        reco_19         /dev/mapper/HDD_E1_S19_1199108523p2             pd_19           ONLINE          Good
[root@ODA_TST01 ~]#
Podemos também ativar ou desativar o LED de identificação de um disco (LED amarelo). Este comando pode ser bastante util quando existir a necessidade de substituição de um disco com problemas, caso o mesmo não tenha sido identificado automaticamente.
[root@ODA_TST01 ~]# oakcli locate pd_01
Usage:
oakcli locate disk  <diskname>   <on | off>
where:
        on     - turns on the  LED of the given disk
        off    - turns off the LED of the given disk
[root@ODA_TST01 ~]#
Utilizando o show version, podemos facilmente consultar a versão atual do software e firmware do ODA.
[root@ODA_TST01 ~]# oakcli show version
Version
-------
12.1.2.4.0
[root@ODA_TST01 ~]#
É possível validar se a core_config_key está aplicada e qual os valores definidos (serial, cores, hardware, etc)
root@ODA_TST01 ~]# oakcli show core_config_key

Host's serialnumber                    =                     ----------
Enabled Cores (per server)             =                              4
Total Enabled Cores (on two servers)   =                              8
Server type                            =        V1 -> SUN FIRE X4370 M2
Hyperthreading is enabled.  Each core has 2 threads. Operating system displays 8 processors per server
O comando show databases nos mostra as informações dos database existentes.
[root@ODA_TST01 ~]# oakcli show databases
Name     Type       Storage   HomeName             HomeLocation                                       Version
-----    ------     --------  --------------       ----------------                                   ----------
lamimtst1  RAC        ACFS      OraDb11204_home1     /u01/app/oracle/product/11.2.0.4/dbhome_1          11.2.0.4.7(20760982,20831122)
[root@ODA_TST01 ~]#
Para verificar as informações do storage, usamos o comando show storage.
[root@ODA_TST01 ~]# oakcli show storage
==== BEGIN STORAGE DUMP ========
Host Description: ORACLE CORPORATION:SUN FIRE X4370 M2 SERVER
Total number of controllers: 2
        Id         = 0
        Serial Num = --------
        Vendor     = LSI Logic
        Model      = SGX-SAS6-INT-Z
        FwVers     = 11.05.03.00
        strId      = mpt2sas:0d:00.0

        Id         = 1
        Serial Num = --------
        Vendor     = LSI Logic
        Model      = SGX-SAS6-INT-Z
        FwVers     = 11.05.03.00
        strId      = mpt2sas:1f:00.0

Total number of expanders: 2
        Id         = 0
        Serial Num = --------
        Vendor     = SUN
        Model      = T4 Storage
        FwVers     = 0342
        strId      = Primary
        WWN        = 5080020000b25d3d

        Id         = 1
        Serial Num = --------
        Vendor     = SUN
        Model      = T4 Storage
        FwVers     = 0342
        strId      = Secondary
        WWN        = 5080020000b25d7d

Total number of PDs: 24
        /dev/sdc        SEAGATE           HDD  600gb slot:  0  exp:  0
        /dev/sdm        SEAGATE           HDD  600gb slot:  1  exp:  0
        /dev/sdo        HITACHI           HDD  600gb slot:  2  exp:  1
        /dev/sdy        SEAGATE           HDD  600gb slot:  3  exp:  1
        /dev/sdd        SEAGATE           HDD  600gb slot:  4  exp:  0
        /dev/sdn        SEAGATE           HDD  600gb slot:  5  exp:  0
        /dev/sdp        SEAGATE           HDD  600gb slot:  6  exp:  1
        /dev/sdz        SEAGATE           HDD  600gb slot:  7  exp:  1
        /dev/sde        SEAGATE           HDD  600gb slot:  8  exp:  0
        /dev/sdk        SEAGATE           HDD  600gb slot:  9  exp:  0
        /dev/sdq        SEAGATE           HDD  600gb slot: 10  exp:  1
        /dev/sdw        SEAGATE           HDD  600gb slot: 11  exp:  1
        /dev/sdf        SEAGATE           HDD  600gb slot: 12  exp:  0
        /dev/sdl        SEAGATE           HDD  600gb slot: 13  exp:  0
        /dev/sdr        SEAGATE           HDD  600gb slot: 14  exp:  1
        /dev/sdx        SEAGATE           HDD  600gb slot: 15  exp:  1
        /dev/sdg        SEAGATE           HDD  600gb slot: 16  exp:  0
        /dev/sdi        SEAGATE           HDD  600gb slot: 17  exp:  0
        /dev/sds        SEAGATE           HDD  600gb slot: 18  exp:  1
        /dev/sdu        SEAGATE           HDD  600gb slot: 19  exp:  1
        /dev/sdh        STEC              SSD   73gb slot: 20  exp:  0
        /dev/sdj        STEC              SSD   73gb slot: 21  exp:  0
        /dev/sdt        STEC              SSD   73gb slot: 22  exp:  1
        /dev/sdv        STEC              SSD   73gb slot: 23  exp:  1
==== END STORAGE DUMP =========
Outro comando bastante usado é o validate, que pode ser consultado utilizando o -h, conforme usamos no comando show.
[root@ODA_TST01 ~]# oakcli validate -h
Usage:
 oakcli  validate [-V | -l | -h]
 oakcli  validate [-v] [-f absolute output_file_name] [-a | -d | -c check1[,check2] [-ver <patch version>]]
        ARGUMENTS:
                -v      verbose output
                -f      output_file_name.The output is sent to the file instead of standard output
                -a      run all checks
                -d      run only default checks.
                -c      check1[,check2] run specific checks
                -l      list the checks and description
                -V      Print the Version
                -h      print help
        EXAMPLES:
        oakcli validate -l
        oakcli validate -a
        oakcli validate -c OSDiskStorage
        oakcli validate -c SharedStorage
        oakcli validate -c StorageTopology
        oakcli validate -c DiskCalibration
        oakcli validate -c SystemComponents,NetworkComponents,asr
        oakcli validate -c ospatch -ver 12.1.2.0.0
[root@ODA_TST01 ~]# oakcli  validate -l

        Checkname -- Description
        =========    ===========
        *SystemComponents -- Validate system components based on ilom sensor data readings
        *OSDiskStorage -- Validate OS disks and filesystem information
        *SharedStorage -- Validate Shared storage and multipathing information
        DiskCalibration -- Check disk performance with orion
        *NetworkComponents -- Validate public and private network components
        asr -- Validate asr components based on asr config file and ilom sensor data readings
        ospatch -- Verifies whether OS patching could be successful or not

* -- These checks are also performed as part of default checks

[root@ODA_TST01 ~]#
[root@ODA_TST01 ~]# oakcli validate -c SystemComponents
INFO: oak system information and Validations
RESULT: System Software inventory details
 Reading the metadata. It takes a while...
 System Version  Component Name            Installed Version         Supported Version
 --------------  ---------------           ------------------        -----------------
 12.1.2.4.0
                 Controller                11.05.03.00               Up-to-date
                 Expander                  0342                      Up-to-date
                 SSD_SHARED                E12B                      Up-to-date
                 HDD_LOCAL                 SA03                      Up-to-date
                 HDD_SHARED {
                 [ c2d2 ]                  A700                      A820
                 [ c2d0,c2d1,c2d3,c2d      0B25                      Up-to-date
                 4,c2d5,c2d6,c2d7,c2d
                 8,c2d9,c2d10,c2d11,c
                 2d12,c2d13,c2d14,c2d
                 15,c2d16,c2d17,c2d18
                 ,c2d19 ]
                              }
                 ILOM                      3.0.16.22.f r100119       Up-to-date
                 BIOS                      12010311                  Up-to-date
                 IPMI                      1.8.12.0                  Up-to-date
                 HMP                       2.3.2.4.1                 Up-to-date
                 OAK                       12.1.2.4.0                Up-to-date
                 OL                        5.11                      Up-to-date
                 GI_HOME                   12.1.0.2.4(20831110,      Up-to-date
                                           20831113)
                 DB_HOME {
                 [ OraDb12102_home1 ]      12.1.0.2.4(20831110,      Up-to-date
                                           20831113)
                 [ OraDb11204_home1 ]      11.2.0.4.7(20760982,      Up-to-date
                                           20831122)
                              }
RESULT: System Information:-
        Manufacturer:ORACLE CORPORATION
        Product Name:SUN FIRE X4370 M2 SERVER
        Serial Number:--------
RESULT: BIOS Information:-
        Vendor:American Megatrends Inc.
        Version:12010311
        Release Date:04/10/2013
        BIOS Revision:1.3
        Firmware Revision:1.3
SUCCESS: Controller p1 has the IR Bypass mode set correctly
SUCCESS: Controller p2 has the IR Bypass mode set correctly
INFO: Reading ilom data, may take short while..
INFO: Read the ilom data. Doing Validations
RESULT: System ILOM Version: 3.0.16.22.f r100119
RESULT: System BMC firmware version  3.00
RESULT: Powersupply PS0 V_IN=116 Volts I_IN=3.12 Amps V_OUT=12 Volts I_OUT=27.60 Amps IN_POWER=380 Watts OUT_POWER=340 Watts
RESULT: Powersupply PS1 V_IN=124 Volts I_IN=2.88 Amps V_OUT=12 Volts I_OUT=26.60 Amps IN_POWER=360 Watts OUT_POWER=320 Watts
SUCCESS: Both the powersupply are ok and functioning
RESULT: Cooling Unit FM0 fan speed F0=3800 RPM F1=3300 RPM
RESULT: Cooling Unit FM1 fan speed F0=3800 RPM F1=3100 RPM
SUCCESS: Both the cooling unit are present
RESULT: Processor P0 present Details:-
        Version:Intel(R) Xeon(R) CPU           X5675  @ 3.07GHz
        Current Speed:3066 MHz  Core Enabled:2  Thread Count:4
SUCCESS: All 6 memory modules of CPU P0 ok, each module is of Size:8192 MB Type:DDR3 Speed:1333 MHz manufacturer:Samsung
RESULT: Processor P1 present Details:-
        Version:Intel(R) Xeon(R) CPU           X5675  @ 3.07GHz
        Current Speed:3066 MHz  Core Enabled:2  Thread Count:4
SUCCESS: All 6 memory modules of CPU P1 ok, each module is of Size:8192 MB Type:DDR3 Speed:1333 MHz manufacturer:Samsung
RESULT: Total System Memory is 98934312 kB
SUCCESS: All OS Disks are present and in ok state
SUCCESS: All expander present and ok status
SUCCESS: All shared Disks are present and in ok state
RESULT: Temperature System Board=35 degrees C||Riser Board=27 degrees C||Power Supply=23 degrees C
Mostrei apenas alguns dos comandos que podemos utilizar através do OAKCLI. Além de utilizar o parâmetro -h podemos e devemos sempre verificar a documentação.
https://docs.oracle.com/cd/E22693_01/doc.12/e55580/oakcli.htm#BABDCHFA
https://docs.oracle.com/cd/E68623_01/doc.121/e68637/GUID-17880D1D-A34F-4A2B-96DC-C86791A6A8F6.htm#CMTAR152


Comentários