简体   繁体   English

将 sql 开发人员与远程 oracle 数据库连接

[英]connecting sql developer with remote oracle database

I have access to oracle database server.我可以访问 oracle 数据库服务器。 I wanted to connect it with sql developer.我想将它与 sql 开发人员联系起来。 I have certain username /password for the remote server.我有远程服务器的特定用户名/密码。 and within that server I have access to database with certain username/ password.在该服务器中,我可以使用特定的用户名/密码访问数据库。

I access to that database form server using sql plus with command sqlplus abcd@xe and i have access to that database.我使用 sql 以及命令sqlplus abcd@xe访问该数据库表单服务器,并且我可以访问该数据库。

Whenever I tried to connect it with sql developer, connection is not established.每当我尝试将它与 sql 开发人员连接时,都没有建立连接。

I tired as:我累了:

connection name: test
username: username to the remote server
password: password to remote server.

hostname: server host name
port :1521
sid : xe

how can I connect to remote database located in remote server?如何连接到位于远程服务器中的远程数据库?

I am assuming the following scenario: You use an ssh client such as Bitvise to forward between local ports and remote ones.我假设以下场景:您使用 ssh 客户端(例如 Bitvise)在本地端口和远程端口之间转发。 You want to sql developer to connect to an existing db where you already have the db and the user credentials.您希望 sql 开发人员连接到您已经拥有数据库和用户凭据的现有数据库。 And you also have SSH access to the machine that hosts the Oracle DB.您还可以通过 SSH 访问托管 Oracle DB 的机器。

SSH into the remote DB and switch to the DB user. SSH 进入远程DB并切换到DB用户。 Check the Listener port:检查侦听器端口:

cat $ORACLE_HOME/network/admin/listener.ora

This returns among other things a line like:这会返回如下一行:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = <servername>)(PORT = 1521))

Now you know your target port is 1521 .现在您知道您的目标端口是1521

Check the Oracle SID:检查 Oracle SID:

echo $ORACLE_SID

You'll need this later on.稍后您将需要这个。

Forward a local port of your choice to the remote one in Bitvise along the lines of:将您选择的本地端口转发到 Bitvise 中的远程端口,如下所示:

Listen Interface    List. Port  Destination Host    Dest. Port  Comment
127.0.0.1           11521       <servername>        1521        Oracle-DB

Fire up Oracle SQL Developer启动 Oracle SQL 开发者

Click the green + sign - up pops the new connection menu.点击绿色+注册——弹出新的连接菜单。

Connection Name:    XYZ_Oracle
Username:           Oracle_db_username
Password:           pwd_for_db_username

Connection type:    Basic
Role:               Default
Hostname:           127.0.0.1
Port:               11521 (the forwarded port)
SID:                the ID of the particular DB you want to access aka db name

Press Test压力Test

Press ConnectConnect

Errors you may get:您可能会遇到的错误:

Invalid username/password - Make sure you use the uname/pwd that you use to access the DB with slqplus.无效的用户名/密码 - 确保您使用用于通过 slqplus 访问数据库的 uname/pwd。

String index out of range - Are you trying to connect on a wrong port?字符串索引超出范围 - 您是否尝试连接错误的端口? Maybe 22?也许22? Check the listening port / forwarding port检查监听端口/转发端口

Listener refused the connection.侦听器拒绝连接。 Unknown SID.未知的 SID。 - Make sure you are using the right system ID. - 确保您使用的是正确的系统 ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM