Cannot establish connection with AWS RDS Oracle database instance from Oracle SQL Developer

主宰稳场 提交于 2020-07-10 09:27:19

问题


I created an Oracle database in the AWS RDS console. I'm unable to connect to it from the Oracle SQL Developer program despite following all the instructions in the Amazon Developer Guides (see item #3 in this webpage in particular).

I get this error: IO Error: the network adapter could not establish the connection (vendor code 17002).

I have opened Port 1521 in my firewall settings.

Screenshots of my SQL Developer connection properties pane and the database properties from the AWS RDS console:

  • The username, password, and hostname database connection properties match those from AWS

  • The database is marked as "Available" and the connection properties pane contains the proper DNS endpoint and port specified in the AWS console

Edit:

AWS Security Group Rules Update: I took people's suggestions and ensured that Port 1521 was added to the Security Group inbound and outbound rules.

Inbound Rules screenshot For the inbound, I tried multiple things such as allowing the port for all IP addresses or just my IP address, but allowing it on the security group is the ONLY option that doesn't give me a SQL Developer connection error of "Listener refused the connection with the following error: TNS:listener does not currently know of SID given in connector descriptor. Vendor code 12505".

I don't believe I should have to have any rule for opening Port 1521 on the Inbound Rules because the default setting accepts all traffic, which I would think would include Port 1521.

Outbound Rules screenshot For the outbound, I added Port 1521 for my IP address.

I still get the same error despite all of these changes.

Any guidance would be appreciated! Thanks!


回答1:


One or more of the steps outlined below may solve your problem.

  1. Make sure that your SID in SQL Developer is your database name. To avoid frustration, forget about whatever you set when creating the database. Verify the correct database name by going to the Configuration tab and copying the string below DB Name as you see in the screenshot below. As you can see the DB Name here is DATABASE. I thought I had set it to ofaoes but I was wrong. The AWS flow to create a database, at least at the time of writing this answer, does not help at all because there is no specific field to enter the database name.

  1. Verify that your database is Publicly Accessible.

    1. Verify that your VPC has an internet gateway attached to it and that the inbound rules for the security group allow connections. (See link 2 below for help on this)

    2. Open the Amazon RDS console.

    3. Choose Databases from the navigation pane, and then select the DB instance.

    4. Choose Modify.

    5. Under Network & Security, choose Yes for Public accessibility.

    6. Choose Continue.

    7. Choose Modify DB Instance.

Here is a screenshot of that window:

For more info, or if the above doesn't work, visit the links for more current info:

  1. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Troubleshooting.html#CHAP_Troubleshooting.Connecting
  2. https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html#Add_IGW_Attach_Gateway
  3. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html#USER_VPC.Hiding

  4. https://aws.amazon.com/premiumsupport/knowledge-center/rds-connectivity-instance-subnet-vpc/

  5. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.html

  6. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.Scenarios.html




回答2:


There can be multiple reasons for it. Here are a couple of them that I can think of

  1. Make sure that security group attached to your RDS instance allows the incoming connection on port 1521 for your client machine ip address
  2. If you are using the Windows client machine, make sure that you have allowed the outgoing connection to port 1521.


来源:https://stackoverflow.com/questions/58528078/cannot-establish-connection-with-aws-rds-oracle-database-instance-from-oracle-sq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!