一、问题出现如下:
[oracle@orcltest ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-DEC-2015 08:33:19
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcltest.localdomain)(PORT=1521))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused
二、解决问题思路:
1.需要修改地址,切换root用户
在/etc/目录下,命令:vi hosts,内容如下:
[root@orcltest etc]$ vi hosts
127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.2.127 orcltest.localdomain orcltest
将hosts文件上的192.168.2.127改为192.168.2.145
保存并退出!
2.查看参数,切换oracle用户
连接数据库,命令:sqlplus / as sysdba
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter LIS
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ listener_networks string local_listener string recovery_parallelism integer 0 remote_listener string
SQL> exit
三、OK
切换oracle用户
[oracle@orcltest ~]$ lsnrctl start
--启动监听
[oracle@orcltest ~]$ lsnrctl status
--查看监听状态
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-DEC-2015 08:57:52
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcltest.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 17-DEC-2015 08:39:47
Uptime 0 days 0 hr. 18 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0
home_1/network/admin
stener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/orcltest
stener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=orcltest.localdomain)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
--监听中
The command completed successfully
四、连接PLSQL Developer时,也对应将IP修改
修改文件所在目录:..\PLSQL Developer\instantclient_11_2\network\admin
listener.ora文件,内容显示:
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.127)(PORT = 1521)) ) )ADR_BASE_LISTENER = /u01/app/oracle
将192.168.2.127改成192.168.2.145
tnsnames.ora文件,内容显示:
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.127)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
将192.168.2.127改成192.168.2.145
|