RE: How do I extract "vsnnum" from oracle binaries or libraries (was Version of Oracle Database without connecting to the database.)

  • From: "Fowler, Kenneth R" <Kenneth.R.Fowler@xxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 12 Nov 2008 17:45:40 -0500

So the reason I did not want to rely on a database connection is because
I want it to work on client installs also.  In the end I determined the
version by executing "strings" against $ORACLE_HOME/lib/libnls*.a and
$ORACLE_HOME/lib/libpls*.a.  In cases where the two gave differing
results I use the greater of the two (latest version).  I found that it
gave accurate results for 8, 8i, 9i and 10g.  Here are the commands I
used...


NLS_VER=`strings $LINE/lib/libnls*.a 2> /dev/null | grep 'NLSRTL
V[EeRrSsIiOoNn ]*[0-9.]* - ' |\
    sed -e s'!^.*NLSRTL V[EeRrSsIiOoNn ]*\([0-9.]*\) - .*$!\1!'g`
PLS_VER=`strings $LINE/lib/libpls*.a 2> /dev/null | grep 'PL/SQL
V[EeRrSsIiOoNn ]*[0-9.]* - ' |\
    sed -e s'!^.*PL/SQL V[EeRrSsIiOoNn ]*\([0-9.]*\) - .*$!\1!'g`
ORA_BIT=`/usr/ccs/bin/dump -fv $LINE/lib/libclntsh.so 2> /dev/null |
grep '^[0-9]*-[Bb][Ii][Tt]' |\
    sed -e s'!^\([0-9]*\)-[Bb][Ii][Tt].*$!\1Bit!'g`
ORA_VER=`printf "%s\n%s\n" ${NLS_VER:-0} ${PLS_VER:-0} | grep -v '^0$' |
sort | tail -1`


The above were inside a loop using oratab ($LINE is really each unique
$ORACLE_HOME).  Lastly, the reason why I did not use sqlplus -V (or
sqlplus -? For earlier versions) is because it does not give complete
results including the patch level for 8 and 8i.


The above type of info may seem quite basic (why not just log in and
take a look you might be asking yourselves) but since our group has to
manage about 2000 databases on 370 servers it makes sense to keep all of
this inventory type information in a single repository.


Thanks,
Ken.
 

Database Services - Infrastructure, Platform and Systems Engineering
Worldwide Technology Engineering
Phone (Work): (860) 686-1749
Phone (Cell): (860) 389-3534

-----Original Message-----
From: Niall Litchfield [mailto:niall.litchfield@xxxxxxxxx] 
Sent: Tuesday, November 11, 2008 11:10 AM
To: dennis@xxxxxxxxxx; Fowler, Kenneth R; oracle-l@xxxxxxxxxxxxx
Subject: Re: How do I extract "vsnnum" from oracle binaries or libraries
(was Version of Oracle Database without connecting to the database.)

Is it only me who thinks that, given you've had to connect as oracle
and execute oraenv todo all this a database connection is simpler?

On 11/11/08, Dennis Yurichev <dennis@xxxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Fowler, Kenneth R wrote:
>> This thread was of great interest to me as I am currently working on
a
>> project to gather server and database metadata for servers and
databases
>> in our farm.  One part of the project requires the ability to
>> automatically gather data on oracle installations so I was trying to
>> figure out how to get hold of the "vsnnum" value from oracle binaries
or
>> libraries.
>>
>> I can find evidence of "vsnnum" using elfdump (Solaris 10)...
>>
>>
>> amrndhs014-ora9i $ uname -a
>> SunOS amrndhs014 5.10 Generic_118833-36 sun4u sparc
SUNW,Sun-Fire-V490
>> amrndhs014-ora9i $ pwd
>> /app/oracle/product/9.2.0.8_64
>> amrndhs014-ora9i $ /usr/ccs/bin/elfdump bin/oracle | grep vsnnum
>>    [44804]  0x000102f87748 0x000000000004  OBJT GLOB  D    0 .rodata
>> vsnnum
>>   [136007]  0x000102f87748 0x000000000004  OBJT GLOB  D    0 .rodata
>> vsnnum
>>             [44804]     vsnnum
>> amrndhs014-ora9i $ /usr/ccs/bin/elfdump lib/libcommon9.a | grep
vsnnum
>>      [674]  0x00155e84  (vsndef.o):vsnnum
>>       [18]  0x000000000000 0x000000000004  OBJT GLOB  D    0 .rodata
>> vsnnum
>>
>>
>> But I am having no luck extracting the correct (expected) value.
Anyone
>> have any experience with this sort of thing?
>
> Try this:
>
> $ uname -a
> Linux ... 2.6.9-34.EL #1 Fri Feb 24 16:44:51 EST 2006 i686 i686 i386
> GNU/Linux
>
> $ ar -x $ORACLE_HOME/lib/libcommon10.a vsndef.o
>
> $ objdump -D vsndef.o | grep -A 2 '<vsnnum>'
> 00000020 <vsnnum>:
>   20:   00 04 20                add    %al,(%eax)
>   23:   0a 00                   or     (%eax),%al
>
> Take first four bytes and reverse.
> You'll get: 0x0A, 0x20, 0x04, 0x00.
> Now version number is more or less obvious.
> This was from 10.2.0.4 Linux ...
> For 11.1.0.7.0 Linux it will be: 0x0B, 0x10, 0x07, 0x00
>
>
> - --
> My PGP public key: http://yurichev.com/dennis.yurichev.asc
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkkZqTAACgkQ1YPmFmJG++OtXwCeMjonGRQff+vGmhfAdI9G4GL5
> 3jEAn0wGLIhwEAX8HvSLavQl5sBGbpJr
> =Vy1v
> -----END PGP SIGNATURE-----
> --
> //www.freelists.org/webpage/oracle-l
>
>
>

-- 
Sent from Google Mail for mobile | mobile.google.com

Niall Litchfield
Oracle DBA
http://www.orawin.info
--
//www.freelists.org/webpage/oracle-l


Other related posts: