JDBC连接串ORACLE, 你是否知道怎么写? ORA-1250

举报
杰森志智 发表于 2019/01/28 21:26:12 2019/01/28
【摘要】 Wrong or correct, SID or Service Name?INSTANCE SID by ":"jdbc:oracle:thin:@db_ip_or_name:1521:ODB_ISSERVICE NAME by "/"jdbc:oracle:thin:@db_ip_or_name:1521/ODB_SNHow do you know?SELECT NAME,VALUE,D...

Wrong or correct, SID or Service Name?

    • 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.


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。