You are now on my old blog. Please update your bookmarks to my new blog
http://laurentschneider.com




02 November 2006

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 \042%-9s %11s %5s %8s %8s %s\\n\042",$1,"$(ORACLE_HOME="$2,$2"/bin/sqlplus -v 2>/dev/null|cut -d\047 \047 -f3) $(ps -eo pcpu,rsz,vsz,start_time,args|sed -n \042s/ [o]ra_pmon_"$1".*//p\042)"}'\'' /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 Comments:

Anonymous Anonymous said...

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/11/06 22:35  
Blogger Laurent Schneider said...

thanks :-) glad to receive anonymous comments like yours ! Seems to work fine on AIX,Linux,Solaris, however, I do not see the semaphore on AIX

3/11/06 15:03  
Anonymous Anonymous said...

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 \042%-9s %11s %5s %8s %8s %s\\n\042",$1,"$(ORACLE_HOME="$2,$2"/bin/sqlplus -v 2>/dev/null|cut -d\047 \047 -f3)","$(ps -eo pcpu,rsz,vsz,start_time,args|sed -n \042s/ [o]ra_pmon_"$1"$//p;s/ [a]sm_pmon_"$1"$//p\042)"}'\'' /etc/oratab |sh'
oraver

21/11/06 01:38  
Blogger Laurent Schneider said...

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 \042%-9s %11s %5s %8s %s %s %s %s\\n\042",$1,"$(ORACLE_HOME="$2,$2"/bin/sqlplus -v 2>/dev/null|cut -d\047 \047 -f3) $(ps -eo pcpu,vsz,start_time,args|sed -n \042s/ [o]ra_pmon_"$1".*//p\042)"}
/^agent/{print "printf \042%-9s %11s %5s %8s %s %s %s %s\\n\042",$1,"$("$2"/bin/emctl getversion|awk \047{r=$NF}END{print r}\047) $(ps -eo pcpu,vsz,start_time,args|sed -n \042s, /.*[e]mwd.pl agent .*/"$1"/.*,,p\042)"}
'\'' /etc/oratab |sh'

23/11/06 17:03  

Post a Comment

<< Home