问题描述
我刚刚开始接触 Red Hat Linux 7.2 和 Oracle 12c.所以我上周末花了很多时间,试图看看我是否可以在 RHEL 7.2 上支持 Oracle 12c.最后,是的,我能够在 RHEL 7.2 VM 上支持 Oracle,但并非没有问题——很多问题.但我设法解决他们一次一个.我炸毁了我的虚拟机,然后重新从头开始.
I am just starting to get my feet wet in Red Hat Linux 7.2 and Oracle 12c. So I spent last weekend devoted to in an attempt to see if I could stand up Oracle 12c on RHEL 7.2. In the end and yes, I was able to stand up Oracle on a RHEL 7.2 VM but not without problems - a lot of them. But I managed to resolvethem one at a time. I blew away my VM and started everything from scratch again.
现在我觉得我有一个很好的设置 &跑步.我唯一不明白的是,当我重新启动 Linux 机器时,Oracle 侦听器和数据库服务都不会像在 Windows Server 2012 R2 系统上那样自动启动.如果这些服务都没有运行,自然连接不上到 Oracle 数据库.要修复它,我必须运行以下两个命令:
Now I think I have a pretty good setup up & running. The only thing I don't understand is when I reboot my Linux box, both the Oracle listner and the database service do not start automatically as they do on a Windows Server 2012 R2 system. If these services are not running, naturally I can't connectto the Oracle DB. To fix it, I have to run these two commands:
以 oracle 用户身份登录
Logon as the oracle user
运行 lsnrctl start
Run lsnrctl start
我会看到类似这样的消息:侦听器不支持任何服务这很好.
I will see a message something like: The listener supports no services This is fine.
连接到数据库并运行
sql>启动
在那之后,一切都正常运行.我可以从任何 Oracle 客户端连接到 Oracle 数据库.我的问题是:这是 Linux 机器上的正常行为吗?我在 Oracle 安装过程中是否遗漏了什么?如果这些服务应该自动启动,我需要做些什么来解决这个问题?
After that, everything is running as normal. I can connect to the Oracle db from any Oracle client. My questions are: Is this the normal behavior on a Linux box? Did I miss something during the Oracle install? If these services are supposed to start automatically, what do I need to do to fix this?
谢谢.
推荐答案
这个错误的解决方法很简单,首先我们来了解一下为什么会出现这个错误.它基本上有两个原因:
This error solution is very simple, first, let's understand why this error occurs. It basically has two reasons which are:
1) 您的数据库和服务名称在 Oracle 环境中设置不正确它应该是相同的,请检查以下参数值
1) Your database and service name is not properly set in Oracle environment it should be same everywhere check below parameter values
-ORACLE_SID in oracle environment.
-SID_NAME in tnsnames.ora file.
-SERVICE_NAME in listener.ora file.
2) 主机名/IP 地址缺失、不正确或拼写错误,请检查以下内容.
2) Host name/IP address is missing, not correct or spelling mistake, so please check the below.
-Check the IP ADDRESS in /etc/hosts file.
-It should be same in listener.ora and tnsnames.ora file
-And it should be able to ping from the local and remote server.
现在看到我也遇到了同样的问题并已解决:
Now see I've also faced the same problem and resolved:
[oracle@OLE1 Desktop]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 12 22:52:29 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 970895360 bytes
Fixed Size 1340636 bytes
Variable Size 713034532 bytes
Database Buffers 251658240 bytes
Redo Buffers 4861952 bytes
Database mounted.
Database opened.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@OLE1 Desktop]$
[oracle@OLE1 Desktop]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2017 22:54:51
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ole1)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
LSNRCTL> LSNRCTL> start
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1//bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2017 22:55:43
Uptime 0 days 0 hr. 0 min. 23 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> [oracle@OLE1 Desktop]$
[oracle@OLE1 Desktop]$
[oracle@OLE1 Desktop]$ echo $ORACLE_SID
orcl
[oracle@OLE1 Desktop]$
[oracle@OLE1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ole1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
[oracle@OLE1 admin]$
[oracle@OLE1 admin]$ cat listener.ora
# listener.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ole1 )(PORT = 1521))
)
)
ADR_BASE_LISTENER = /home/oracle/app/oracle
[oracle@OLE1 admin]$
[oracle@OLE1 admin]$ cat /etc/hosts
127.0.0.1 localhost
::1 localhost
192.168.244.128 ole1
[oracle@OLE1 admin]$
[oracle@OLE1 ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2017 22:57:14
Copyright (c) 1997, 2009, Oracle. All rights reserved.
Used parameter files:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ole1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
TNS-12541: TNS:no listener
[oracle@OLE1 ~]$
[oracle@OLE1 ~]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2017 23:01:48
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL>
LSNRCTL>
LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
LSNRCTL>
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2017 22:55:43
Uptime 0 days 0 hr. 6 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
LSNRCTL> start
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1//bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2017 23:03:10
Uptime 0 days 0 hr. 0 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL>
[oracle@OLE1 ~]$
[oracle@OLE1 ~]$
[oracle@OLE1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 12 23:04:37 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
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> select name from v$database;
NAME
---------
ORCL
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@OLE1 ~]$
[oracle@OLE1 admin]$ cat /etc/hosts
127.0.0.1 localhost
::1 localhost
192.168.244.128 ole1
[oracle@OLE1 admin]$ ping ole1
PING ole1 (192.168.244.128) 56(84) bytes of data.
^C
--- ole1 ping statistics ---
14 packets transmitted, 0 received, 100% packet loss, time 13710ms
[oracle@OLE1 admin]$
注意:现在我发现IP地址配置的问题无法ping通,所以我在VMware机器上对我的操作系统的eth1驱动程序进行了一些更改.
Note: Now here I found the problem in IP address configuration its not pinging, So i did some changes in eth1 driver of my OS in VMware machine.
[oracle@OLE1 admin]$ ping ole1
PING ole1 (192.168.244.128) 56(84) bytes of data.
64 bytes from ole1 (192.168.244.128): icmp_seq=1 ttl=64 time=0.694 ms
64 bytes from ole1 (192.168.244.128): icmp_seq=2 ttl=64 time=0.187 ms
64 bytes from ole1 (192.168.244.128): icmp_seq=3 ttl=64 time=4.96 ms
64 bytes from ole1 (192.168.244.128): icmp_seq=4 ttl=64 time=0.121 ms
64 bytes from ole1 (192.168.244.128): icmp_seq=5 ttl=64 time=0.082 ms
64 bytes from ole1 (192.168.244.128): icmp_seq=6 ttl=64 time=0.166 ms
64 bytes from ole1 (192.168.244.128): icmp_seq=7 ttl=64 time=0.126 ms
^C
--- ole1 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6996ms
rtt min/avg/max/mdev = 0.082/0.905/4.963/1.668 ms
[oracle@OLE1 admin]$
[oracle@OLE1 admin]$
[oracle@OLE1 admin]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2017 23:09:37
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
LSNRCTL>
LSNRCTL>
LSNRCTL> start
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1//bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2017 23:09:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL>
LSNRCTL>
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2017 23:09:45
Uptime 0 days 0 hr. 2 min. 17 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/OLE1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ole1)(PORT=1521)))
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@OLE1 admin]$
[oracle@OLE1 admin]$
[oracle@OLE1 admin]$ sqlplus scott/tiger@orcl
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 13 00:15:48 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
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>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@OLE1 admin]$
现在它对我来说运行良好,我希望它会有所帮助.
Now it's running fine for me, I hope it will help.
谢谢!
这篇关于为什么 Oracle 侦听器和数据库服务没有运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!