Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2388423
  • 博文数量: 384
  • 博客积分: 10193
  • 博客等级: 上将
  • 技术积分: 3785
  • 用 户 组: 普通用户
  • 注册时间: 2005-06-09 18:02
文章分类

全部博文(384)

文章存档

2011年(10)

2010年(29)

2009年(39)

2008年(36)

2007年(43)

2006年(198)

2005年(29)

分类: Oracle

2006-07-15 10:33:26

默认情况下,  oracle listener监听1521 端口接受客户端对数据库的访问, 使用lsnrctl stat可以查看当前监听器的情况:

oracle@blueice:~/product/9.2.0/network/admin$ lsnrctl start

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 15-JUL-2006 09:31:16

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Starting /home/oracle/product/9.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 9.2.0.4.0 - Production
System parameter file is /home/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /home/oracle/product/9.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                15-JUL-2006 09:31:16
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))
Services Summary...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
oracle@blueice:~/product/9.2.0/network/admin$ lsnrctl stat

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 15-JUL-2006 09:31:19

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                15-JUL-2006 09:31:16
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))
Services Summary...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

使用root用户运行netstat -lnp|grep tns可以看到当前listener监听的端口
 
blueice:/home/oracle/product/9.2.0# netstat -lnp|grep tns
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN     10583/tnslsnr
unix  2      [ ACC ]     STREAM     LISTENING     88815    10583/tnslsnr       /var/tmp/.oracle/s#10583.1


数据库启动后, oracle listener增加了XDB的监听端口, lsnrctl stat结果如下

blue_stone@blueice:~$ lsnrctl stat

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 15-JUL-2006 09:34:29

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                15-JUL-2006 09:31:16
Uptime                    0 days 0 hr. 3 min. 12 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=8080))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=2100))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, 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

root用户运行netstat -lnp|grep tns结果如下

blueice:/home/oracle/product/9.2.0# netstat -lnp|grep tns
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN     10583/tnslsnr
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN     10583/tnslsnr
tcp        0      0 0.0.0.0:2100            0.0.0.0:*               LISTEN     10583/tnslsnr
unix  2      [ ACC ]     STREAM     LISTENING     88815    10583/tnslsnr       /var/tmp/.oracle/s#10583.1

但是有些情况下, 我们并不希望8080或者2100端口被oracle使用, 这就需要修改修改oracle XDB的监听端口来达到这样的目标.

在linux下使用ftp databasehost 2100联接到oracle, 在windows下可以使用ftp://databasehost:2100/联接到oracle, 输入用户名system, 密码system的密码. 下载xdbconfig.xml文件, 使用兼容unix的编辑工具如vi或者写字板对这个文件进行修改, 如需修改ftp监听端口, 则修改

     
        2100
        local_listener
        tcp
        6000
     


中的2100为目的端口. 如许修改http监听的端口则修改

     
        8080
        local_listener
        tcp
        6000
        XDB HTTP Server
        16384


中的8080为目的端口. 修改完毕后, 上传回原来的位置. 比如我们将http监听的端口修改为8081后, 使用lsnrctl和netstat -lnp|grep tns结果如下

blue_stone@blueice:~$ lsnrctl stat

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 15-JUL-2006 09:46:06

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                15-JUL-2006 09:31:16
Uptime                    0 days 0 hr. 14 min. 50 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=2100))(Presentation=FTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=8081))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, 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

blueice:/home/oracle/product/9.2.0# netstat -lnp|grep tns
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN     10583/tnslsnr
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN     10583/tnslsnr
tcp        0      0 0.0.0.0:2100            0.0.0.0:*               LISTEN     10583/tnslsnr
unix  2      [ ACC ]     STREAM     LISTENING     88815    10583/tnslsnr       /var/tmp/.oracle/s#10583.1

监听的端口已经发生了改变. 

也可以使用SYSTEM用户登录运行如下语句修改http, ftp端口

BEGIN
DBMS_XDB.CFG_UPDATE(UPDATEXML(DBMS_XDB.CFG_GET(),'/xdbconfig/descendant::ftp-port/text()','2121'));
DBMS_XDB.CFG_UPDATE(UPDATEXML(DBMS_XDB.CFG_GET(),'/xdbconfig/descendant::http-port/text()','8085'));
DBMS_XDB.CFG_REFRESH();
END;


但我在运行上面语句的时候提示PLS-00201: identifier 'UPDATEXML' must be declared
原因未知.

如果不需要使用xml db, 也可以删除xdb用户, 使oracle不监听http和ftp端口

drop user xdb cascade;

阅读(4912) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~