Tuesday, June 28, 2011

Unix/Linux for DBAs

Most essential commands for DBAs:

#Find files
find . -print |grep -i listener.ora

#Kill similar processes
ps -ef | grep mon | grep -v grep | awk ‘{print $2}’ |xargs -i kill -9 {}

#Change owner of file, directory, sub-directory
chown user:group file(s) or folder

#Check particularly process count
ps -ef | grep runner | wc -l

#Display total file space in directory
du -ks
du -ks /home/oracle

#Change permission
chmod 777 runInstaller
--give read, write and execute to user/group/all

#Compress file
compress file <file name> - compress file
gzip <file name>    -    creates *.gz file
gunzip <file name>  -    decompresses *.gz file

#Replacing command - !!
[runner@runner ~]$ df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              2030736    421328   1504588  22% /
/dev/sda6               505604     17860    461640   4% /tmp

!!
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              2030736    421328   1504588  22% /
/dev/sda6               505604     17860    461640   4% /tmp


#Archive files
tar -cvf <new TAR-file name> <directory to be TARed>
or
tar cvf <new TAR-file name> <directory to be TARed>

--untar and gunzip together
tar -xzf log_files_2011-6-29.log.tar.gz

#Use alias
alias ll ='ls -l'
alias sql ='sqlplus '/ as sysdba'


alias alert='tail -100 \
           $DBA/$ORACLE_SID/bdump/alert_$ORACLE_SID.log|more'
   alias errors='tail -100 \
           $DBA/$ORACLE_SID/bdump/alert_$ORACLE_SID.log|more'
   alias arch='cd $DBA/$ORACLE_SID/arch'
   alias bdump='cd $DBA/$ORACLE_SID/bdump'
   alias cdump='cd $DBA/$ORACLE_SID/cdump'
   alias pfile='cd $DBA/$ORACLE_SID/pfile'
   alias rm='rm -i'
   alias sid='env|grep ORACLE_SID'
   alias admin='cd $DBA/admin'

Source: http://www.dba-oracle.com/t_linux_profile_alias_settings.htm

No comments:

Post a Comment

Cannot access dba_directories inside procedure

 Recently I faced one of familiar Oracle error ORA -00942 : table or view does not exist   I got it in while compiling procedure, becaus...