The issue occurs when there is a db link which is a loop back database link i.e. points to itself
Example:
01:52:20 @> DROP DATABASE LINK TEST.WORLD;
DROP DATABASE LINK TEST.WORLD
*
ERROR at line 1:
ORA-02082: a loopback database link must have a connection qualifier
-- Shows the global name matches the db link
01:52:44 @> select * from global_name;
GLOBAL_NAME
—————————————————————————————————-
TEST.WORLD
1 row selected.
-- So to fix the issue rename the global_name to something else
01:55:37 @> 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
01:55:58 @> DROP DATABASE LINK TEST.WORLD;
Database link dropped.
01:56:08 @> Alter database rename global_name to TEST.WORLD;
Database altered.