I setup an EC2 instance and RDS instance. Then installed oracle instance client on EC2 instance. After that I managed to do sqlplus and connect with database from EC2 instance. To do that I created a tnsnames.ora file and enter the service details of the database.
I can do,
sqlplus user/password@db_alias
But I cannot do, (This gives ERROR: ORA-12154: TNS:could not resolve the connect identifier specified)
ssh username@ip sqlplus user/password@db_alias
Password less ssh also configured. And I'm doing the ssh to the current machine itself. Any thought would be helpful.
Addition to the details. Since I installed oracle instance client, tnsping command is not available. I achieve this by adding following function to the .profile file.
whence tnsping >/dev/null 2>&1 ||
tnsping() {
sqlplus -L -s x/x@$1 </dev/null |
grep ORA- |
(grep -v ORA-01017 || echo OK)
}