Disclaimer

Friday 20 November 2020

OS Commands Part : 2

 

OS commands Part:2

 

How to send mail from Linux:
==============================

 

 
mail -s "Hello World" amit@gmail.com
 
give . (full stop) and enter
 
mailx -s smtp=smtp.samik-hots.com -s "TEST" amit@gmail.com

 

 

 

How to check alert log file contents?
*************************************
 

 

$] tail -600000 alert_ORCL.log| head -50000

 

--------------------------------------------------------------

 

 
 
 
$ du -sg *dmp* |awk '{ sum+=$1} END {print sum}'
 
SAMIK-NODE2 # bdf /home
 
SAMIK-NODE2 # find /home -xdev -type f -size +1000 -exec ls -lrt {} \;
 
 
rom -ivh --force --nodeps <rpm>
 
 
 
$ ps -eo pid,pcpu,args | sort +1n | tail -10
 
 
 
$ ps -eo pid,vsz,args | sort +1n | tail -10
 
 
------memory HP-Unix-------------
 
glance -m
 
 
 
----------CPU in HP - Unix-------------
 
/usr/contrib/bin/machinfo -v -m
 
 
=========================AIX========================================
 
 
 
If the server are in cluster and the secondary server is not having any
database then those binaries also we need to patch ,
you can check cluster details of server by below command
 
Cluseter name for both server
 
0) lscluster -i      -----------------to check the clustername
 
 
1) lssrc -g cluster
 
Subsystem         Group            PID          Status
 clstrmgrES       cluster          7799032      active
 clinfoES         cluster          19071164     active
 
 
2)  /usr/es/sbin/cluster/utilities/clRGinfo
 
------------------------------------------------------------------------------
Group Name                   Group State      Node
------------------------------------------------------------------------------
ORA01_RG                     ONLINE           SAMIK1
                             OFFLINE          SAMIK2
 
SAS01_RG                     ONLINE           SAMIK2
                             OFFLINE          SAMIK1
 
 
and
 
3) lspv |grep -i concurrent
 
 
AIX
*****
 
1. show processor multithreading capacibility, number of processor,
    and how many "core" they have. run smtctl below without any options with ROOT user.
 
$ smtctl
 
2. show processor model and their clockspeed
 
$ lsconf|grep Processor
 
3. show processor clock speed
 
$ pmcycles -m
 
4. show processor related to your lpar
$ lparstat -i
 
cllsfs
/usr/es/sbin/cluster/utilities/cllsfs
 
 
 
 
 
 
 
 
 
 
 
 
 
*******************************
RAM size in AIX
*******************************
 
Current RAM size:
 
$ svmon -G -O unit=GB
 
 
$ lsconf | grep Memory
Memory Size: 4096 MB
Good Memory Size: 4096 MB
+ mem0                                                                           Memory
$
 
 
 
$ lparstat -i | grep Memory               
Online Memory                              : 4096 MB
Maximum Memory                             : 16384 MB
Minimum Memory                             : 1024 MB
Memory Mode                                : Dedicated
Total I/O Memory Entitlement               : -
Variable Memory Capacity Weight            : -
Memory Pool ID                             : -
Physical Memory in the Pool                : -
Unallocated Variable Memory Capacity Weight: -
Unallocated I/O Memory entitlement         : -
Memory Group ID of LPAR                    : -
Desired Memory                             : 4096 MB
Target Memory Expansion Factor             : -
Target Memory Expansion Size               : -
$
 
 
********Memory issue*************
1- #vmstat -Itw
 
2- #svmon -G for the system #svmon -P for each process
 
 
You can use this command to get the highest 10 virtual memory processes on your system:
*********************************************************************************
 
#svmon -P |egrep " Y | N "| sort -rn +5| head
 
 

 

AIX Memory Usage - or - Who is using the memory and how?
*************************************************************
 
---> nmon then hit "m" will quickly show you a few big uses of memory as below:
 
UNIX Inter-process Communication (IPC) is another place which can soak up large amounts of memory.
Use the ipcs -m command to list the use
 
 
If you use nmon then "t" for top processes and then "4" to order in process size you see the process memory:
 
 
$] svmon -G -O unit=GB ------------>
 
 
 
IBM script for checking what is causing paging space activity:
******************************************************************
(it will run until po will be 50 then saves processes, svmon and exists)
 
#!/usr/bin/ksh
/usr/bin/renice -n -20 -p $$
while [ true ]
do
  vmstat -I 1 1 | tail -1 | awk '{print $9}' | read po
  if [[ $po -gt 50 ]]
  then
      ps -ef > ps.out &
      svmon -G > svmon.G &
      exit 0
  fi
done
 

 

Script for monitoring memory, paging activity:
**********************************************
 
#!/usr/bin/ksh
/usr/bin/renice -n -20 -p $$
 
while [ true ]; do
echo `date` "-->" `svmon -G | head -2 | tail -1` "-->" `vmstat -v | grep numperm` >> svmon.out &
echo `date` "-->" `svmon -G | head -3 | tail -1` >> paging.out &
echo `vmstat -Iwt 1 1 | tail -1` >> vmstat.out &
sleep 60
done
 
 
 
AIX version
=============
oslevel
 
 

 

============CPU in liux================
 
[oracle@samik ~]$ grep -c ^processor /proc/cpuinfo
16
 
 
$] lscpu
 
 
[oracle@samik ~]$ cat /etc/redhat-release   
 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
 
 
 
Q) how to find redhat release?
 
$ cat /etc/redhat-release

 

 
===========Free memory in linux=========
 
 
[oracle@samik ~]$ free -m
              total        used        free      shared  buff/cache   available
Mem:         128551       10619        1638       12129      116293      104986
Swap:        131071         210      130861
 
 
 
 
cat /proc/meminfo
 
 
free -t -m
 
 
cat /etc/redhat-release
 
 
[oracle@samik ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
 
 

 

============To remove file older than 2 days========================
 
 
$] find . -name "*.aud" -mtime +2 -exec rm {} \;
 
$] find . -name "*.aud" -mtime +7 -exec rm {} \;
 
 
$] find . -name "*.aud" |wc -l
 
$] find . -name "*.trc" -mtime +2 -exec rm {} \;
 
$] find . -name "*.trm" -mtime +2 -exec rm {} \;
 
 
 
 
find and print command
************************
 
 
$] find /oracle/data/oracle/admin/SAMIK62STP/adump -mtime +20 -name '*.aud' -exec ls -l {} \;
 

  

find and delete
*******************
 
$] find /oracle/data/oracle/admin/SAMIK62STP/adump -mtime +10 -name '*.aud' -exec rm -f {} \;
 
 

         find and print command

************************
 
 
$] find /applications/oracle/admin/OracleDB/adump -mtime +10 -name '*.aud' -exec ls -l {} \;
 
 
 
 
 
find and delete
*******************
 
$] find /applications/oracle/admin/OracleDB/adump -mtime +15 -name '*.aud' -exec rm -f {} \;
 
 
 
On Windows Oracle alert log file errors dumping=======================
 
findstr "ORA-" C:\alterlog\alert_vegarepo.log > C:\alterlog\error.txt
 
 
 
====Space check at OS level====
 
du -sk ./* | sort -rn | head -5
 
 
 
****linux os detail****
[oracle@samik]$ cat /etc/redhat-release
 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
 
 
 
 
 
 
 
 
 
 
 
 

No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...