I'm trying to create a DB link between two Oracle RDS instances in two different VPCs.
I have created a peering VPC connection, added routes and edited security groups according to this guide. But I'm getting
"ORA-12154: TNS:could not resolve the connect identifier specified" error when querying using the DB link.
My DB link creation SQL is as below:
CREATE DATABASE LINK dblink
CONNECT TO myuser IDENTIFIED BY password
USING 'DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.10.2.239)(PORT=1521))(CONNECT_DATA=(SID=sid))';
You need to wrap the connection string in parentheses:
CREATE DATABASE LINK dblink
CONNECT TO myuser IDENTIFIED BY password
USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.10.2.239)(PORT=1521))(CONNECT_DATA=(SID=sid)))';
Without the starting parenthesis, Oracle looks for a tnsnames.ora entry named "DESCRIPTION", which it doesn't find, which is why it throws the error "could not resolve the connect identifier specified".