ORA-02020: too many database links in use

Cause: The maximum number of active connections to remote databases per user 
login has been reached.
Action: If the user has no open cursors, the current SQL statement accesses 
more than the maximum allowed remote databases.
Otherwise, the user may free remote database connections by closing 
all cursors that access the databases.
If this occurs often, consider increasing the value of the 
initialization parameter OPEN_LINKS, which controls the maximum number 
of concurrent open connections to remote databases per user process.

原因:最大活动连接的数超过设置
动作:如果用户没有使用游标,则正在运行的sql命令,使用的数据库连接超过允许的的最大数,
如果用户使用了游标,用户可以通过关闭访问的数据库的所有游标,来释放远程数据库连接,
如果此问题经常发生,考虑增加open_links参数,该参数控制每个用户进程允许打开的最大远程数据库连接数

百度给出的解答,
SQL> show parameter open_links;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
open_links integer 10
open_links_per_instance integer 4
Oracle默认是4:

SQL> alter system set open_links=10 scope=spfile;

重启下数据库就好了。

问题,用户并不一定有权限去操作,上述方式仅仅使用了第二种处理方式,关闭远程数据库连接的方式没有涉及
其实解决很简单。
对于活动的连接,commit或回滚就会断开活动的连接
SQL> select * from v$dblink;
 
DB_LINK    OWNER_ID LOGGED_ON HETEROGENEOUS PROTOCOL OPEN_CURSORS IN_TRANSACTION UPDATE_SENT COMMIT_POINT_STRENGTH
-------------------------------------------------------------------------------- ---------- --------- ------------- -------- ------------ -------------- ----------- ---------------------
LNK_YYBCV1     
使用命令关闭打开的远程数据库连接,数据库连接不用加单引号
SQL> alter session close DATABASE LINK lnk_yybcv1;
 
Session altered
如果在存储过程中,数据库连接需要加单引号-字符串。
dbms_session.close_database_link(' lnk_yybcv1');

抱怨一句,百度出来的东西真不好用。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Blue_Tear

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值