ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
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.
客户通过java jdbc thin driver 连接oracle,使用的格式是jdbc:oracle:thin:@192.108.56.117:1521:ct65,报ORA-12505错误,这是以sid方式连接的格式,这里ct65是这台oracle的
service_name,而这台oracle的sid是ct6501,只需要把ct65换成ct6501就可以了.也或者使用jdbc:oracle:thin:@//192.108.56.117:1521/ct65以service_name的方式连接也可以.
当然还有一种方法是通过tnsname方式连接,格式为jdbc:oracle:thin:@tns_ct65,这里的tns_ct65是tnsnames.ora中配置的对应的tnsname.
个人建议java jdbc thin driver通过service_name的方式连接数据库,sid方式不适合于rac环境,也不利于dataguard环境下之后的切换.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28539951/viewspace-1757860/
,如需转载,请注明出处,否则将追究法律责任。