问题描述
我已经安装在Windows Server 2008 R2与Oracle服务器11克(11.2)和一个小型的数据库(MYDB)在Amazon EC2上。
I have setup a Windows Server 2008R2 with an oracle server 11g (11.2) and a small database (MYDB) in amazon EC2.
现在我想从我的计算机连接到这个数据库(我使用PL / SQL开发者,但我不介意使用其他工具)
Now I want to connect from my computer to this database (I use PL/SQL developer but I don't mind using other tools)
在服务器端,我有:(其中ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com是公共DNS为我赢的服务器。)
tnsnames.ora中:
In server side I have: (where ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com is the public DNS for my Win server.)
tnsnames.ora:
MYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = MYDB)
)
)
的listener.ora:
listener.ora:
# listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = C:\app\Administrator
在我的电脑在tnsnames.ora中我有:
At my pc at tnsnames.ora i have:
MYDB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = MYDB)
)
)
使用这些设置,我能够在本地连接在我的服务器,但不是通过我的电脑。
我已经安装了安全组,在我的EC2:
With these settings, I am able to connect locally at my server, but not through my computer.
I have setup up Security Groups at my EC2:
入站规则
Type Protocol Port Range Source
RDP TCP 3389 Anywhere 0.0.0.0/0
SSH TCP 22 Anywhere 0.0.0.0/0
Custom ICMP Rule Echo Reply N/A Anywhere 0.0.0.0/0
当我试图从我的计算机连接,我得到ORA-12170:TNS:连接超时发生
When I am trying to connect from my computer I get ORA-12170:TNS:Connect timeout occurred.
任何想法,我做错了,还是解决问题的计划?
Any ideas what I am doing wrong, or a troubleshooting plan?
推荐答案
您的只允许RDP和SSH访问端口3389和22(加ICMP PING)。当您尝试连接到您正在使用的端口1521的数据库,你的的tnsnames.ora
规定:
Your security groups only allow RDP and SSH access, on ports 3389 and 22 (plus ICMP ping). When you attempt to connect to the database you're using port 1521, as your tnsnames.ora
dictates:
(HOST = ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com)(PORT = 1521))
所以,你需要添加入站防火墙规则允许通信的TCP端口1521通过您的EC2实例,除了现有的3389和22我不知道如果SQL *网络将上市在类型下拉,所以你可能需要选择所有TCP。
So you need to add an inbound firewall rule to allow traffic on TCP port 1521 through to your EC2 instance, in addition to the existing ones for 3389 and 22. I have no idea if SQL*Net will be listed in the 'type' drop down, so you might need to select 'All TCP'.
您可能还需要使其更为严格,虽然 - 限制源到你的PC的IP地址也许,如果这是私人或公司的传出IP若不;如果您从您的ISP具有静态公网IP。
You might also want to make it more restrictive though - limiting the 'source' to your PC's IP address perhaps if this is private, or your company's outgoing Ip if not; if you have a static public IP from your ISP.
这篇关于ORA-12170 TNS监听器在Oracle 11g中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!