1
votes

Have one system monitoring two Oracle Databases with different versions

12.1 and 10.1

Oracle client, sdk, sqlplus installed for each and I can query either 12.1 db or 10.1 by setting theses after setting appropriate values for

export LD_LIBRARY_PATH=
export PATH=
export ORACLE_BASE=
export ORACLE_HOME=
export TNS_ADMIN=`

But Perl does not seem to pick up the the different versions. I get:

CRITICAL - cannot connect to 10.16.183.98:1521/CV. ORA-03134: Connections to this server version are no longer supported. (DBD ERROR: OCISessionBegin)

Indicating it is using only the 12.1 to try and connect to 10.1. What's the best method to be able to query two different Oracle Database Versions from Perl?

2

2 Answers

1
votes

As you are trying to control this via Environment Variables, I will assume that you don't need to talk to both databases within the same program.

If I recall correctly, DBD::Oracle needs to be built against the specific Oracle client you intend to use it with. As such, you may wish compile up two different versions of the library into separate directories and use lib to point to the specific one you wish to use.

0
votes

Why don't you install Oracle client 11g? It should work with both versions.

On Linux the executable format .ELF supports library search path to by comiled in into the binary(look at -rpath linker parameter). This might have precedence before LD_LIBRARY_PATH. Go to site_perl directory and search for Oracle.so library. Then execute ldd on it (without having LD_LIBRARY_PATH set).

I also think that if this rpath parameter was removed from compilation then you could switch OCI libs(liblntsh.so) using LD_LIBRARY_PATH. OCI lib ABI is strictly backward compatible and only few fuction were added into the new version.

PS: tjd's solution with use lib is much cleaner.