Oracle SID和服务名称;连接问题 [英] Oracle SID and Service name; connection problems
问题描述
我尝试通过sql开发人员连接到远程服务器上的oracle db。我将连接详细信息复制到tnsnames,我可以连接到db。
然而,我有另一个数据库应用程序与sqldeveloper相同,当我尝试建立连接时,我一直收到这个错误。此应用程序使用oracle jdbc瘦客户机,它需要主机名和SID。
我收到以下错误:
java.sql.SQLException:Listener拒绝连接时出现以下错误:
ORA-12505,TNS:listener当前不知道连接描述符中给出的SID
在故障排除过程中,我更改了sqldeveloper中的tns选项,选择基本选项以找出出错,我意识到我能够连接到它,因为正确的服务名称,并且无法通过SID名称连接到数据库,即使通过sqldeveloper。
我使用一些数据库查询来查找SID名称,但仍然得到相同的错误。请帮助我排查故障。
感谢您的时间。
ORA-12505您的客户端传递了一个SID,服务器端的侦听器
根本无法识别。
在10G及以上您可以使用EZ连接,服务器端
像这样:
sqlplus hr @ liverpool:1521 / DEMO
hr是用户名
liverpool是服务器名称
1521是DB正在监听的侦听器
DEMO是数据库SID
(OR)
如果您仍然想要使用tnsnames.ora,请尝试运行tnsping SID您的客户端。
在LINUX上,您还可以使用ORACLE从本地
路径读取tnsnames.ora文件 - 只需将TNS_ADMIN设置为tnsnames .ora文件是
否则,您需要在客户端的$ ORACLE_HOME / network / admin
中配置tnsnames.ora
如果您需要知道数据库SID,请使用:
select sys_context userenv','db_name')from dual;
查看此URL:
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.
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.
I got the below error:
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
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.
I have used some db queries to find out SID name but still i keep getting the same error. Please help me troubleshoot.
Thanks for your time..
ORA-12505 means your client passed a SID that the listener on the server end didn't recognize at all.
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
(OR)
If you still want to use tnsnames.ora, try running tnsping SID from your client.
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.
Otherwise, you need to configure tnsnames.ora in $ORACLE_HOME/network/admin on the client
If you need to know the database SID, use this:
select sys_context('userenv','db_name') from dual;
See this URL:
Checking oracle sid and database name
这篇关于Oracle SID和服务名称;连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!