ORA-02019: Connection Description for Remote Database Not Found
ORA-02019 is an Oracle error that occurs when the database cannot locate the connection description for a remote database, typically when using a database link or executing a distributed transaction. This error most commonly stems from a missing or misconfigured entry in tnsnames.ora, an invalid database link definition, or incorrect environment variable settings pointing to the wrong Oracle Net configuration files.
Top 3 Causes and Fixes
Cause 1: Database Link Does Not Exist or Was Created Incorrectly
The database link may be missing entirely or may have been created with an incorrect TNS alias or connection string.
-- Check existing database links
SELECT db_link, username, host, created
FROM user_db_links;
-- Drop the incorrect link and recreate it
DROP DATABASE LINK remote_db_link;
-- Recreate using TNS alias
CREATE DATABASE LINK remote_db_link
CONNECT TO remote_user
IDENTIFIED BY remote_password
USING 'REMOTE_TNS_ALIAS';
-- Recreate using a full connection string (no tnsnames.ora required)
CREATE DATABASE LINK remote_db_link
CONNECT TO remote_user
IDENTIFIED BY remote_password
USING '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.100)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=REMOTEDB)))';
-- Validate the link
SELECT * FROM dual@remote_db_link;
Cause 2: Missing or Incorrect Entry in tnsnames.ora
Oracle Net uses tnsnames.ora to resolve TNS alias names. If the target alias is missing or contains a typo, ORA-02019 will be raised.
-- Verify TNS resolution from SQL*Plus
-- Run tnsping at the OS level first:
-- $ tnsping REMOTE_TNS_ALIAS
-- Example tnsnames.ora entry to add:
/*
REMOTE_TNS_ALIAS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = REMOTEDB)
)
)
*/
-- After updating tnsnames.ora, test the link
SELECT sysdate FROM dual@remote_db_link;
SELECT user FROM dual@remote_db_link;
Cause 3: global_names Parameter Mismatch
When global_names = TRUE, the database link name must exactly match the global_name of the remote database. A mismatch causes ORA-02019 or ORA-02085.
-- Check global_names setting
SHOW PARAMETER global_names;
-- Check the remote database's global name
SELECT global_name FROM global_name@remote_db_link;
-- Temporarily disable global_names enforcement
ALTER SESSION SET global_names = FALSE;
-- Or at system level (use with caution in production)
ALTER SYSTEM SET global_names = FALSE SCOPE = BOTH;
-- Recreate the link with the correct name matching the remote global_name
CREATE DATABASE LINK REMOTEDB.EXAMPLE.COM
CONNECT TO remote_user
IDENTIFIED BY remote_password
USING 'REMOTE_TNS_ALIAS';
Quick Fix Checklist
- Confirm the database link exists via
SELECT * FROM user_db_linksordba_db_links. - Run
tnsping <alias>at the OS level to verify TNS resolution. - Check
$TNS_ADMINand$ORACLE_HOMEenvironment variables point to the correcttnsnames.ora. - Verify listener status on the remote host with
lsnrctl status. - If
global_names = TRUE, ensure the link name matches the remote DB's global name.
Prevention Tips
Standardize and version-control your tnsnames.ora files.
Use a configuration management tool (e.g., Ansible, Puppet) to keep tnsnames.ora synchronized across all servers. Store it in a version control system so every change is tracked and auditable.
Implement a scheduled DB link health-check script.
-- Run this periodically to catch broken links early
BEGIN
FOR rec IN (SELECT db_link FROM user_db_links) LOOP
BEGIN
EXECUTE IMMEDIATE 'SELECT 1 FROM dual@' || rec.db_link;
DBMS_OUTPUT.PUT_LINE('HEALTHY: ' || rec.db_link);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('BROKEN: ' || rec.db_link || ' => ' || SQLERRM);
END;
END LOOP;
END;
/
Related Oracle Errors
| Error Code | Description |
|---|---|
| ORA-12154 | TNS: could not resolve the connect identifier |
| ORA-02085 | Database link name does not match remote global name |
| ORA-01017 | Invalid username/password on remote database |
| ORA-12541 | TNS: no listener on remote host |
| ORA-02063 | Error propagated from remote database via DB link |
📖 Want a more detailed guide?
Check out the full in-depth version (Korean) on oraerror.com — includes detailed analysis, additional SQL examples, and prevention tips.
Top comments (0)