Home » Infrastructure » Unix » extproc and multiple database instances (Oracle 10g *nix)
extproc and multiple database instances [message #277589] Tue, 30 October 2007 13:01 Go to next message
kregan77
Messages: 21
Registered: January 2007
Junior Member
Hello, we have multiple instances (SIDS) installed on one machine - each of which needs to use extproc to make calls to some shared libraries in the file system.

Could someone point me to some documentation or explain to me how libraries are resolved by the extproc process?

For example say I have two database instances SID1 and SID2 installed on one machine. Both instances need to reference an external library - libA.so for example - but in different directories.

SID1 - all libraries:
/pathSID1/libA.so

SID2 - all libraries
/pathSID2/libA.so


Also assume that libA.so links in another library:

ldd libA.so: libB.so (which also resides in the instance specific directories e.g. pathSID1/libB.so, pathSID2/libB.so).

How does extproc resolve the location of the dependent library libB.so - typically the operating system will use LD_LIBRARY_PATH to find libraries - in the case of extrproc this is a problem since we only have one oracle user so he can only have one LD_LIBRARY_PATH.

We need to make sure that SID1->libA.so will link in the proper dependent library /pathSID1/libB.so and not the other one /pathSID2/libB.so.... and vice versa.

On one of our databases I am finding that the oracle environment is not setup for it to work normally - i.e.:

ldd /pathSID1/libA.so:
libB.so => <file not found>

because the LD_LIBRARY_PATH does not contain /pathSID1 - however, when extproc calls libA.so it works fine - how is extproc resolving this??

Hoepfully this makes some sense - if unclear let me know what i can do to clarify. Any information would be greatly appreciated.


THanks a lot,
Kevin
Re: extproc and multiple database instances [message #277604 is a reply to message #277589] Tue, 30 October 2007 14:32 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
I haven't done this for a long time and your best bet would be to check on metalink.oracle.com, but... try this:
1.) I believe LD_LIBRARY_PATH needs to include that path in the environment when you start the listener.
2.) You can see your listener environment (on Solaris) using something like:
/usr/ucb/ps -auxeww | grep tnslsnr | grep LD_LIBRARY_PATH 
Re: extproc and multiple database instances [message #277770 is a reply to message #277604] Wed, 31 October 2007 08:01 Go to previous messageGo to next message
kregan77
Messages: 21
Registered: January 2007
Junior Member
So I found out why it was working despite my LD_LIBRARY_PATH not being set (extproc was calling libA.so which required libB.so but my LD_LIBRARY_PATH was not configured with a path to libB.so but it was still finding it) - the library was compiled with a "-R $ORIGIN/../../lib" which I guess sort of builds an ld-libpath right into the executable. Our new build system does not use this flag though which is why I am running into a problem.

I found that using ENV= part of the extproc listener definition is one way to set the LD_LIBRARY_PATH properly:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
(ENVS=EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=/pathSID1)
)

This allows extproc to find the required libraries...

However, the question still remains - how can I have two separate extproc processes - one for each individual database instance so that I can configure the LD_LIBRARY_PATH independently... sort of like:

SID_LIST_LISTENER_1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
(ENVS=EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=/pathSID1)
)

SID_LIST_LISTENER_2 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
(ENVS=EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=/pathSID2)
)

Re: extproc and multiple database instances [message #424169 is a reply to message #277770] Wed, 30 September 2009 07:09 Go to previous messageGo to next message
real
Messages: 2
Registered: September 2009
Junior Member
Dear kregan77!

Did You manage to solve problem of running two separate extproc processes, each serving it's own shared lib? I'd like to create similar setup and would be interested in any suggestions how to achieve this.

Best regards,
real
Re: extproc and multiple database instances [message #424197 is a reply to message #424169] Wed, 30 September 2009 09:33 Go to previous messageGo to next message
kregan77
Messages: 21
Registered: January 2007
Junior Member
real wrote on Wed, 30 September 2009 07:09
Dear kregan77!

Did You manage to solve problem of running two separate extproc processes, each serving it's own shared lib? I'd like to create similar setup and would be interested in any suggestions how to achieve this.

Best regards,
real


Hi real, yes, we did solve this problem... this is a copy/paste from our instructions on setting this up:


The following steps should be performed to configure the Oracle environment for instance specific EXTPROC shared dynamic link libraries:
1) edit the $ORACLE_HOME/network/admin/tnsnames.ora file
add instance specific EXTPROC descriptor for each instance:
EXTPROC_CONNECTION_DATA_<ORACLE_SID> =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = extproc))
)
(CONNECT_DATA =
(SID = PLSextproc_<ORACLE_SID>)
(PRESENTATION = RO)
)
)
2) edit the $ORACLE_HOME/network/admin/listener.ora file
add instance specific EXTPROC service for each instance:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSextproc)
(ORACLE_HOME = <ORACLE_HOME>)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ANY")
)
(SID_DESC =
(SID_NAME = PLSextproc_<ORACLE_SID>)
(ORACLE_HOME = <ORACLE_HOME>)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=
<this instances library path>:<ORACLE_HOME>/lib")
)
)
3) stop and start the listener
lsnrctl stop
lsnrctl start
4) logon to each Oracle instance and
a) create a public database link
CREATE PUBLIC DATABASE LINK agent_link
USING 'extproc_connection_data_<ORACLE_SID>';
b) recreate each of the external libraries using the AGENT option:
CREATE OR REPLACE LIBRARY library_name AS
'library_path' AGENT 'agent_link';



One thing to note - the things you are putting in listener.ora and tnsnames.ora are very case-sensitive - if your case differs between the two files it won't work (speaking from experience of our service team members getting this wrong quite often).

Hope this helps!
kregan
Re: extproc and multiple database instances [message #424207 is a reply to message #424197] Wed, 30 September 2009 13:34 Go to previous messageGo to next message
kregan77
Messages: 21
Registered: January 2007
Junior Member
One small thing about the above instructions is that you don't really need the default PLSExtproc entry in the listener - only the instance specific ones e.g. PLSExtproc_SID1, PLSExtproc_SID2
Re: extproc and multiple database instances [message #424263 is a reply to message #424207] Thu, 01 October 2009 03:39 Go to previous messageGo to next message
real
Messages: 2
Registered: September 2009
Junior Member

Great thanks!

The trick I was missing was creating DB LINK and assigning LIBRARY to it Smile "How absurdly simple!" as good doctor Watson used to say in such moments Smile

Best regards Smile
real
Re: extproc and multiple database instances [message #465813 is a reply to message #424263] Thu, 15 July 2010 11:41 Go to previous messageGo to next message
chalkie
Messages: 3
Registered: July 2010
Location: Lincolnshire
Junior Member
Great info, thanks. I'm using this same mechanism to run a standard listener including the default EXTPROC_CONNECTION_DATA,
and a separate listener running a second EXTPROC_CONNECTION_DATA_CHALKIE,
where the 2nd listener is running under a different user profile to the main listener.

Actually I'm doing this in windows not Unix, but I'll bet its just the same from that point-of-view.

Best regards,
Chalkie

p.s. It doesn't NEED to be EXTPROC_CONNECTION_DATA_<sid>. My 2 listeners are being called from the same DB sid, so I just made a name up.

[Updated on: Thu, 15 July 2010 11:43]

Report message to a moderator

Re: extproc and multiple database instances [message #465873 is a reply to message #465813] Thu, 15 July 2010 20:39 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>and a separate listener running a second EXTPROC_CONNECTION_DATA_CHALKIE,
Why?

>where the 2nd listener is running under a different user profile to the main listener.
What does this mean "under a different user profile to the main listener"?

It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/
Re: extproc and multiple database instances [message #465972 is a reply to message #465873] Fri, 16 July 2010 03:19 Go to previous messageGo to next message
chalkie
Messages: 3
Registered: July 2010
Location: Lincolnshire
Junior Member
Sorry-I wasn't clear enough..

I mean that the second listener is started with different credentials to the first. The first listener has the logon credentials of "OraListener" (an account I have created) which is quite restricted, and the second listener runs as my account (for debugging something I'm working on) but obvisously I then don't grant execute on the library to anyone except myself (and only sys has create library priv). The environment in which the extproc process runs is inherited from its parent (the listener), and any subsequent processes under extproc also inherit the environment in turn. For example if I have the extproc create a shell, and then execute "set" (without the quotes), then through the first listener connection I get one set of environment variables, and through the second listener connection I would get a different set of environment variables, both appropriate to the user profile under which the listener was started.

p.s. My apologies for contravening a posting rule. Please could you clarify where I went wrong. I followed you link and I found myself no wiser, except for having put line-feeds after sentences. I've fixed that here.

[Updated on: Fri, 16 July 2010 03:25]

Report message to a moderator

Re: extproc and multiple database instances [message #466045 is a reply to message #465972] Fri, 16 July 2010 10:18 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
I don't know what you have.
I don't know what you do.
I don't know what you see.
It is really, really, REALLY difficult to fix a problem that can not be seen.
use COPY & PASTE so we can see what you do & how Oracle responds.

You should consider following words of wisdom.
First make it work, then make it fancy.
First make it work, then make only 1 change at a time.
Re: extproc and multiple database instances [message #466093 is a reply to message #466045] Fri, 16 July 2010 16:49 Go to previous messageGo to next message
kregan77
Messages: 21
Registered: January 2007
Junior Member
I don't think he has a problem.. he's just telling us about how he is using extproc.
Re: extproc and multiple database instances [message #466196 is a reply to message #466045] Sat, 17 July 2010 18:28 Go to previous message
chalkie
Messages: 3
Registered: July 2010
Location: Lincolnshire
Junior Member
BlackSwan - I've been a DBA on Oracle for many a year Smile

I don't have a problem (1),
I've been a developer and DBA on Oracle for many a long year,
I see an extproc, looking at me.

kregan77 hit it on the head with the observation that I am just telling you about how I'm using extproc. I didn't think that there was any point in detailing my listener.ora etc when kregan77's post of 31st October 2007 described it so elegantly. I only bothered to mention it because it differs slightly in its purpose from that one, but the execution is essentially the same. It works fine for me. it isn't broken, and I'm not seeking assistance in fixing it.

I hope that's cleared up now.

(1) I have many problems, but let's stick to the subject in hand for now.

All the best,
Chalkie.
Previous Topic: PL/SQL using Unix
Next Topic: FTP Script
Goto Forum:
  


Current Time: Sun Nov 03 07:29:04 CST 2024