一、問題出現如下:
[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用戶
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
# 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 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
