Nov 17, 2009

UNIX Commands for DBA's

This article contains a brief list of commands that most UNIX DBA's will need on a regular basis.


List the instances up and running on a host.
     $ps -ef|grep smon


check the number of instances running on a host
    $ps -ef|grep smon|wc -l


know the host name and host information
   $uname -r
   $hostname


List the top CPU using processes
   $top


List available listeners on a server
   $ps -ef|grep tns


check the disk space
   In kilobytes: $df -k
   In Gigabytes: $df -h


To know the disk usage of files/directories in the current working directory

   $du -sk *|sort -rn |head


check the usage of memory and swap
   On linux: $free -m
   On solaris: $top|grep -i mem


check the required RPM's are installed or not
   $rpm -qa|grep xxxx





Crontab
Automate the jobs using crontab


  Minute    0-59
  Hour            0-23
  Day of month    1-31
  Month    1 - 12
  Day of Week    0 - 6, with 0 = Sunday
  shell script name


   Example:


To edit a crontab file:
    $Crontab -e
To view a crontab file:
    $Crontab -l
      0  4 * * 5       /oracle/scripts/analyze.sh
      30 3  * * 3,6    /oracle/scripts/backup.sh /dev/null 2>&1



 "which" command can be used to find the location of an executable you are using:
   $which sqlplus


Kill a unix process
   $kill -9 1234


Remove old files
   find /oracle/admin/$ORACLE_SID/bdump -follow -name "*.trc" -mtime +5 -exec rm {} \;



No comments:

Post a Comment

Search This Blog