Thursday, 28 April 2011

UNIX Commands For ORACLE

list commands:

ls –ltr
cat alert_LIN1.log | grep -i ORA-
cat /proc/cpuinfo


process commands:


ps –ef |grep “ora_”
ps –ef |grep “ora_”|grep –v grep|grep $ORACLE_SID
ps -ef |awk '{print $1}'|sort -u



change dir :


cd ..


view command:


vi
view
more

Find the CPU count :

grep -c processor /proc/cpuinfo
uname –X
/usr/sbin/psrinfo |wc –l
/usr/sbin/psrinfo -p


Memory chechecking
dmesg | grep Memory
cat /proc/meminfo


AIX $ /usr/sbin/lsattr -E -l sys0 -a realmem
Linux $ /usr/sbin/dmesg | grep "Physical:"
HP $ grep MemTotal /proc/meminfo
Solaris $ /usr/sbin/prtconf | grep "Memory size"
Tru64 $ /bin/vmstat -P | grep "Total Physical Memory"
Display RAM Memory size on Solaris
prtconf |grep -i mem

:

Display RAM memory size on AIX
First determine name of memory device
lsdev -C |grep mem
then assuming the name of the memory device is ‘mem0’
lsattr -El mem0


Display the number of CPU’s in Solaris
psrinfo -v | grep “Status of processor”|wc –l

Display the number of CPU’s in AIX
lsdev –C | grep Process|wc –l





cpu performance:


TOP
TOPAS
SAR
$ sar -u 10 8
Reports CPU Utilization (10 seconds apart; 8 times):
Time
%usr
%sys
%wio
%idle
11:57:31
72
28
0
0
11:57:41
70
30
0
0
11:57:51
70
30
0
0
11:58:01
68
32
0
0
11:58:11
67
33
0
0
11:58:21
65
28
0
7
11:58:31
73
27
0
0
11:58:41
69
31
0
0
Average
69
30
0
1




%usr: Percent of CPU in user mode
%sys: Percent of CPU in system mode
%wio: Percent of CPU running idle with a process waiting for block I/O
%idle: Percent of CPU that is idle

SAR  -u  <CPU report >
Sar –d <disk usage >



to create the file :


touch
cat


disk free:

df -k


disk usage:

du -sg


remove the file

rm -rf

remove dir:

rmdir
rm -rf


copy or move


cp <source to dist>

move <sorce to dest>

cp -r <inclusing sub dir>



last and first lines:

tail -n filename
head -n filename


echo <variable>
chmode -R 777 <filename>
chown oracle:dba <dir name>
chgrp filename

FIND and REMOVE :



find /oracle/sftw -name <filename>
find /backup/logs/ -name daily_backup* -mtime +21 -exec rm -f {} ;

FTP commands:
ftp servername
ftp>binary

get
put
cd
!pwd
pwd
bye
ls


Mail commands:

mail -s "Test mail"  "sss@gmail.com" < msg.log


who
kill -9 <process id>
hostname
uname -a
telnet <hostname>
ifconfig
jobs


sysreserve



User management :

useradd -G oinstall -g dba -d /usr/users/my_user -m -s /bin/ksh my_user

  • The "-G" flag specifies the primary group.
  • The "-g" flag specifies the secondary group.
  • The "-d" flag specifies the default directory.
  • The "-m" flag creates the default directory.
  • The "-s" flag specifies the default shell.


usermod -s /bin/csh my_user

userdel -r my_user

passwd my_user

wc –l ===è gives the count                         


COMPRESS the files :


Gzip <filename >
Zip <filename>
Compress <filename>

Gunzip < filename >
Unzip <filename>
Uncompress < filename >


SYSTEM statistics :

VMSTAT


DISPLAY < hostname > :<port no >
Export DISPLAY


Tar –cvf <filename>.tar <file/dir loc>
Tar –xvf <filrname>.tar

History
Date
Time
Whoiam
Diff
At
Crontab
Uptime --- server uptime

No comments:

Post a Comment