Such error occurs when there is a db link which is a loop back database link i.e. points to itself
Example:
SQL> DROP DATABASE LINK TESTDB.WORLD;
DROP DATABASE LINK TESTDB.WORLD
*
ERROR at line 1:
ORA-02082: a loopback database link must have a connection qualifier
-- Shows the global name matches the db link
SQL> select * from global_name;
GLOBAL_NAME
—————————————————————————————————-
TESTDB.WORLD
1 row selected.
-- So to fix the issue rename the global_name to something else
SQL > Alter database rename global_name to TEMP.XXXX;
Database altered.
-- After changing global name one is able to drop the database link and after dropping the database link you can rename the global names
SQL> DROP DATABASE LINK TESTDB.WORLD;
Database link dropped.
SQL> Alter database rename global_name to TESTDB.WORLD;
Database altered.