JDBC URL FOR ORACLE, wrong or correct, how do you know?
-
INSTANCE SID by ":"
jdbc:oracle:thin:@db_ip_or_name:1521:ODB_IS
-
SERVICE NAME by "/"
jdbc:oracle:thin:@db_ip_or_name:1521/ODB_SN
-
How do you know?
SELECT NAME,VALUE,DESCRIPTION
FROM V$PARAMETER P
WHERE P.NAME IN ('db_unique_name','db_name','instance_name','service_names');*maybe you need your dba's help to query data dictionary view
*----NAME-----|--VALUE--|--DESCRIPTION------------------------------
instance_name | ODB_IS | instance name supported by the instance
service_names | ODB_SN | service names supported by the instance
db_name | ODB_NM | database name specified in CREATE DATABASE
db_unique_name| ODB_UN | Database Unique Name
The defferents are for RAC, DG; PRD,UAT,DEV deployment requirement etc.
Use service_names = db_name as normal, they must been see in 'lsnrctl status' -
PORT:
lsnrctl status
*run on the DB server shell window
ORA-12505: TNS: 监听器无法处理连接描述符中所给出的SID
Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186647552)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
当然除了上述纯配置错误之外,还一个可能就是实例服务还没有注册到监听器里去,这个需要了解动态注册和静态注册的知识,以及查看alert日志。
[grid@WMS ~]$ oerr ora 12505
12505, 00000, "TNS:listener does not currently know of SID given in connect descriptor"
// *Cause: The listener received a request to establish a connection to a
// database or other service. The connect descriptor received by the listener
// specified a SID for an instance (usually a database instance) that either
// has not yet dynamically registered with the listener or has not been
// statically configured for the listener. This may be a temporary condition
// such as after the listener has started, but before the database instance
// has registered with the listener.
// *Action:
// - Wait a moment and try to connect a second time.
// - Check which instances are currently known by the listener by executing:
// lsnrctl services <listener name>
// - Check that the SID parameter in the connect descriptor specifies
// an instance known by the listener.
// - Check for an event in the listener.log file.
http://*.com/a/41297876/963585