为什么Oracle侦听器和数据库服务没有运行?

时间:2016-08-17 19:17:11

标签: oracle11g redhat

我刚开始尝试使用Red Hat Linux 7.2和Oracle 12c。所以我上周末花了很多时间试图看看我是否可以在RHEL 7.2上站起来Oracle 12c。最后,是的,我能够在RHEL 7.2 VM上站起来,但不是没有问题 - 很多。但我设法解决了 他们一次一个。我吹走了我的虚拟机,并从头开始重新开始。

现在我觉得我有一个非常好的设置&运行。我唯一不理解的是当我重新启动Linux机器时,Oracle列表器和数据库服务都不会像在Windows Server 2012 R2系统上那样自动启动。如果这些服务没有运行,我自然无法连接 到Oracle DB。要修复它,我必须运行这两个命令:

  1. 以oracle用户身份登录

  2. 运行lsnrctl start

    我会看到类似的消息:监听器不支持任何服务  这很好。

  3. 连接数据库并运行

    SQL>启动

  4. 之后,一切正常运行。我可以从任何Oracle客户端连接到Oracle数据库。我的问题是:这是Linux机箱上的正常行为吗?我在Oracle安装过程中遗漏了什么?如果这些服务应该自动启动,我需要做些什么才能解决这个问题?

    谢谢。

2 个答案:

答案 0 :(得分:0)

您应该检查侦听器日志以获取详细信息。

使用以下命令查找侦听器日志位置:

$file

答案 1 :(得分:0)

此错误解决方案非常简单,首先,让我们理解为什么会出现此错误。它基本上有两个原因:

1)您的数据库和服务名称在Oracle环境中没有正确设置它应该在任何地方检查下面的参数值

-ORACLE_SID in oracle environment.
-SID_NAME in tnsnames.ora file.
-SERVICE_NAME in listener.ora file.

2)主机名/ IP地址丢失,不正确或拼写错误,请查看以下内容。

-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.

现在看到我也面临同样的问题并解决了:

[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驱动程序进行了一些更改。

[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]$ 

现在它对我来说运行正常,我希望它会有所帮助。

谢谢!