The error ORA-02082: a loopback database link must have a connection qualifier could be caused by your global_name, if you have cloned a database.



We were trying to create a database link PTAU on our new database TINSEC, but the statement failed with an ORA-02082
SQL> select name from v$database;

NAME
---------
TINSEC

SQL> connect PESS
Enter password:
Connected.
SQL> select db_link from user_db_links;

DB_LINK
--------------------------------------------------------------------------------
SIGMA.WORLD
MAGTMP.FIN.SE
FINANCE.WORLD
PESS_REFRESH
PESS_REFRESH.FIN.SE

SQL> create database link PTAU connect to read identified by **** using 'PTAU';
create database link PTAU connect to read identified by read using 'PTAU'
                             *
ERROR at line 1:
ORA-02082: a loopback database link must have a connection qualifier
PTAU was an entry in our tnsnames.ora, and not the name of our database
SQL> !tnsping PTAU

TNS Ping Utility for Linux: Version 9.2.0.8.0 - Production on 08-MAY-2009 11:18:                                    00

Copyright (c) 1997, 2006, Oracle Corporation.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)                                     (HOST = london20.eu.local)(PORT = 1521))) (CONNECT_DATA = (SID=PTAU)))
OK (20 msec)
One more try, and using a different name for the database link
SQL> create database link PTAU connect to read identified by read using 'PTAU';
create database link PTAU connect to read identified by read using 'PTAU'
                             *
ERROR at line 1:
ORA-02082: a loopback database link must have a connection qualifier


SQL> create database link PTAU2 connect to read identified by read using 'PTAU';

Database link created.

As we see, the reason of the error is the name itself, and not the TNSNAMES entry in "using"


SQL> connect / as sysdba
Connected.
SQL> select * from dba_db_links where db_link = 'PTAU';

no rows selected
No database link there, yet following select worked!!!!



SQL> select * from dual@PTAU;

D
-
X


SQL> drop database link PTAU;
drop database link PTAU
                         *
ERROR at line 1:
ORA-02082: a loopback database link must have a connection qualifier

I remembered having some kind of problem with a global name; doubt ...
SQL> select * from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
PTAU.FIN.SE

SQL> connect / as sysdba
Connected.
SQL> update global_name set GLOBAL_NAME='TINSEC.FIN.SE';

1 row updated.

SQL> commit;

Commit complete.
The cause was that TINSEC had been cloned using rman from PTAU; the global name had not been changed.
SQL> create database link PTAU connect to read identified by read using 'PTAU';

Database link created.


SQL> drop database link PTAU2.FIN.SE;

Database link dropped.
Lession learned: global name acts as a database link! If you try to create a database link equal to global_name, the statement fails with ORA-02082.
This note was ...
Useless Poor Average Good Very helpful

Home