jdbc連接oracle報錯信息:
oracle ORA-12514:TNS:listener does not currently know of service requested in connect descriptor
[oracle@abc samples]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-OCT-2019 14:38:34
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS:operate timed out
...
...
...
發現監聽沒有啓動成功。
原因是我修改了虛擬機的ip地址,原先的虛擬機ip地址是192.168.100.100,後來更改爲192.168.1.100
#su - root
[root@abc samples]$ vi /etc/hosts
192.168.100.100 abc
修改爲本機的ip地址
192.168.1.100 abc
重啓數據庫
SQL>shutdown immediate
...
...
...
SQL>startup
Total System Global Area .....
Fixed Size ...
...
...
Database opened.
重啓監聽
[oracle@abc samples]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-OCT-2019 14:38:34
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 28-OCT-2019 14:30:18
Uptime 0 days 0 hr. 8 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/abc/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=abc)(PORT=1521)))
The listener supports no services
The command completed successfully
注意:
這裏The listener supports no services ,一定要看一下監聽狀態,
有可能開了監聽,不可能立刻返回結果
也有可能是動態監聽,也不會立刻返回,本例就是動態監聽
查看狀態
[oracle@abc samples]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-OCT-2019 14:38:34
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 28-OCT-2019 14:30:18
Uptime 0 days 0 hr. 8 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/abc/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=abc)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "test" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@abc samples]$