ORA-2080 : PL/SQL Fails To Close DBLink After ROLLBACK / COMMIT (Doc ID 394730.1)

Last updated on JULY 05, 2017

Applies to:

PL/SQL - Version 9.0.1.0 to 10.2.0.4 [Release 9.0.1 to 10.2]
Information in this document applies to any platform.
***Checked for relevance on 26-Aug-2013***

Symptoms

The following PLSQL anonymous block which calls a remote function using a database link, fails to close the database link after issuing a rollback / commit and errors with ORA-2080 for the first time while second time it works: 

DECLARE
  v_num NUMBER;
BEGIN
  BEGIN
    v_num := f_num@db1(7900);
  END;
  --commit;
  rollback;
  dbms_session.close_database_link('db1');
END;
/


OUTPUT

ERROR at line 1:
ORA-02080: database link is in use
ORA-06512: at "SYS.DBMS_SESSION", line 159
ORA-06512: at line 15

Changes

The same block in Oracle 8i works successfully every time - the rollback/commit ends the transaction and dbms_session.close_database_link is successful.
In Oracle 9iR1 (9.0.1.0.0) the rollback / commit does not appear to end the transaction and the block fails.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms