In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what to do if the oracle client cannot connect after modifying hostname". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Oracle11g has just been installed in the virtual machine centos7, and everything is fine before restarting.
After restarting, it was found that the client could not connect to the database.
SQL*Plus: Release 11.2.0.1.0 Production on Friday November 16 15:05:18 2018Copyright (c) 1982, 2010, Oracle. All rights reserved. Please enter user name: system@orcl enter password: ERROR:ORA-12541: TNS: no listener
Log in to the server to check the listening status
[root@lzr] # lsnrctl statusLSNRCTL for Linux: Version 11.2.0.1.0-Production on 16-NOV-2018 15:07:55Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0-ProductionStart Date 16-NOV-2018 15:00:14Uptime 0 days 0 hr. 7 min. 45 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / data/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File / data/oracle/diag/tnslsnr/lzr/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=127.0.0.1) (PORT=1521)) Services Summary...Service "ORCL" has 1 instance (s). Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service...The command completed successfully
The ORCL status of the instance is UNKNOWN, which I don't quite understand. After a while, Baidu
Solution.
Found that there may be something wrong with hostname.
I used the command before rebooting.
# hostnamectl set-hostname lzr
Modified hostname
Open / etc/hosts to check first.
[root@lzr ~] # vi / etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Host file interpretation
Add a new line
[root@lzr ~] # vi / etc/hosts127.0.0.1 lzr127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Then wq saves and exits
Now I will restart the database
[root@lzr] # sqlplusSQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 16 15:25:52 2018Copyright (c) 1982, 2009, Oracle. All rights reserved.Enter user-name: sys as sysdbaEnter password:Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL > startupORACLE instance started.Total System Global Area 1185853440 bytesFixed Size 2212776 bytesVariable Size 738200664 bytesDatabase Buffers 436207616 bytesRedo Buffers 9232384 bytesDatabase mounted.Database opened.
Then restart the monitor to check the status
[root@lzr] # lsnrctlLSNRCTL for Linux: Version 11.2.0.1.0-Production on 16-NOV-2018 15:31:17Copyright (c) 1991, 2009, Oracle. All rights reserved.Welcome to LSNRCTL Type "help" for information.LSNRCTL > stopConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)) The command completed successfullyLSNRCTL > startStarting / data/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.1.0-ProductionSystem parameter file is / data/oracle/product/11.2.0/db_1/network/admin/listener.oraLog messages written to / data/oracle/diag/tnslsnr/lzr/listener/alert/log.xmlListening On: (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=lzr) (PORT=1521)) Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0-ProductionStart Date 16-NOV-2018 15:31:21Uptime 0 days 0 hr. 0 min. 5 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / data/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File / data/oracle/diag/tnslsnr/lzr/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=lzr) (PORT=1521)) Services Summary...Service "ORCL" has 1 instance (s). Instance "ORCL", status UNKNOWN Has 1 handler (s) for this service...The command completed successfullyLSNRCTL > statusConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0-ProductionStart Date 16-NOV-2018 15:31:21Uptime 0 days 0 hr. 0 min. 8 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / data/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File / data/oracle/diag/tnslsnr/lzr/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=lzr) (PORT=1521)) Services Summary...Service "ORCL" has 1 instance (s). Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service...The command completed successfully
There seems to be no change from before.
Register the monitor in the database
[root@lzr] # sqlplusSQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 16 15:32:54 2018Copyright (c) 1982, 2009, Oracle. All rights reserved.Enter user-name: sys as sysdbaEnter password:Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > alter system register 2; System altered.
Come out again to check the monitoring status.
[root@lzr] # lsnrctlLSNRCTL for Linux: Version 11.2.0.1.0-Production on 16-NOV-2018 15:33:35Copyright (c) 1991, 2009, Oracle. All rights reserved.Welcome to LSNRCTL, type "help" for information.LSNRCTL > statusConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0-ProductionStart Date 16-NOV-2018 15:31:21Uptime 0 days 0 hr. 2 min. 15 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / data/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File / data/oracle/diag/tnslsnr/lzr/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=lzr) (PORT=1521)) Services Summary...Service "ORCL" has 2 instance (s). Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service... 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
Looks normal, status ready.
Now go back to the client and test the connection.
C:\ Users\ lzr > sqlplusSQL*Plus: Release 11.2.0.1.0 Production on Friday November 16 15:34:10 2018Copyright (c) 1982, 2010, Oracle. All rights reserved. Please enter user name: system@orcl input password: connect to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > show userUSER is "SYSTEM"
You can use the client connection normally.
This is the end of the content of "what to do if the oracle client cannot connect after modifying hostname". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.