织梦CMS - 轻松建站从此开始!

罗索实验室

当前位置: 主页 > 基础技术 > 数据库开发 >

ORA-12505: TNS: 监听器无法处理连接描述符中所给出的 SID

jackyhwei 发布于 2010-04-28 19:49 点击:次 
安装ORACLE的时候默认建了一个SID为OEMREP的数据库,用ODCA新建一个名为TEST的数据库,完成之后打开sqlplus
TAG:


SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE    9.2.0.1.0       Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production


安装ORACLE的时候默认建了一个SID为OEMREP的数据库,用ODCA新建一个名为TEST的数据库,完成之后打开sqlplus
SQL>sys/orcl@OEMREP as sysdba


ERROR:
ORA-12505: TNS: 监听器无法处理连接描述符中所给出的 SID

察看tnsnames.ora 发现原来的OEMREP数据库的主机字符串没有了,只有TEST的主机字符串

# TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

TEST =
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = TLH)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TEST)
    )
)

INST1_HTTP =
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = TLH)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = SHARED)
      (SERVICE_NAME = MODOSE)
      (PRESENTATION = http://HRService)
    )
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
)

在这个文件中手动加入OEMREP的主机字符串
OEMREP =
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = TLH)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = OEMREP)
      (SERVER = DEDICATED)
    )
)

察看监听程序配置文件listener.ora,
# LISTENER.ORA Network Configuration File: C:\oracle\ora92\network\admin\listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = TLH)(PORT = 1521))
      )
    )
)

SID_LIST_LISTENER =
(SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oracle\ora92)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = TEST)
      (ORACLE_HOME = C:\oracle\ora92)
      (SID_NAME = TEST)
    )
   
)
缺少OEMREP的描述,也就是没有监听OEMREP的服务,修改为
# LISTENER.ORA Network Configuration File: C:\oracle\ora92\network\admin\listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = TLH)(PORT = 1521))
      )
    )
)

SID_LIST_LISTENER =
(SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oracle\ora92)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = TEST)
      (ORACLE_HOME = C:\oracle\ora92)
      (SID_NAME = TEST)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = OEMREP)
      (ORACLE_HOME = C:\oracle\ora92)
      (SID_NAME = OEMREP)
    )

)


重新启动TNSListener服务,是改动生效。

连接出错一般都是listener.ora tnsnames.ora配置的问题。

从上面可以看到是用计算机名表示本机地址,在C:\WINDOWS\system32\drivers\etc\hosts中加入本机地址与计算机名的映射关系,加入下面一句
172.19.20.37   TLH

这句不加好像也是可以的,以前没有加过

(victor_tlh)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www1.rosoo.net/a/201004/9299.html]
本文出处:百度博客 作者:victor_tlh
顶一下
(6)
54.5%
踩一下
(5)
45.5%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容