Oracle SID 和服务名称;连接问题 [英] Oracle SID and Service name; connection problems

查看:30
本文介绍了Oracle SID 和服务名称;连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 sql developer 连接到远程服务器上的 oracle db.我将连接详细信息复制到 tnsnames 并且我能够连接到数据库.

I'm trying to connect to oracle db on remote server through sql developer. I copied the connection details to tnsnames and I'm able to connect to the db.

但是我有另一个与 sqldeveloper 相同的数据库应用程序,当我尝试建立连接时,我不断收到此错误.此应用程序使用需要主机名和 SID 的 oracle jdbc 瘦客户端.

However i have another db application which is same as sqldeveloper and when I try to make a connection, I keep getting this error. This application uses oracle jdbc thin client which requires hostname and SID.

我收到以下错误:

java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12505, TNS:listener 当前不知道连接描述符中给出的 SID

java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

在进行故障排除时,我更改了 sqldeveloper 中的 tns 选项,并且我选择了基本选项来找出问题所在,并且我意识到我能够连接到它,因为服务名称正确,但无法连接到db 通过 SID 名称甚至通过 sqldeveloper.

While troubleshooting, I changed the tns option in sqldeveloper and I have selected basic option to find out what went wrong and I realized that I'm able to connect to it because of the correct service name and not able to connect to the db via SID name even through sqldeveloper.

我使用了一些数据库查询来找出 SID 名称,但我仍然遇到相同的错误.请帮我排除故障.

I have used some db queries to find out SID name but still i keep getting the same error. Please help me troubleshoot.

感谢您的时间..

推荐答案

ORA-12505 表示你的客户端传递了一个 SID,服务器端的监听器完全没认出来.

ORA-12505 means your client passed a SID that the listener on the server end didn't recognize at all.

10G及以上可以使用EZ connect无需配置服务器端像这样:

In 10G and above You can use EZ connect without configuring the server side like this:

sqlplus hr@liverpool:1521/DEMO

hr is the user name
liverpool is the server name
1521 is the port the listener for the DB is listening on
DEMO is the database SID

(或)

如果您仍想使用 tnsnames.ora,请尝试从您的客户端运行 tnsping SID.

If you still want to use tnsnames.ora, try running tnsping SID from your client.

在 LINUX 上,您还可以让 ORACLE 从本地读取 tnsnames.ora 文件路径 - 只需将 TNS_ADMIN 设置为 tnsnames.ora 文件所在的目录.

On LINUX, You can also have ORACLE read a tnsnames.ora file from a local path - just set TNS_ADMIN to the directory where your tnsnames.ora file is.

否则需要在$ORACLE_HOME/network/admin中配置tnsnames.ora在客户端

Otherwise, you need to configure tnsnames.ora in $ORACLE_HOME/network/admin on the client

如果您需要知道数据库 SID,请使用:

If you need to know the database SID, use this:

select sys_context('userenv','db_name') from dual;

select sys_context('userenv','db_name') from dual;

查看此网址:

检查oracle sid和数据库名称

这篇关于Oracle SID 和服务名称;连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆