修改主机IP导致的ORA-12514错误(ORACLE)

当时我遇到的情况是主机自身(CENTOS)可以进入SQLPLUS,但远程客户端就报ORA-12514。但了很多资料,一般的解决情况就是服务器的listener.ora或远程登陆机的tnsnames.ora的配置问题,但我的配置均没有问题,最后终于查到原来是修改LINUX主机IP的时候漏修了一个文件。

 

连接时报错:  

    [oracle@yangtk2 ~]$ lsnrctl status
  LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 01-SEP-2008 17:36:03
  Copyright (c) 1991, 2007, Oracle. All rights reserved.
  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
  STATUS of the LISTENER
  ------------------------
  Alias LISTENER
  Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
  Start Date 01-SEP-2008 17:01:31
  Uptime 0 days 0 hr. 34 min. 32 sec
  Trace Level off
  Security ON: Local OS Authentication
  SNMP OFF
  Listener Parameter File /data/oracle/product/11.1/network/admin/listener.ora
  Listener Log File /data/oracle/diag/tnslsnr/yangtk2/listener/alert/log.xml
  Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.25.1.104)(PORT=1521)))
  The listener supports no services
  The command completed successfully

 

  检查listener.ora和tnsnames.ora都未发现异常:  

    [oracle@yangtk2 admin]$ more listener.ora
  # listener.ora Network Configuration File: /data/oracle/product/11.1/network/admin/listener.ora
  # Generated by Oracle configuration tools.
  LISTENER =
  (DESCRIPTION_LIST =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.25.1.104)(PORT = 1521))
  )
  )
  [oracle@yangtk2 admin]$ more tnsnames.ora
  # tnsnames.ora Network Configuration File: /data/oracle/product/11.1/network/admin/tnsnames.ora
  # Generated by Oracle configuration tools.
  ORA11G_S =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.25.1.104)(PORT = 1521))
  (CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = ora11g_s.ytk-thinkpad)
  )
  )
  ORA11G_P =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.25.1.102)(PORT = 1521))
  (CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = ora11g_p.ytk-thinkpad)
  )
  )

   而且以前这个配置没有任何问题,就是这次启动虚机后才出现的问题。         

  查询了metalink,虽然上面记载了很多ORA-12514错误,但是没有发现什么有帮助的线索。

  由于这个错误以前并没有出现,所以怀疑是最近修改了什么东西导致了这个问题。而启动之后做了唯一的修改就是修改了主机的IP地址。

  通过ifconfig修改了主机IP地址,莫非是修改错误导致了问题,不过现在通过IP地址可以正常的登陆主机,而且tnsping也没有任何的问题:  

    [oracle@yangtk2 admin]$ tnsping ora11g_s
  TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 01-SEP-2008 17:54:31
  Copyright (c) 1997, 2007, Oracle. All rights reserved.
  Used parameter files:
  /data/oracle/product/11.1/network/admin/sqlnet.ora
  Used TNSNAMES adapter to resolve the alias
  Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.25.1.104)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora11g_s.ytk-thinkpad)))
  OK (0 msec)


  
最后检查listner的日志:
  [oracle@yangtk2 admin]$ tail -20 /data/oracle/diag/tnslsnr/yangtk2/listener/alert/log.xml  

  type='UNKNOWN' level='16' host_id='yangtk2.ytk-thinkpad'
  host_addr='172.25.4.70'>
  01-SEP-2008 17:54:31 * ping * 0  
  type='UNKNOWN' level='16' host_id='yangtk2.ytk-thinkpad'
  host_addr='172.25.4.70'>
  WARNING: Subscription for node down event still pending 
  type='UNKNOWN' level='16' host_id='yangtk2.ytk-thinkpad'
  host_addr='172.25.4.70'>
  01-SEP-2008 17:58:24 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=yangtk2.ytk-thinkpad)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=185599488)) * status * 0

 

  发现日志中的IP地址并没有改变,看来是修改IP的时候遗漏了什么位置。

  检查HOSTS文件,发现里面的配置忘了进行修改:  

    [oracle@yangtk2 admin]$ more /etc/hosts
  # Do not remove the following line, or various programs
  # that require network functionality will fail.
  172.25.4.70 yangtk2.ytk-thinkpad
  127.0.0.1 localhost.localdomain localhost

 

  将hosts文件中的ip也修改为当前的IP后,问题解决。

  [oracle@yangtk2 ~]$ lsnrctl stop
  LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 01-SEP-2008 18:01:00
  Copyright (c) 1991, 2007, Oracle. All rights reserved.
  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
  The command completed successfully
  [oracle@yangtk2 ~]$ lsnrctl start
  LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 01-SEP-2008 18:01:10
  Copyright (c) 1991, 2007, Oracle. All rights reserved.
  Starting /data/oracle/product/11.1/bin/tnslsnr: please wait...
  TNSLSNR for Linux: Version 11.1.0.6.0 - Production
  System parameter file is /data/oracle/product/11.1/network/admin/listener.ora
  Log messages written to /data/oracle/diag/tnslsnr/yangtk2/listener/alert/log.xml
  Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.25.1.104)(PORT=1521)))
  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
  STATUS of the LISTENER
  ------------------------
  Alias LISTENER
  Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
  Start Date 01-SEP-2008 18:01:10
  Uptime 0 days 0 hr. 0 min. 0 sec
  Trace Level off
  Security ON: Local OS Authentication
  SNMP OFF
  Listener Parameter File /data/oracle/product/11.1/network/admin/listener.ora
  Listener Log File /data/oracle/diag/tnslsnr/yangtk2/listener/alert/log.xml
  Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.25.1.104)(PORT=1521)))
  The listener supports no services
  The command completed successfully
 

 稍等一会,通过sqlplus连接数据库: 

  [oracle@yangtk2 ~]$ sqlplus sys/test@ora11g_s as sysdba 
  SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 1 18:03:16 2008 
  Copyright (c) 1982, 2007, Oracle. All rights reserved. 
  Connected to: 
  Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production 
  With the Partitioning, OLAP, Data Mining and Real Application Testing options 
  SQL>

posted @ 2011-10-15 15:37  ☆星空物语☆  阅读(465)  评论(0编辑  收藏  举报