I perform the following sequence of steps(step-wise using F-9) in Oracle SQL Developer:
create database link mydb connect to my_schema identified by mypwd using 'connection1';
select * from users where id = 1;
rollback;
ALTER SESSION CLOSE DATABASE LINK mydb;
drop database link mydb;
I get an error when I try to close the database link:
SQL Error: ORA-02080: database link is in use 02080. 00000 - "database link is in use"
*Cause: a transaction is active or a cursor is open on the database link given in the alter session close database link command.
*Action: commit or rollback, and close all cursors
The transaction is finished, but when I do select * from V$DBLINK;
I see there is still an open cursor, but I have no idea how I can close that one.
exec DBMS_SESSION.CLOSE_DATABASE_LINK('MYDB');
gets the same ORA-02080 error in that scenario, incidentally. – Alex Poole