Saturday, April 26, 2014

ORA-02019

I had not seen this problem for a long time so, when it happened again recently, it took me a while to see the cause. I therefore decided to record it for future reference. First I created a database link:

ORCL /export/home/oracle/andrew > sqlplus /

SQL*Plus: Release 11.2.0.2.0 Production on Wed Apr 17 11:55:54 2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create database link link1.world
  2  connect to andrew
  3  identified by reid
  4  using 'REMOTEDB'
  5  /

Database link created.

SQL>

… but when I tried to use the link, I got an ORA-02019:

SQL> select * from dual@link1
  2  /
select * from dual@link1
                   *
ERROR at line 1:
ORA-02019: connection description for remote database not found

SQL>

I checked the database’s GLOBAL_NAME:

SQL> l
  1* select * from global_name
SQL> /

GLOBAL_NAME
------------------------------
ORCL

SQL>

I changed it as follows:

SQL> alter database rename global_name to ORCL.WORLD
  2  /

Database altered.

SQL> select * from global_name
  2  /

GLOBAL_NAME
------------------------------
ORCL.WORLD

SQL>

… and the database link worked:

SQL> select * from dual@link1
  2  /

D
-
X

SQL>

No comments: