Sunday, March 12, 2017

Connect Amazon RDS from on premises gives ORA-12560: TNS:protocol adapter error

##########################
## Error
##########################

ORA-12560: TNS:protocol adapter error


##########################
#  Error Occurred
##########################

I've created a new AWS RDS database and tried to connect the database using sqlplus from my laptop.

##########################
## Command Executed
##########################

sqlplus

**************************************** Step By Step Analysis ******************************************************

#########################################
# 1) Check the network connectivity
#########################################

Please check if the database inbound rules are allowed to connect this database.

Login to console and Choose RDS Under Database and then choose Instances

Select the Database you are trying to connect.

Click the Details Tab.

Click on the Security Groups. This will take you to the security groups page.

Click Inbound Tab and it shows its allowed to any ip.


=====================================================================================================================

##########################
## Solution
##########################

#########################################
# 2) Dont use Single Quotes
#########################################

While trying to connect from Windows command line don't use single quotes.

=====================================================================================================================
Establish the connection now and it works good.
=====================================================================================================================



=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================

Connecting Amazon RDS from onpremis gives ORA-12170: TNS:Connect timeout occurred

##########################
## Error
##########################

ORA-12170: TNS:Connect timeout occurred

##########################
#  Error Occurred
##########################

I've created a new AWS RDS database and tried to connect the database using sqlplus from my laptop.

##########################
## Command Executed
##########################

sqlplus

**************************************** Step By Step Analysis ******************************************************

#########################################
# 1) Check the network connectivity
#########################################

ORA-12170: TNS:Connect timeout occurred

Above error usually occurs when there is no network connectivity between source and target. As the connections in AWS RDS are controlled via Security Groups, lets check the Security Group Inbound Rules.

Login to console and Choose RDS Under Database and then choose Instances. Select the Database you are trying to connect.




Click the Details Tab.

Click on the Security Groups. This will take you to the security groups page.

Click Inbound Tab,


=====================================================================================================================

#########################################
# 2) Reason for Failure
#########################################

From above output we can see only 154.59.142.48/32 is allowed to login via 1521 port number.

So to connect from my laptop, i need to add my ip address or allow this instance to be accessible to everyone based upon your requirement.

=====================================================================================================================

##########################
## Solution
##########################

#########################################
# 3) Add New Rule
#########################################

In "Inbound" tab, click Edit and a new Rule. Choose "Oracle-RDS" as type and in the source choose "Anywhere" (accessible to public)


Click Save and then the Inbound rules looks as below.


=====================================================================================================================
Establish the connection now and it works good.
=====================================================================================================================

=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================