My oracle user bash_profile

Use it…abuse it…don’t lose it…

[sourcecode language=”bash”]
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:/sbin:$HOME/bin

export PATH
#ORACLE_SID=grid;export ORACLE_SID
ORACLE_BASE=/u01/app ; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1/;export ORACLE_HOME
GRID_HOME=/u01/app/oracle/grid; export GRID_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
PATH=$PATH:$ORACLE_HOME/bin; export PATH

# Oracle GRID_HOME added June 12, 2012
function grid() {
export ORACLE_HOME=/u01/app/oracle/grid
export ORACLE_SID=+ASM
export ORACLE_DB=+ASM
export PATH=$PATH:$ORACLE_HOME/bin:/sbin
echo $ORACLE_HOME
echo $ORACLE_SID
}

# Oracle ORACLE_HOME added June 12, 2012
function database() {
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_BASE=/u01/app
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export ORACLE_DB=orcl
export CRS_HOME=/u01/app/oracle/grid
export PATH=$PATH:$ORACLE_HOME/bin:$CRS_HOME/bin
}

function sid() {
export ORACLE_SID=$1
export ORACLE_UNQNAME=$1
}

function sql() {
export ORACLE_SID=$1
$ORACLE_HOME/bin/sqlplus "sys/oracle@localhost:1521/${1} as sysdba"
}

function alert () {
export ORACLE_SID=$1
tail -f $ORACLE_BASE/diag/rdbms/$1/$1/trace/alert_$1.log
}

# Archives
# Extract about anything
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "’$1′ cannot be extracted via >extract<" ;;
esac
else
echo "’$1′ is not a valid file"
fi
}

encrypt_zip()
{

zip -ejr $1 $2

}

## Alias Section
alias ll=’ls -haltr’
alias ipconfig=’ifconfig’
alias ip=’ifconfig’
alias dir=’ls -alth’
alias rm=’rm -rvdf’
alias killit=’killall -v’
alias cls=’clear’
alias cl=’clear’
alias rmdir=’rm -rdvf’
alias kp=’ps auxwww’
alias hosts=’sudo vi /etc/hosts’

# History Settings
export HISTSIZE=10000
export HISTCONTROL=erasedups
export HISTCONTROL=ignoredups
shopt -s histappend

# Increase Shared Memory
sudo mount -o remount,size=8G /dev/shm

echo "#############################"
echo uptime
echo "#############################"
uptime

echo "#############################"
echo disk use
echo "#############################"
df -h /

echo "#############################"
echo who is on
echo "#############################"
w

echo "#############################"
echo Oracle
echo "#############################"
ps -ef | grep -v grep | grep pmon

export PATH LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME ORACLE_SID ORA_CRS_HOME GRID_HOME
PS1='[\u@\h][${ORACLE_SID}][\w]\$ ‘

vncserver :2

[/sourcecode]

One comment

Leave a Reply

Discover more from OraMatt: YABAOracle

Subscribe now to keep reading and get access to the full archive.

Continue reading