CLI Command




Host and System Control  

Power on the server

start /SYS


Power off the server


stop [-force] /SYS


Power cycle the server


reset /SYS


Redirect host console stream to Oracle ILOM


start /HOST/console


Enable SPARC diagnostic state (default value)

set /SYS keyswitch_state=diag


Oracle ILOM Initial Setup  

Show network configuration
show /SP/network/


Configure static IPv4 address
set /SP/network pendingipdiscovery=static pendingipaddress= address pendingipnetmask=netmask pendingipgateway=address commitpending=true 


Create user account with all privileges 

create /SP/users/newusername role=aucro [password=password]


Create user account with operator privileges
create /SP/users/newusername role=cro [password=password]

Create read-only user account
create /SP/users/newusername role=o[password=password]

Delete user account
delete /SP/users/username



System Monitoring and Status 

Show the Oracle ILOM Event Log
show /SP/logs/event/list

List all hardware faults
show -level all -output table /SP/faultmgmt

List all temperature sensor readings
show -level all -output table /SYS type==Temperature value

Show actual system power consumption
show /SP/VPS value

System Inventory

List all DIMMs
show -level all -output table /SYS type==DIMM

Lista all CPUs
show -level all -output table /SYS type=='Host Processor'

List all power supplies
show -level all -output table /SYS type=='Power Supply' fru_name==*

List all hard disks
show -l all /SYS type=='Hard Disk'

Oracle ILOM Maintenance

Update Oracle ILOM firmware
load -source URI /SP/firmware

Reset Oracle ILOM SP
reset /SP

Oracle ILOM Configuration Management


Reset Oracle ILOM configuration to factory defaults
set /SP reset_to_defaults=all

Backup Oracle ILOM configuration to a file
dump -destination URI /SP/config

Restore Oracle ILOM configuration from a file
load -source URI /SP/config




Solaris Networking


To see interfaces 
note: Determine which interfaces are currently installed on the system.
# dladm show-link
eri0    type: legacy    mtu: 1500       device: eri0 
qfe0    type: legacy    mtu: 1500       device: qfe0 
qfe1    type: legacy    mtu: 1500       device: qfe1 
qfe2    type: legacy    mtu: 1500       device: qfe2 
qfe3    type: legacy    mtu: 1500       device: qfe3 
bge0    type: non-vlan  mtu: 1500       device: bge0


Main Files for networking
/etc/nodename
/etc/hostname.interface
/etc/inet/hosts 
/etc/inet/ipnodes
/etc/defaultdomain
/etc/defaultrouter

to check ip solaris zone
zlogin epson_db ipadm show-addr


netadm list 
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
loc         Automatic      offline
loc         NoNet          offline
loc         DefaultFixed   onlinenetadm list 

dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      e1000g0

# ipadm show-addr
ADDROBJ                TYPE     STATE        ADDR
lo0/v4                 static   ok           127.0.0.1/8
net0/geeklab           static   ok           192.168.1.20/24
lo0/v6                 static   ok           ::1/128






Solaris Zone and ZFS

https://docs.oracle.com/cd/E23824_01/html/821-1448/gbcik.html#scrolltoc

Update
pkg update -nv --accept

To see the disks
format

Creating a Basic ZFS File System
/dev/dsk/c1t0d0 and /dev/dsk/c2t0d0
zpool create tank mirror c1t0d0 c2t0d0

mkfile 100m /tank/foo
df -h /tank
Filesystem             size   used  avail capacity  Mounted on

tank                   80G   100M    80G     1%    /tank

 To create a file system named fs in the storage pool tank

zfs create tank/fs

mkfile 100m /tank/fs/foo
df -h /tank/fs
Filesystem             size   used  avail capacity  Mounted on

tank/fs                 80G   100M    80G     1%    /tank/fs

How to Identify Storage Requirements for Your ZFS Storage Pool

They can be entire disks that ZFS formats as a single large slice

  • which devices will store your data
  • These devices must be disks of at least 128 MB in size
  • They must not be in use by other parts of the operating system
  • The devices can be individual slices on a preformatted disk
  • They can be entire disks that ZFS formats as a single large slice
Choose data replication.
  • ZFS supports nonredundant (striped) configurations, as well as mirroring and RAID-Z (a variation on RAID-5).
How to Create a ZFS Storage Pool

zpool create tank mirror c1t0d0 c2t0d0

To drop zpool 
zpool destroy tank

To List storage pool 

zpool list

NAME            SIZE    ALLOC   FREE    CAP  HEALTH     ALTROOT

tank             80G    137K     80G     0%  ONLINE     -

zpool status tank

Create the desired hierarchy.
zfs create tank/home

Set the inherited properties

# zfs set mountpoint=/export/zfs tank/home

# zfs set share=name=home,path=/export/zfs,prot=nfs tank/home name=home,path=/export/zfs,prot=nfs

# zfs set sharenfs=on tank/home

# zfs set compression=on tank/home

# zfs get compression tank/home

NAME             PROPERTY       VALUE                      SOURCE

tank/home        compression    on                         local


To create and Set desired hierarchy
zfs create -o mountpoint=/export/zfs -o sharenfs=on -o compression=on tank/home

To Create the individual file systems.
File systems could have been created and then the properties could have been changed at the home level. All properties can be changed dynamically while file systems are in use.

# zfs create tank/home/jeff
# zfs create tank/home/bill

Note: These file systems inherit their property values from their parent, so they are automatically mounted at /export/zfs/user and are NFS shared. You do not need to edit the /etc/vfstab or /etc/dfs/dfstab

Set the file system-specific properties.

zfs set quota=10G tank/home/jeff

View the results.
zfs list

NAME                   USED  AVAIL  REFER  MOUNTPOINT

tank                  92.0K  67.0G   9.5K  /tank

tank/home             24.0K  67.0G     8K  /export/zfs

tank/home/bill           8K  67.0G     8K  /export/zfs/bill

tank/home/jeff           8K  10.0G     8K  /export/zfs/jeff


To set quota 

zfs set quota=10G tank/home/jeff

To check quota
zfs list 
or
df -h

Creating a ZFS Storage Pool With Log Devices

zonecfg -z nombre_zona commit

zonecfg -z nombre_zona delete

zoneadm -z nombre_zona attach

zoneadm -z nombre_zona verify

zoneadm -z nombre_zona install

zoneadm -z nombre_zona clone

note: TambiƩn puede utilizar zonecfg para cambiar el nombre de una zona que tenga el estado de configurada o instalada.

(Incomplete)
zoneadm -z nombre_zona uninstall 

(Installed)

zoneadm -z nombre_zona Ready (opcional)

zoneadm -z nombre_zona  boot
zoneadm -z nombre_zona Uninstall 
note: desinstala la configuraciĆ³n de la zona especificada del sistema.
zoneadm -z nombre_zona move ruta
zoneadm -z nombre_zona detach
zonecfg -z nombre_zona se puede utilizar para agregar o eliminar una propiedad attrbootargscapped-memorydatasetcapped-cpudedicated-cpudevicefsip-typelimitprivnetrctl o scheduling-class. TambiĆ©n puede cambiar el nombre de una zona que tenga el estado de instalada.

(List)
zoneadm -z nombre_zona boot
zoneadm halt y el reinicio del sistema devuelven una zona con el estado de lista al estado de instalada.


zoneadm -z nombre_zona se puede utilizar para agregar o eliminar una propiedad attrbootargscapped-memorydatasetcapped-cpudedicated-cpudevicefsip-typelimitprivnetrctl o scheduling-class.
(Executing)


zlogin opciones zonename
zoneadm -z nombre_zona reboot
zoneadm -z nombre_zona halt devuelve a una zona lista el estado de instalada.
zoneadm halt y el reinicio del sistema devuelven una zona en ejecuciĆ³n al estado de instalada.
zoneadm -z shutdown cierra la zona sin que se produzcan errores.
zoneadm -z nombre_zon  se puede utilizar para agregar o eliminar una propiedad attrbootargscapped-memorydatasetcapped-cpudedicated-cpudevicefsip-typelimitprivanetnetrctl o scheduling-class. El recurso zonepath no se puede cambiar.
To create encryption FS
# zfs create -o encryption=on tank/ora_data
Enter passphrase for 'tank/ora_data': xxxxxxx
Enter again: xxxxxxxx

# zfs get encryption tank/ora_data

To create share zfs
zfs create vnxpool/share
zfs share vnxpool/share
zfs set sharen=on vnxpool/share

to check
zfs get share vnxpool/share

To start up zone
zoneadm -z epson_db boot






global#zoneadm -z epson_db reboot -- -m verbose

epson_db# reboot -- -m verbose







Find


To Find and list
find /u01/app/oracle/diag/rdbms/agap/agap/trace/agap*.trc -mtime +8 -exec ls -la {} \;

To find and remove 
find /u01/find /u01/app/oracle/diag/rdbms/agap/agap/trace/agap*.trc -mtime +8 -exec rm {} \;

To find, remove and print
find /u01/app/oracle/diag/rdbms/agap/agap/trace/agap*.trc -mtime +7 -exec rm {} \; -print

To find and ignore case
note: It is often useful to ignore the case when searching for file names. To ignore the case, just use the "iname" option instead of the "name" option.
find ./test -iname "*.Php"
./test/subdir/how.php

./test/cool.php

to find permise
find . -type f ! -perm 0777



Package Colors

create or replace package colors
is
  function color(p_text in varchar2, p_fg_color in varchar2 default 'm', p_bg_color in varchar2 default '40m') return varchar2;
  procedure colorize;
  function red(p_text in varchar2) return varchar2;
  function green(p_text in varchar2) return varchar2;
  function blue(p_text in varchar2) return varchar2;
  function yellow(p_text in varchar2) return varchar2;
  function cyan(p_text in varchar2) return varchar2;
  function pink(p_text in varchar2) return varchar2;
  
  function black_on_white(p_text in varchar2) return varchar2;
  function white_on_red(p_text in varchar2) return varchar2;
  function white_on_green(p_text in varchar2) return varchar2;
  function white_on_pink(p_text in varchar2) return varchar2;
  function bold_black_on_white(p_text in varchar2) return varchar2;
  function bold_white_on_red(p_text in varchar2) return varchar2;
  function bold_white_on_green(p_text in varchar2) return varchar2;
  function bold_white_on_pink(p_text in varchar2) return varchar2;  
  function bold_black_on_yellow(p_text in varchar2) return varchar2;
end;
/

create or replace package body colors
is  
  -- foreground colors
  COLOR_BLACK  CONSTANT VARCHAR2(5) := '30m';
  COLOR_RED    CONSTANT VARCHAR2(5) := '31m';
  COLOR_GREEN  CONSTANT VARCHAR2(5) := '32m';
  COLOR_YELLOW CONSTANT VARCHAR2(5) := '33m';
  COLOR_BLUE   CONSTANT VARCHAR2(5) := '34m';
  COLOR_PINK   CONSTANT VARCHAR2(5) := '35m';
  COLOR_CYAN   CONSTANT VARCHAR2(5) := '36m';
  COLOR_WHITE  CONSTANT VARCHAR2(5) := '37m';
  
  -- bold foreground colors
  BOLD_COLOR_BLACK  CONSTANT VARCHAR2(5) := '1;30m';
  BOLD_COLOR_RED    CONSTANT VARCHAR2(5) := '1;31m';
  BOLD_COLOR_GREEN  CONSTANT VARCHAR2(5) := '1;32m';
  BOLD_COLOR_YELLOW CONSTANT VARCHAR2(5) := '1;33m';
  BOLD_COLOR_BLUE   CONSTANT VARCHAR2(5) := '1;34m';
  BOLD_COLOR_PINK   CONSTANT VARCHAR2(5) := '1;35m';
  BOLD_COLOR_CYAN   CONSTANT VARCHAR2(5) := '1;36m';
  BOLD_COLOR_WHITE  CONSTANT VARCHAR2(5) := '1;37m';
  
  -- background colors
  BG_COLOR_BLACK  CONSTANT VARCHAR2(5) := '40m';
  BG_COLOR_RED    CONSTANT VARCHAR2(5) := '41m';
  BG_COLOR_GREEN  CONSTANT VARCHAR2(5) := '42m';
  BG_COLOR_YELLOW CONSTANT VARCHAR2(5) := '43m';
  BG_COLOR_BLU    CONSTANT VARCHAR2(5) := '44m';
  BG_COLOR_PINK   CONSTANT VARCHAR2(5) := '45m';
  BG_COLOR_CYAN   CONSTANT VARCHAR2(5) := '46m';
  BG_COLOR_WHITE  CONSTANT VARCHAR2(5) := '47m';
   
   
  function color(p_text in varchar2, p_fg_color in varchar2 default 'm', p_bg_color in varchar2 default '40m') return varchar2
  is
  begin
    return chr(27)||'['|| p_fg_color ||chr(27)||'['|| p_bg_color || p_text ||chr(27)||'[0m';
    -- chr(27)[ $FG chr(27) [ $BG  p_text  chr(27) [0m
    -- http://www.pixelbeat.org/docs/terminal_colours/
  end color;
  
  procedure colorize
  is
    vPrintSQL VARCHAR2(32767) := '';
    i pls_integer := 0;
  begin
    dbms_output.enable(100000);
    for fg in (select distinct column_value as fg_color 
                  from table(sys.odcivarchar2list ('m', '1m', '30m', '1;30m', '31m', '1;31m', '32m',
                                                  '1;32m', '33m', '1;33m', '34m', '1;34m', '35m', '1;35m',
                                                  '36m', '1;36m', '37m', '1;37m')) order by 1)
    loop
      for bg in (select distinct column_value as bg_color 
                  from table(sys.odcivarchar2list ('40m','41m','42m','43m','44m','45m','46m','47m')) order by 1)
      loop
        vPrintSQL := vPrintSQL || '['|| chr(27)||'['|| fg.fg_color ||chr(27)||'['|| bg.bg_color ||  LPAD(fg.fg_color ||' + '|| bg.bg_color , 11, '.')||chr(27)||'[0m]';
        
        if i = 7 then
          dbms_output.put_line(vPrintSQL);
          i := 0;
          vPrintSQL := ''; 
        else
          i := i + 1;
        end if;
        
      end loop;
    end loop;
  end;
  
  function red(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_RED);
  end red;
  
  function green(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_GREEN);
  end green;
  
  function blue(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_BLUE);
  end blue;
  
  function yellow(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_YELLOW);
  end yellow;
  
   function pink(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_PINK);
  end pink;
  
  function cyan(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_CYAN);
  end cyan;
  
    
  function black_on_white(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_BLACK, BG_COLOR_WHITE);
  end;
  
  function white_on_red(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_WHITE, BG_COLOR_RED);
  end;
  
  function white_on_green(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_WHITE, BG_COLOR_GREEN);
  end;
  
  function white_on_pink(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, COLOR_WHITE, BG_COLOR_PINK);
  end;
  
  function bold_black_on_white(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, BOLD_COLOR_BLACK, BG_COLOR_WHITE);
  end;
  
  function bold_white_on_red(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, BOLD_COLOR_WHITE, BG_COLOR_RED);
  end;
  
  function bold_white_on_green(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, BOLD_COLOR_WHITE, BG_COLOR_GREEN);
  end;
  
  function bold_white_on_pink(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, BOLD_COLOR_WHITE, BG_COLOR_PINK);
  end;
  
  function bold_black_on_yellow(p_text in varchar2) return varchar2
  is
  begin
    return color(p_text, BOLD_COLOR_BLACK, BG_COLOR_YELLOW);
  end;
  
end colors;
/

e.g. to use function
1# 
var agap varchar2(25);
begin
:agap:=colors.yellow('&text');
end;

/
print
or 
select :agap from dual;
2#
select colors.red('&text') from dual;
3#
set serveroutput on
declare
angel varchar2(25);
begin
angel:=colors.yellow('&text');
dbms_output.put_line(angel);
end;
/
note: example from 
http://oracle.ninja/color-your-sqlplus-scripts/

How to check  
MAXDATAFILES
MAXLOGHISTORY
MAXINSTANCES
MAXLOGFILES
MAXLOGMEMEBERS

-- MAXDATAFILES
Select 'MAXDATAFILES ' || records_total  from v$controlfile_record_section where type = 'DATAFILE';

-- MAXLOGHISTORY
Select 'MAXLOGHISTORY ' || records_total from v$controlfile_record_section where type = 'LOG HISTORY';

-- MAXINSTANCES
Select 'MAXINSTANCES ' || records_total from v$controlfile_record_section where type = 'DATABASE';

-- MAXLOGFILES
Select ' MAXLOGFILES ' || records_total from v$controlfile_record_section where type = 'REDO LOG';

-- MAXLOGMEMBERS

Select 'MAXLOGMEMBERS ' || dimlm from x$kccdi;

cellcli and dcli command in EXADATA

to check storage server in exadata
dcli -l root -g cell_group cellcli -e list cell

to monitored, configured, maintained by using cellcli command
$ cellcli
CellCLI: Release 11.2.2.2.2 - Production on Fri
May 06 08:46:22 EDT 2011
Cell Efficiency Ratio: 92M
CellCLI> help
HELP [topic]
Available Topics:

ALTER
ALTER ALERTHISTORY
ALTER CELL
ALTER CELLDISK
ALTER GRIDDISK
ALTER IORMPLAN
ALTER LUN
ALTER PHYSICALDISK
ALTER QUARANTINE
ALTER THRESHOLD
ASSIGN KEY
CALIBRATE
CREATE
CREATE CELL
CREATE CELLDISK
CREATE FLASHCACHE
CREATE GRIDDISK
CREATE KEY
CREATE QUARANTINE
CREATE THRESHOLD
DESCRIBE
DROP
DROP ALERTHISTORY
DROP CELL
DROP CELLDISK
DROP FLASHCACHE
DROP GRIDDISK
DROP QUARANTINE
DROP THRESHOLD
EXPORT CELLDISK
IMPORT CELLDISK
LIST
LIST ACTIVEREQUEST
LIST ALERTDEFINITION
LIST ALERTHISTORY
LIST CELL
LIST CELLDISK
LIST FLASHCACHE
LIST FLASHCACHECONTENT
LIST GRIDDISK
LIST IORMPLAN
LIST KEY
LIST LUN
LIST METRICCURRENT
LIST METRICDEFINITION
LIST METRICHISTORY
LIST PHYSICALDISK
LIST QUARANTINE
LIST THRESHOLD
SET
SPOOL

START

To obtain a cross-cell view of cell server configuration, metrics, alerts, and other information
dcli 
this basically removed authorized_keys entries from the celladmin's ~/.ssh directory on each cell server
[oracle@cm01dbm01 ~]$ dcli -g cell_group
--unkey
cm01cel01: ssh key dropped
cm01cel02: ssh key dropped
cm01cel03: ssh key dropped
[oracle@cm01dbm01 ~]$
Now, we'll re-establish SSH equivalency
[oracle@cm01dbm01 ~]$ dcli -g cell_group -k
celladmin@cm01cel02's password:
celladmin@cm01cel03's password:
celladmin@cm01cel01's password:
cm01cel01: ssh key added
cm01cel02: ssh key added
cm01cel03: ssh key added

[oracle@cm01dbm01 ~]$

to list cell 
dcli -g cell_group cellcli -e list cell
cm01cel01: cm01cel01 online
cm01cel02: cm01cel02 online

cm01cel03: cm01cel03 online

to check cell group
cat cell_group
cm01cel01
cm01cel02

cm01cel03

To check the amount of FlashCache used in each cel
$ dcli -g cell_group cellcli -e list \
metriccurrent where name=' FC_BY_USED'
cm01cel01: FC_BY_USED FLASHCACHE 13,316 MB
cm01cel02: FC_BY_USED FLASHCACHE 13,344 MB

cm01cel03: FC_BY_USED FLASHCACHE 13,301 MB

f you were only interested in cell servers cm01cel02 and cm01cel03, use the "-c" option as below:
 [oracle@cm01dbm01 ~]$ dcli -c
cm01cel02,cm01cel03 cellcli -e list metriccurrent where name='
FC_BY_USED'
cm01cel02: FC_BY_USED FLASHCACHE 13,344 MB
cm01cel03: FC_BY_USED FLASHCACHE 13,301 MB
[oracle@cm01dbm01 ~]$