修改主机名后导致甲骨文客户端无法连接怎么办

  介绍

本篇内容介绍了“修改主机名后导致甲骨文客户端无法连接怎么办”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

虚拟机centos7中刚装了oracle11g,没重启前一切正常

重启后发现客户端无法连接到数据库了

 SQL * +:, Release  11.2.0.1.0  Production 提醒星期五,11月,16 15:05:18  2018
  Copyright  (c), 1982年,2010年,甲骨文只All  rights 保留。
  请输入用户名:system@orcl
  输入口令:
  错误:
  ora - 12541:, TNS:无监听程序

登陆服务器看一下监听状态

 [root@lzr  ~] #, lsnrctl 状态
  LSNRCTL  for  Linux: Version  11.2.0.1.0 作用;Production 提醒16 - 11月- 2018 15:07:55
  Copyright  (c), 1991年,2009年,甲骨文只All  rights 保留。
  Connecting 用(描述=(地址==(协议TCP)(主机=localhost)(端口=1521)))
  STATUS  of 从而侦听器
  ------------------------
  Alias ,,,,,,,,,,,,,,,,,,,侦听器
  Version ,,,,,,,,,,,,,,,,,, TNSLSNR  for  Linux: Version  11.2.0.1.0 作用;生产
  Start  Date ,,,,,,,,,,,,,,, 11月16 - - 2018 15:00:14
  Uptime ,,,,,,,,,,,,,,,,,,, 0, days  0,人力资源只7,最小值只45秒
  Trace  Level ,,,,,,,,,,,,,,
  Security ,,,,,,,,,,,,,,,,,:, Local  OS 身份验证
  SNMP ,,,,,,,,,,,,,,,,,,,,,
  Listener  Parameter  File ,,/数据/oracle/产品/11.2.0/db_1/网络/admin/listener.ora
  Listener  Log  File ,,,,,,,,/数据/oracle/诊断接头//警告/log.xml tnslsnr/lzr/侦听器
  Listening  Endpoints 总结……
  (描述才能=(地址==(协议tcp)(主机=127.0.0.1)(端口=1521)))
  Services 总结…
  Service “ORCL", has  1,实例(s)。
  Instance 才能“ORCL",, status 未知,,has  1,处理程序(s), for 却;能够服务……
  成功,command  completed  

实例ORCL状态为未知,有点不太懂了,百度了一下之后

解决办法      ,,

发现可能是主机名出现了问题

我在重启之前用命令

 # hostnamectl  set-hostname  lzr 

修改过主机名

先打开/etc/主机检查一下

 [root@lzr  ~] #, vi /etc/主机
  127.0.0.1 ,, localhost  localhost.localdomain  localhost4  localhost4.localdomain4
  ::1,,,,,,,,,localhost  localhost.localdomain  localhost6  localhost6.localdomain6 

主机文件解释

添加新的一行

 [root@lzr  ~] #, vi /etc/主机
  127.0.0.1 , lzr
  127.0.0.1 ,, localhost  localhost.localdomain  localhost4  localhost4.localdomain4
  ::1,,,,,,,,,localhost  localhost.localdomain  localhost6  localhost6.localdomain6 

然后wq保存退出

现在我将数据库重启

 [root@lzr  ~] #, sqlplus
  SQL * +: Release  11.2.0.1.0  Production 提醒Fri  Nov  16 15:25:52  2018
  Copyright  (c), 1982年,2009年,甲骨文只All  rights 保留。
  Enter 用户名:sys  as  sysdba
  Enter 密码:
  Connected :
  Oracle  Database  11 g  Enterprise  Edition  Release  11.2.0.1.0 作用;64 bit 生产
  With 从而,分区,OLAP,, Data  Mining 以及Real  Application  Testing 选项
  完成shutdown 立即
  Database 关闭。
  Database 下马。
  ORACLE  instance  shut 下来。
  完成启动
  ORACLE  instance 开始。
  Total  System  Global  Area  1185853440字节
  Fixed  Size ,,,,,,,,,,,,,,,,, 2212776字节
  Variable  Size ,,,,,,,,,,,, 738200664字节
  Database  Buffers ,,,,,,,,, 436207616字节
  Redo  Buffers ,,,,,,,,,,,,,,, 9232384字节
  Database 安装。
  Database 打开。

再将监听重启,查看状态

 [root@lzr  ~] #, lsnrctl
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null

修改主机名后导致甲骨文客户端无法连接怎么办