Tuesday, November 1, 2016

Aliases for DBA shortcut

#alias ls='/bin/ls -a --color=tty'
#alias ll='/bin/ls -al --color=tty'
#alias lsr='/bin/ls -ar --color=tty'
#alias lst='/bin/ls -at --color=tty'
alias jeet='cd /home/a1001036-a/doom'
alias ls='/bin/ls -a'
alias ll='/bin/ls -al'
alias lsr='/bin/ls -ar'
alias lst='/bin/ls -at'
alias ulb='cd /usr/local/bin'
alias ob='cd $ORACLE_BASE'
alias olb='cd $ORACLE_BASE/local/bin'
alias ol='cd $ORACLE_BASE/local'
alias ole='cd $ORACLE_BASE/local/etc'
alias oln='cd $ORACLE_BASE/local/network'
alias oh='cd $ORACLE_HOME'
alias adm='cd $ORACLE_BASE/admin/$ORACLE_SID'
alias ada='cd $ORACLE_BASE/admin'
alias ads='cd $ORACLE_BASE/admin/scripts'
alias adsb='cd $ORACLE_BASE/admin/scripts/backup'
alias adsm='cd $ORACLE_BASE/admin/scripts/monitor'
alias adsp='cd $ORACLE_BASE/admin/scripts/perfmgt'
alias adq='cd $ORACLE_BASE/admin/sql'
alias adl='cd $ORACLE_BASE/admin/log'
alias adla='cd $ORACLE_BASE/admin/log/app_batch'
alias adlb='cd $ORACLE_BASE/admin/log/backup'
alias adle='cd $ORACLE_BASE/admin/log/envmgmt'
alias adlm='cd $ORACLE_BASE/admin/log/monitor'
alias adln='cd $ORACLE_BASE/admin/log/network'
alias adump='cd $ORACLE_BASE/admin/$ORACLE_SID/adump'
alias bdump='cd $ORACLE_BASE/admin/$ORACLE_SID/bdump'
alias cdump='cd $ORACLE_BASE/admin/$ORACLE_SID/cdump'
alias udump='cd $ORACLE_BASE/admin/$ORACLE_SID/udump'
alias pfile='cd $ORACLE_BASE/admin/$ORACLE_SID/pfile'
alias parch='cd $ORACLE_BASE/admin/$ORACLE_SID/arch'
alias dbs='cd $ORACLE_HOME/dbs'
alias pushdir='cd $ORACLE_BASE/admin/push'
alias polb='cd $ORACLE_BASE/admin/push/oracle/local/bin'
alias pole='cd $ORACLE_BASE/admin/push/oracle/local/etc'
alias poln='cd $ORACLE_BASE/admin/push/oracle/local/network'
alias pads='cd $ORACLE_BASE/admin/push/oracle/admin/scripts'
alias padq='cd $ORACLE_BASE/admin/push/oracle/admin/sql'
alias oralink='cd $ORACLE_BASE/admin/oralink/${ORACLE_SID%%??}'
alias alert='tail -1000f $ORACLE_BASE/admin/$ORACLE_SID/bdump/alert_${ORACLE_SID}.log'
alias vialert='vi $ORACLE_BASE/admin/$ORACLE_SID/bdump/alert_${ORACLE_SID}.log'
alias plog='tail -f /etc/cmcluster/${ORACLE_SID#o}/${ORACLE_SID#o}_ctl.sh.log'
alias sp='sqlplus "/ as sysdba"'
alias spa='sqlplus "/ as sysasm"'
alias netbk='cd /usr/openv/netbackup/logs/user_ops/dbext/logs'
alias psg='ps -ef | grep '
alias psxg='ps -exf | grep '
alias pgrep='ps -ef | grep '
alias inst='ps -ef | grep -e ora_smon -e asm_smon | grep -v grep | awk '"'"'{print $NF}'"'"' | awk -F_ '"'"'{print $3}'"'"' |sort -u'
alias patches='$ORACLE_HOME/OPatch/opatch lsinventory | grep ^Patch'
alias clust="(export ORACLE_SID=crs;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/cemutlo -n)"
alias asminst="export ORACLE_SID=`ps -ef | grep [a]sm_smon | awk -F _ '{print $NF}'`;ORAENV_ASK=NO;. oraenv;unset ORAENV_ASK"
alias opmnstat='printf "Running ";echo $ORACLE_HOME/opmn/bin/opmnctl status -fmt %cmp24%prt30%pid7R%sta8%uid10R%mem8R%utm9R%por|tee /dev/tty|bash'
alias opmncstat='printf "Running ";echo $ORACLE_HOME/opmn/bin/opmnctl @cluster status -fmt %cmp24%prt30%pid7R%sta8%uid10R%mem8R%utm9R%por|tee /dev/tty|bash'
alias opmnstartall='printf "Running ";echo $ORACLE_HOME/opmn/bin/opmnctl startall|tee /dev/tty|bash'
alias opmnstopall='printf "Running ";echo $ORACLE_HOME/opmn/bin/opmnctl stopall|tee /dev/tty|bash'
alias agstat="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl status agent)"
alias agstatsec="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl status agent -secure)"
alias agvkey="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl verifykey)"
alias agtz="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl config agent getTZ)"
alias agver="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl getversion)"
alias aghome="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl getemhome)"
alias agupl="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl upload agent)"
alias agstart="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl start agent)"
alias agstop="(export ORACLE_SID=agent10g;export ORAENV_ASK=NO;. oraenv;\$ORACLE_HOME/bin/emctl stop agent)"

function pinst { export PDB=`echo $PDB | sed "s/.$/$1/"`; echo "PDB is now $PDB";}
function penv {
        export ORAENV_ASK=NO;
        inst | grep $1 && export ORACLE_SID=$1 || export ORACLE_SID=NONE
        . oraenv;
        unset ORAENV_ASK;
        if [ ${1: -1} == "1" ] ; then
                . setpenv $1 system;
        else
                inst=${1: -1}
                newinst=${1%$inst}1
                . setpenv $newinst system > /dev/null;
                pinst $inst > /dev/null
                echo "Perl DB scripts will connect to system@$PDB"
        fi
}
function getpwn { getpw "$@";echo; }
alias oramaint='sudo /opt/oracle/local/bin/oramaint'
alias lsdisk='sudo /usr/local/bin/lsdisk'
alias setx="export XAUTHORITY=/home/`/usr/bin/who -m | /usr/bin/awk '{print $1}'`/.Xauthority"
alias svs='lsnrctl services `ps -ef | grep [S]CAN | awk '\''{print $(NF-1)}'\'' | head -1` | grep ^Service | awk '\''{print $2}'\'' | sort -u | tr -d '\''"'\'''
alias sd='cd /u01/app/oracle/admin/scripts'

No comments:

Post a Comment