笔记本拔掉网线后,从服务启动ORACLE监听服务器时报错(如下图所示)
通过命令启动查看具体错误信息如下所示:
查看具体的报错日志信息log.xml,如下所示:
代码<msg time='2012-06-30T13:58:04.381+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>系统参数文件为E:\app\kerry\product\11.2.0\dbhome_1\network\admin\listener.ora
</txt>
</msg>
<msg time='2012-06-30T13:58:04.383+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>写入e:\app\kerry\diag\tnslsnr\kerry-PC\listener\alert\log.xml的日志信息
</txt>
</msg>
<msg time='2012-06-30T13:58:04.384+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>写入e:\app\kerry\diag\tnslsnr\kerry-PC\listener\trace\ora_1656_3396.trc的跟踪信息
</txt>
</msg>
<msg time='2012-06-30T13:58:04.385+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>跟踪级别当前为0
</txt>
</msg>
<msg time='2012-06-30T13:58:04.386+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>
</txt>
</msg>
<msg time='2012-06-30T13:58:08.327+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>以 pid=1656 开始
</txt>
</msg>
<msg time='2012-06-30T13:58:08.438+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>监听该对象时出错: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.20.32.106)(PORT=1521)))
</txt>
</msg>
<msg time='2012-06-30T13:58:08.445+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='KERRY-PC'
host_addr='fe80::bdcd:f603:9ae2:a99%16'>
<txt>TNS-12545: 因目标主机或对象不存在, 连接失败
TNS-12560: TNS: 协议适配器错误
TNS-00515: 因目标主机或对象不存在, 连接失败
32-bit Windows Error: 49: Unknown error
</txt>
</msg>
通过查看出错信息:监听该对象时出错: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.20.32.106)(PORT=1521)))。可以知道只需设置监听配置文件listener.ora文件中红色部分即可
# listener.ora Network Configuration File: E:\app\kerry\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = E:\app\kerry\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:E:\app\kerry\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = orcl.20.32.106)
(ORACLE_HOME = E:\app\kerry\product\11.2.0\dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.32.106)(PORT = 1521))
)
)
改为
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
重启服务即可。当然也可以用127.0.0.1来替换localhost,当然你必须设置C:\Windows\System32\drivers\etc下的hosts文件,此时启动监听服务后。如果你想通过用PL/SQL等客户端工具来连接数据,你还必须修改tnsnames.ora中的配置,把172.20.32.106 IP地址改为localhost或127.0.0.1。
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.32.106)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.20.32.106)
)
)
否则会如下报错:
一切设定好了后,所有问题都解决了。