oracle dblink造成远程数据库session过多
现场报网公司数据库连不上,先检查了下数据库processes=1500,session=2200.我认为非常大啊。这个数据库没有几个人用。
查看v$session中的session最多是哪个machine发起的。发现是省公司的数据库发起的session,找开发梳理了下业务,省公司同步dblink操作网公司表,且是通过weblogic的连接池。
哦,有点明确了,是dblink引起的。weblogic连接池是一直存在的,所以在网公司端session是不释放的。假设省公司把应用都停掉,那在网公司端的session都会释放。要验证想法。做个试验:
目标:数据库A上建dblink,改动数据库B上的表。
环境准备:
1.在数据库A上建dblink
create public database link TO_B
connect to TEST_DB identified by TEST_DB
using '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.15.150)(PORT = 1521)))(CONNECT_DATA =(SID = orcl)))';
2.在数据库B上建表
create table TEST( ID NUMBER );
insert into test values(1);
開始測试:
1.在数据库B上select count(1) from v$session;
2.在数据库A上update test@TO_B set id=1;
commit;
3.在数据库B上select count(1) from v$session;能够看到涨了一个
对照測试:
1.在数据库B上select count(1) from v$session;
2.在数据库A上update test@TO_B set id=1;
commit;
alter session close database linkTO_B;
3.在数据库B上select count(1) from v$session;能够看到没有变化
总结: 出现这样的问题。归根结底是操作dblink不规范,用了之后没有关闭。
有可能是bug:
| Bug 18394488 : TOO MANY CONNECTIONS OVER SHARED DBLINK AFTER UPGRADE TO 11.2.0.4 |
|
||||
![]() |
|||||


|
| 类型 | B - Defect | 已在产品版本号中修复 | |
| 严重性 | 2 - Severe Loss of Service | 产品版本号 | 11.2.0.4 |
| 状态 | 36 - Duplicate Bug. To Filer | 平台 | 212 - IBM AIX on POWER Systems (64-bit) |
| 创建时间 | 2014-3-13 | 平台版本号 | 7.1 |
| 更新时间 | 2015-6-5 | 基本 Bug | id=18759589&refresh=N&bugProductSource=Oracle" style="font-size:14px; text-decoration:none; color:rgb(0,113,194); font-family:Helvetica,sans-serif; padding-top:5px">18759589 |
| 数据库版本号 | 11.2.0.4 | 影响平台 | Generic |
| 产品源 | Oracle | 与此 Bug 相关的知识, 补丁程序和 Bug |

|
| 产品线 | Oracle Database Products | 系列 | Oracle Database Suite |
| 区域 | Oracle Database | 产品 | 5 - Oracle Database - Enterprise Edition |

Hdr: 18394488 11.2.0.4 RDBMS 11.2.0.4 PRG INTERFACE PRODID-5 PORTID-212 18759589
Abstract: TOO MANY CONNECTIONS OVER SHARED DBLINK AFTER UPGRADE TO 11.2.0.4 *** 03/13/14 12:14 am *** PROBLEM:
--------
The production database system upgraded from 11.2.0.1 to 11.2.0.4 in the
previous weekend.
There are several shared db links on this database to other production
database that its version is 11.2.0.3 .
When trying to connect sessions on 11.2.0.4 to 11.2.0.3 via shared db links
it opens too many connection on connected database.
We tested this situation between 11.2.0.3 to 11.2.0.3 databases via shared db
link , opened session count is two (one of them is PSEUDO other is DEDICATED
)
but between 11.2.0.4 to 11.2.04 opened session count is at least 10. When
1000 session trying to connect 11.2.0.4 to 11.2.0.3 via shared db links about
10000 connection opening. This system working correctly before database upgrade.
We didn't change any parameter, listener configuration or unix parameter. DIAGNOSTIC ANALYSIS:
--------------------
Checked with the customer on:
1. Why are you using shared DBLINKS and SHARED servers ?
Because main application works with shared dblinks. (from many years ) ... We
didn't use shared servers , after upgrade too many connection is opening and
we have to use it because of handle too many connection with less resource . 2. Can you use standard DBLINKS and not use shared servers ?
We cannot use standard db links because of application design... If Oracle
solve this problem we can use dedicated. (before upgrade we had used
dedicated ) When checking with application development team on why are they using shared
db links ;
they said that main banking application works in webspehere connection pool
using XA transaction and it must use shared db link to handle connections !
It can't use standart db links . If oracle created shared db link feature why
are you offer to use standard db link ? Before upgrade everything works fine.
I am also repeating my words , we had used dedicated server , we have to use
shared server because of performance issue for now . If Oracle solve opening
many connection issue we will use dedicated server again . But shared db link
feautere will remain because of websphere XA transaction handling. 3. How many sessions to server B does each of your application connections to
Server A open ? Its count didn't change , anyway after upgrade it is same that the previous
value before upgrade. ct found metalink document why they use shared db link.
ORA-24777 reported when using a database link from within an XA coordinated
transaction (Doc ID 1506756.1)
Solution from document; Two options 1. 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
2 or establish whether the Java application needs to start an XA transaction. OR 2. Define the database link being utilised as a shared database link, i.e, CREATE SHARED DATABASE LINK .. They got this error many years ago ;
ORA-24777 reported by a JDBC/XA application when utilising a database link
between two Oracle databases. And db links was configured to shared db links.
I explained before why we are using shared server ( performance ) A complete test case epxlaining how a connection from 11.2.0.4. to 11.2.0.3
opens alot of connections: db_link.pdf WORKAROUND:
-----------
none RELATED BUGS:
-------------
Bug 18157790 - ORA-22 AFTER UPGRADE FROM 11.2.0.3 TO 11.2.0.4
Bug 1559258 - PSEUDO SESSION INCREASE WITH XA + SHARED DBLINK REPRODUCIBILITY:
----------------
issue is reproducible on ct's env. TEST CASE:
----------
provided STACK TRACE:
------------ SUPPORTING INFORMATION:
----------------------- 24 HOUR CONTACT INFORMATION FOR P1 BUGS:
---------------------------------------- DIAL-IN INFORMATION:
-------------------- IMPACT DATE:
------------
附录为官方文档:
32 Managing a Distributed Database
Closing Database Links
If you access a database link in a session, then the link remains open until you close the session. A link is open
in the sense that a process is active on each of the remote databases accessed through the link. This situation has the following consequences:
If 20 users open sessions and access the same public link in a local database, then 20 database link connections are open.
If 20 users open sessions and each user accesses a private link, then 20 database link connections are open.
If one user starts a session and accesses 20 different links, then 20 database link connections are open.
After you close a session, the links that were active in the session are automatically closed. You may have occasion to close the link manually. For example, close links when:
The network connection established by a link is used infrequently in an application.
The user session must be terminated.
To close a link, issue the following statement, where linkname refers to the name of the link:
ALTER SESSION CLOSE DATABASE LINK linkname;
Note that this statement only closes the links that are active in your current session.
oracle dblink造成远程数据库session过多的更多相关文章
- ORACLE 配置连接远程数据库
ORACLE配置tnsnames.ora文件实例 客户机为了和服务器连接,必须先和服务器上的监听进程联络.ORACLE通过tnsnames.ora文件中的连接描述符来说明连接信息.一般tnsnames ...
- PL/SQL配置oracle客户端,登录远程数据库配置
本地未安装Oracle数据库,但又想使用PL/SQL连接服务器端的数据库. 1.新建NETWORK文件夹, 在该文件夹下新建ADMIN文件夹, 在该文件夹下新建tnsnames.ora文件(拷贝下面的 ...
- oracle dblink 查询 tns:无法解析指定的连接标识符
问题情景是这样的:我在数据库服务器(windows server 2008r2 ,64bit)oracle(11gr2,64bit)中通过dblink连接到另外一台服务器(hp-ux)的oracle( ...
- oracle dblink使用
一.dblink介绍 dblink是一个单向的数据库连接,通过设置可以访问其他数据库中的数据跟使用本地数据库中数据一样的感觉,但注意是单向的dblink.例如:A建连B的dblink,A可以访问B的表 ...
- Oracle dblink的说明和简单使用
在跨数据库查询的时候时常会用到dblink,例如:两台不同的数据库服务器,从一台数据库服务器的一个用户读取另一台数据库服务器下面的某个schema的数据,这个时候,使用dblink能够很方便的实现.d ...
- 使用Oracle DBLink进行数据库之间对象的访问操作
Oracle中自带了DBLink功能,它的作用是将多个oracle数据库逻辑上看成一个数据库,也就是说在一个数据库中可以操作另一个数据库中的对象,例如我们新建了一个数据database1,我们需要操作 ...
- 使用Oracle DBLink进行数据库之间对象的訪问操作
Oracle中自带了DBLink功能,它的作用是将多个oracle数据库逻辑上看成一个数据库,也就是说在一个数据库中能够操作还有一个数据库中的对象,比如我们新建了一个数据database1.我们须要操 ...
- oracle 两个网络不通的远程数据库如何将一个库中的表数据导入到另一个库中?
1.情景展示 本地可以直接连接2个不同的远程数据库: 两个数据库由于网络不通,无法建立DBLINK完成数据传输: 将A库中C表的数据插入到B库中C表,如何快速实现? 2.解决方案 通过kettle ...
- 使用DBLink方式同步远程数据库中含Blob、Clob字段表的问题解决
在数据库同步中我们经常会用到DBLink方式.DBLink可以将物理上存放于网络的多个数据库在逻辑上当成一个单一的大数据库.开发人员无需关心数据库的网络分布,就能很方便的实现从不同数据库之间读取数据. ...
随机推荐
- Oracle定时执行存储过程(转)
定时执行存储过程在平时开发中经常会用到,年前的时候自己也做了一个,由于时间关系一直没能记录,现记录下来. 首先用一个完整的例子来实现定时执行存储过程. 任务目标:每小时向test表中插入一 ...
- 日交易41.9亿,B2B的魅力为何不输于B2C、C2C?
在最近两年的电子商务版图中,B2C和C2C可谓大放异彩,相比之下,B2B却显得颇为“低调”,当然,低调并不代表没有影响力,只不过,相比B2C和C2C面向数亿网民而言,B2B只针对企业和商家服务 ...
- 在Windows如何解决下Cocos2d-x示例代码TestCpp我找不到lib问题库文件
遇到此问题,首先确定失踪的库文件,然后找到文件夹,库文件. 在编制Cocos2d-x在TestCpp工程,提示缺少lib文件,共同拥有下面2种可靠解决方式: 1.在Cocos2d-x的根文件夹Debu ...
- Nagios监控系统的安装
环境:centOS 6.5 X86 64位 nagios-4.08 步骤: 1. 最小化安装系统 2. 修改安全特性 关闭SELINUX SELINUX=disabled 清除iptabl ...
- Android动绘图标——I am not a gif maker,I am a developer
最早在git上发现一个非常酷眩的动绘图标效果: https://github.com/xuyisheng/tickplusdrawable 不得不说,国外的程序猿在细节的考虑上,确实比我们要好非常多, ...
- 嗨翻C语言
<嗨翻C语言> 基本信息 作者: (美)David Griffiths Dawn Griffiths 译者: 程亦超 出版社:人民邮电出版社 ISBN:978711531884 ...
- [ACM] hdu 4418 Time travel (高斯消元求期望)
Time travel Problem Description Agent K is one of the greatest agents in a secret organization calle ...
- 使用javaDate类代数据仓库维度表
使用javaDate类代数据仓库维度表 Date类别: ,返回一个相对日期的毫秒数.精确到毫秒.但不支持日期的国际化和分时区显示. Date 类从Java 开发包(JDK)1.0 就開始进化,当时它仅 ...
- SE 2014年4月8日
1.路由引入的作用? 当网络中运行多种路由协议的时候,由于不同协议的路由算法和度量值等均不相同,路由引入可以将不同协议的路由引入到当前的路由协议中,保证网络的互通. 对比单向入和双向入 单向引入是只将 ...
- SQLServer2012 分页语句执行分析
上一篇文章提到了,SQLServer2012在使用Offset,Fetch语句分页时,获取了大量不需要的数据,导致查询效率低的问题. 现在让我们来看看,究竟是什么导致SQLServer不能按需取数呢? ...



转究竟部