首页 » ORACLE 9i-23ai » Sessions remains and increase cumulatively never close if you use DEDICATED with XA transaction + shared dblink.

Sessions remains and increase cumulatively never close if you use DEDICATED with XA transaction + shared dblink.

A web application using Tuxedo always keep 50 long connection to local database which then issues a SELECT from local db to remote db over shared db link(it’s created last weekend), Shared database links are there since Oracle 9iR2. But to run for a period of time after the found the remote db sessions become full(ora-18), look like the connections opened  at remote database are never closed , the db link session open forever, and the session STAUS value is ‘INACTIVE’,  the database version both are 11.2.0.3, I trying to create session(using TOAD client) to local DB  issues a select via shared db link, then the remote db opend session count is two, one is PSEUDO other is DEDICATED, but when I close the session of local db , The related two sessions will be released on remote db.

What’s shared database link?

First, shared database links aim is to reduce number of connection to remote database by sharing same connection link between source and remote by multiple users’ sessions. This can also be seen as a JDBC connections pooling to concentrate multiple session and limit number of real connections onto the database (to obviously save CPU and memory).

Example of creation:
 SQL> CREATE SHARED  [PUBLIC] DATABASE LINK XXX....;

Why use Tuxedo the session never closed?

AP(Tuxedo) -(DEDICATED)-> DB1(DEDICATED) –shared dblink(DEDICATED)-> DB2(DEDICATED)

the Tuxedo app had XA application, and  we had used Dedicated server mode, the db parameter shared_servers value is 0 ,  Use dblink in an XA application, there is no requirement must be Shared dblink, but there are requirements must use a Shared server, otherwise the XA transaction will cause error ORA-24777 or ora-24778, the ORACLE doc records

Oracle XA applications can access other Oracle Database instances through database links with the following restrictions:
They must use the shared server configuration. ”

I found a Bug 18394488 in 11.2.0.4,Does not conform to this case. For non-shared database links, which must use dispatcher for XA connections,PMON can close the link by getting the dispatcher to do it. However, for shared db links, the dispatcher is not used, and PMON has no real network connection to use to end the remote process and session. Anyway this is not a standard environment.

Temporary solution:
1,Program code to close the dblink after an XA transaction manually

alter session close database linkname;

or

2. Configure the database to allow the use of shared servers and then let the
application use these as per the following documentation
http://docs.oracle.com/cd/E11882_01/server.112/e25494/manproc003.htm#ADMIN0050

OR

3. TO modify applications use short connection way to connect  LOCAL DB(used-the-close)

 

A bug ORA-00600 [ddfnetCFull-4], [Invalid Handle] when using shared dblink oracle 11.2.0.3

打赏

,

对不起,这篇文章暂时关闭评论。