You are now on my old blog. Please update your bookmarks to my new blog

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

LSC01 0.0 12184 508448 10:09
LSC02 0.0 8420 303320 10:10

Well, it is based on the sqlplus version, which is not necessarly the same as database version, like does show, 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


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 Steve Perry 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'

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


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] agent .*/"$1"/.*,,p\042)"}
'\'' /etc/oratab |sh'

23/11/06 17:03  

Post a Comment

<< Home