Search notes:

Oracle SQL noun: DATABASE LINK

The Oracle SQL statements using the noun database link are
create database link tq84_remote_db
   connect to usr_abc
   identified by secretGarden
   using 'srv:1521/ora19';

Dropping a database link

drop database link tq84_remote_db;
-- ORA-02018: database link of same name has an open connection

alter session close database link tq84_remote_db;
-- ORA-02080: database link is in use

begin dbms_session.close_database_link('tq84_remote_db'); end;
/
-- ORA-02080: database link is in use

select
   logged_on,
   open_cursors,
   in_transaction 
from
   v$dblink
where
   db_link like 'TQ84_REMOTE_DB';
   
commit;

alter session close database link tq84_remote_db;
-- Session altered

drop database link tq84_remote_db;
-- Database link TQ84_REMOTE_DB dropped.
See also MOS Note 1034343.6 (How To Close Remote Connections)

Index