1.数据库正常启动:
[oracle@db ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 24 12:09:04 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 964546560 bytes
Fixed Size 2259080 bytes
Variable Size 570427256 bytes
Database Buffers 385875968 bytes
Redo Buffers 5984256 bytes
Database mounted.
Database opened.
SQL> select status from v$instance;
STATUS
------------
OPEN
2.这时用TOAD去连接数据库发现无TNS服务,应该就是没有开
3.开启监听发现一直卡住,最后报TNS错
[oracle@db ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-AUG-2019 12:11:44
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/db/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out
无论是执行lsnrctl stop,lsnrctl reload,lsnrctl stop一直都是卡住最后报错,最后做重新配置,奇怪的是在删除原有的监听那一步就一直是卡住,最后弹出error
这让我很匪夷所思,万能的重启重建都失灵了。。。数据库重启也是一样,监听文件进行删除重建还是一个样,草民很是难过。。。
查看了监听日志大小,这数据库一直处于空闲状态,按理说监听日志应该很小,但不放过任何一个细节,结果没啥发现:
[oracle@db trace]$ pwd
/u01/app/oracle/diag/tnslsnr/db/listener/trace
[oracle@db trace]$ ls
listener.log
[oracle@db trace]$ du -h
3.0M .
[oracle@db trace]$
仔细看了之前发现一个关键点:
为啥这里没有显示主机名或IP,难道是主机名个主机IP的映射关系出错了,结果果然,IP已是192.168.43.20,但HOSTS文件没有同步。
改后:
监听正常启动
[oracle@db ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-AUG-2019 12:28:24
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 24-AUG-2019 12:28:16
Uptime 0 days 0 hr. 0 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/db/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@db ~]$ clear
[oracle@db ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-AUG-2019 12:28:47
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 24-AUG-2019 12:28:16
Uptime 0 days 0 hr. 0 min. 31 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/db/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@db ~]$
Toad 正常连接: