Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-12-02 · container image gvenzl/oracle-free:23-slim
ORA-12545 means the connection never reached a listener: the host part of the connect string could not be used. In Oracle 26ai the message reads "Connect failed because target host or object does not exist" (older versions start it with "TNS:").
This page shows two database link cases that we reproduced on Oracle 26ai Free: a connect descriptor whose HOST is a server name this machine does not know, and a JDBC-style host:port:SID string copied into USING. In both cases CREATE DATABASE LINK succeeds, and the error appears on the first query through the link.
01The connect descriptor's HOST is a server name that cannot be resolved
The link was created with a full descriptor, (HOST=erp-db01)(PORT=1521) and SERVICE_NAME=FREEPDB1. Creating it worked. The first SELECT COUNT(*) FROM user_tables@erp_link failed with ORA-12545, because the database server has no host called erp-db01.
Setup
GRANT CREATE DATABASE LINK TO lab_a, lab_b;Grant succeeded.CREATE DATABASE LINK erp_link CONNECT TO lab_b IDENTIFIED BY lab USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=erp-db01)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=FREEPDB1)))';Database link created.SELECT COUNT(*) FROM user_tables@erp_link;SELECT COUNT(*) FROM user_tables@erp_link
*
ERROR at line 1:
ORA-12545: Connect failed because target host or object does not exist
Help: https://docs.oracle.com/error-help/db/ora-12545/COLUMN db_link FORMAT a10
COLUMN host FORMAT a105
SELECT db_link, host FROM user_db_links;DB_LINK HOST
---------- ---------------------------------------------------------------------------------------------------------
ERP_LINK (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=erp-db01)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=FREEPDB1)))
1 row selected.user_db_links shows the full descriptor in HOST, with (HOST=erp-db01) inside it.
DROP DATABASE LINK erp_link;
CREATE DATABASE LINK erp_link CONNECT TO lab_b IDENTIFIED BY lab USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=FREEPDB1)))';Database link dropped.
Database link created.We recreated the link with the real server name (HOST=localhost in this lab). The same query returned a row.
SELECT COUNT(*) FROM user_tables@erp_link; COUNT(*)
----------
0
1 row selected.02A JDBC-style host:port:SID string used in USING
USING 'localhost:1521:FREEPDB1' is the format of a JDBC thin URL. The host localhost itself is correct, but the first query through pdb_link still failed with ORA-12545.
Setup
GRANT CREATE DATABASE LINK TO lab_a, lab_b;Grant succeeded.CREATE DATABASE LINK pdb_link CONNECT TO lab_b IDENTIFIED BY lab USING 'localhost:1521:FREEPDB1';Database link created.SELECT COUNT(*) FROM user_tables@pdb_link;SELECT COUNT(*) FROM user_tables@pdb_link
*
ERROR at line 1:
ORA-12545: Connect failed because target host or object does not exist
Help: https://docs.oracle.com/error-help/db/ora-12545/COLUMN db_link FORMAT a10
COLUMN host FORMAT a25
SELECT db_link, host FROM user_db_links;DB_LINK HOST
---------- -------------------------
PDB_LINK localhost:1521:FREEPDB1
1 row selected.user_db_links shows HOST = localhost:1521:FREEPDB1: a colon, not a slash, before the service name.
DROP DATABASE LINK pdb_link;
CREATE DATABASE LINK pdb_link CONNECT TO lab_b IDENTIFIED BY lab USING 'localhost:1521/FREEPDB1';Database link dropped.
Database link created.We recreated the link with the Easy Connect format USING 'localhost:1521/FREEPDB1' (slash before the service name). The same query returned a row.
SELECT COUNT(*) FROM user_tables@pdb_link; COUNT(*)
----------
0
1 row selected.FAQ
What does ORA-12545 connect failed because target host or object does not exist mean?
The host part of the connect string could not be used. In our runs it was a server name the database server did not know (erp-db01) and a JDBC-style localhost:1521:FREEPDB1 string.
The DB link was created without error. Why ORA-12545 later?
CREATE DATABASE LINK does not connect. Both of our links were created successfully, and ORA-12545 appeared on the first query through the link.
How do I see which host a DB link uses?
Query SELECT db_link, host FROM user_db_links;. The HOST column showed the exact USING string, including the full descriptor.
Can I use a JDBC URL format like host:1521:SID in a DB link?
In our run 'localhost:1521:FREEPDB1' failed with ORA-12545, and 'localhost:1521/FREEPDB1' (slash before the service name) worked.
Why do I get ORA-12262 instead of ORA-12545 for an unknown host?
In our 26ai tests an unknown host in a full (DESCRIPTION=...) descriptor gave ORA-12545, while the same unknown host in an Easy Connect string erp-db01:1521/FREEPDB1 gave ORA-12262.
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0