DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Friday, January 13, 2017

ORA-02020: too many database links in use - Issue

select * from dual@<dblink>  
            *
ERROR at line 1:
ORA-02020: too many database links in use

Check the

APPTest@WWITest> show parameter open_links;

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
open_links                           integer                           4
open_links_per_instance              integer                           4


Note: Current session having the defalt value due to that this seesion exceeded the value.

To avoid this error.

Step 1:

SQL> alter system set open_links_per_instance=20 scope=spfile;
SQL> alter system set open_links=20 scope=spfile;

Step 2:

Restart the db

Step 3:

APPTest@WWITest> show parameter open_links;

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
open_links                           integer                           20
open_links_per_instance              integer                           20


Step 4:

APPTest@WWITest>  select * from dual@<db link>;

DUM
---
X

Note: Do not set it too high, it is better for the application to close database links when no longer in use than to change the parameter to a high number.



To close the unwanted db link:

APPTest@WWITest>  select in_transaction, count(*) from v$dblink group by in_transaction;

no row selected.

Note: if any transation is there in the db link you can close the db link by issuing the below command.

APPTest@WWITest>  alter session close database link <db link name>;

session altered.

OR
APPTest@WWITest>  exec DBMS_SESSION.CLOSE_DATABASE_LINK (<db link name>);

No comments: