TNSName.ora file is the local naming configuration file to define database service aliases. You can use the aliases to connect to database via Oracle Database Clients. This blog gives some example TNSName.ora configurations.
The following is an example tnsname.ora including a connection to a PDB (PDB1) in Oracle Database Cloud Service.
The following is an example tnsname.ora including a connection to a PDB (PDB1) in Oracle Database Cloud Service.
target = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DBAAS4OCPU)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = PDB1.a228251.oraclecloud.internal) ) )
The following is an example tnsname.ora to connect to a AWS RDS Oracle Database.
awstarget = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = orcl12c.cserhpfzdaax.us-east-1.rds.amazonaws.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ORCL12C) ) )
After you set up the connection aliases, you can run them in the connections in SQL*Plus:
sqlplus /nolog SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 21 21:34:15 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> connect awsuser/welcome1@awstarget Connected. SQL>