alias oraver 2.0

Thanks to an anonymous comment in my post yesterday, I can now provide a more flexible version of my alias, which do not require the database to be running nor the sysdba privilege


$ alias oraver
oraver=’echo ‘\”ORACLE_SID VERSION %CPU RSZ VSZ START_TIME’\”;awk -F: ‘\”/^[^ *#]/{print “printf 42%-9s %11s %5s %8s %8s %s\\n42″,$1,”$(ORACLE_HOME=”$2,$2″/bin/sqlplus -v 2>/dev/null|cut -d47 47 -f3) $(ps -eo pcpu,rsz,vsz,start_time,args|sed -n 42s/ [o]ra_pmon_”$1″.*//p42)”}’\” /etc/oratab |sh’
$ oraver

ORACLE_SID    VERSION  %CPU      RSZ      VSZ START_TIME
LSC01      10.2.0.2.0   0.0    12184   508448 10:09
LSC02       9.2.0.8.0   0.0     8420   303320 10:10
LSC03       9.2.0.8.0

Well, it is based on the sqlplus version, which is not necessarly the same as database version, like 8.1.7.3 does show 8.1.7.0, but in most of the recent versions, it should be ok

ps parameters may not work on all os, you can use -ef if you prefer

4 thoughts on “alias oraver 2.0

  1. Anonymous

    I’ll leave you another anonymous tip and have you check out $ORACLE_HOME/bin/sysresv
    I’m not sure how reliable it is across platforms and versions though. And it may only work under the oracle OS user account.

  2. Steve Perry

    tweaked it a bit so it displays ASM instances. I also changed it to show the proper process info for 2 similar SIDs (i.e RACDB and RACDB1). it used to list the process info twice, even though only one instance was running. I only tested it on linux.

    alias oraver=’echo ”’ORACLE_SID VERSION %CPU RSZ VSZ START_TIME”’;awk -F: ”’/^[^ *#]/{print “printf 42%-9s %11s %5s %8s %8s %s\n42″,$1,”$(ORACLE_HOME=”$2,$2″/bin/sqlplus -v 2>/dev/null|cut -d47 47 -f3)”,”$(ps -eo pcpu,rsz,vsz,start_time,args|sed -n 42s/ [o]ra_pmon_”$1″$//p;s/ [a]sm_pmon_”$1″$//p42)”}”’ /etc/oratab |sh’
    oraver

  3. Laurent Schneider

    I could not test this, but I added a test for the agents, in case the agent is listed in /etc/oratab like

    agent10g:/opt/oracle/product/agent10g:N

    alias oraver=’echo ”’ORACLE_SID VERSION %CPU VSZ START_TIME”’;
    echo ”’———- ———- —– ——– ———-”’;
    awk -F: ”’/^[^ *#]/&&!/^agent/{print “printf 42%-9s %11s %5s %8s %s %s %s %s\n42″,$1,”$(ORACLE_HOME=”$2,$2″/bin/sqlplus -v 2>/dev/null|cut -d47 47 -f3) $(ps -eo pcpu,vsz,start_time,args|sed -n 42s/ [o]ra_pmon_”$1″.*//p42)”}
    /^agent/{print “printf 42%-9s %11s %5s %8s %s %s %s %s\n42”,$1,”$(“$2″/bin/emctl getversion|awk 47{r=$NF}END{print r}47) $(ps -eo pcpu,vsz,start_time,args|sed -n 42s, /.*[e]mwd.pl agent .*/”$1″/.*,,p42)”}
    ”’ /etc/oratab |sh’

Comments are closed.