6

我在 Ubuntu 12.4 中安装了 Oracle 11g XE,并且在让 Oracle 绑定到 TCP 端口时遇到了困难。IP6 绑定似乎很好,但 IP4 (tcp 0.0.0.0:1521) 不行。

这是 oracle-xe 的状态:

root@pearBox:~# /etc/init.d/oracle-xe status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 06-JUN-2013 15:08:34

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                06-JUN-2013 15:06:42
Uptime                    0 days 0 hr. 1 min. 52 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/pearBox/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=pearBox)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=pearBox)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

网络统计结果:

root@pearBox:~# netstat -ntpl

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      914/mysqld      
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1859/apache2    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      608/sshd        
tcp6       0      0 :::22447                :::*                    LISTEN      1757/xe_d000_XE 
tcp6       0      0 :::8080                 :::*                    LISTEN      1655/tnslsnr    
tcp6       0      0 :::1521                 :::*                    LISTEN      1655/tnslsnr    
tcp6       0      0 :::22                   :::*                    LISTEN      608/sshd 

和监听器配置:

root@pearBox:~# cat /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
# listener.ora Network Configuration File:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = pearBox)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

我将主机名更改为“HOST = 127.0.0.1”,它绑定到 localhost,但我无法从网络访问 Oracle 实例!

root@pearBox:~# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      914/mysqld      
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1859/apache2    
tcp        0      0 127.0.0.1:1521          0.0.0.0:*               LISTEN      2339/tnslsnr    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      608/sshd        
tcp6       0      0 :::21121                :::*                    LISTEN      2443/xe_d000_XE 
tcp6       0      0 :::22 

如果您能帮助解决这个问题,我将不胜感激。

4

3 回答 3

9

刚找到这个帖子,我也遇到了同样的问题。这是安装后更改主机名的结果。我能够通过更新两个主机名来纠正这种情况:

/u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora

/u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora

于 2015-05-03T22:10:42.640 回答
2

我建议看一下防火墙规则-> https://help.ubuntu.com/12.04/serverguide/firewall.html

于 2014-11-25T17:03:05.670 回答
0

更改主机名对我有用,因为我通过检查发现不匹配:

  1. unname -a
  2. 监听器日志:log.xml
  3. /etc/hosts

我在域中添加了完整的主机名

感谢您的帮助,因为我在获得此参考之前已经搜索了一周的互联网帖子。

于 2016-01-04T20:46:50.343 回答