oracle服务器配置端口,服务端配置一个多端口号(如1521/1526)监听器

服务端的监听器有多种配置方法:1、默认的情况下是一个监听器一个端口,这个时候,

不需要在tnsnames.ora文件里解析监听器信息;2、多个监听器多个端口(端口号可以相同),

这时候,需要在tnsnames.ora文件里解析监听器信息;3、一个监听器多个端口号的监听器,

这时候同样需要在tnsnames.ora文件里解析监听器信息。

以下是测试第3种情况的过程:

----配置多端口号的监听器:

---配置服务端listener.ora文件:

[oracle@enmo admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1521))

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1526))

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1526))

)

)

---配置服务端tnsnames.ora文件:

[oracle@enmo admin]$ cat tnsnames.ora

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1521))

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1526))

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1526))

)

)

[oracle@enmo admin]$

#配置服务端tnsnames.ora文件是为了解析服务端LISTENER 监听器有两个端口号。

---在数据库修改本地的监听器:

sys@PROD>alter system set local_listener='LISTENER';

System altered.

#修改成功。

---启动服务器端的监听器:

LSNRCTL> start

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/enmo/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1526)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1526)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                03-DEC-2016 23:34:15

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/enmo/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1526)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1526)))

The listener supports no services

The command completed successfully

LSNRCTL>

LSNRCTL>

---把数据库主动注册到监听器:

sys@PROD>alter system register;

System altered.

sys@PROD>/

#注册完成。

---注册数据库后查看监听器的状态:

LSNRCTL> status

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                03-DEC-2016 23:34:15

Uptime                    0 days 0 hr. 0 min. 28 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/enmo/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1526)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1526)))

Services Summary...

Service "PROD" has 1 instance(s).

Instance "PROD", status READY, has 1 handler(s) for this service...

Service "PRODXDB" has 1 instance(s).

Instance "PROD", status READY, has 1 handler(s) for this service...

The command completed successfully

LSNRCTL>

---Windows客户端通过EZCONNECT使用1521端口连接服务端数据库测试:

C:\Users\Asus>sqlplus sys/oracle@192.168.2.6:1521/PROD as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on星期六12月3 23:58:14 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

SQL>

SQL> show parameter service

NAME                                 TYPE

------------------------------------ ----------------------

VALUE

------------------------------

service_names                        string

PROD

#连接成功,证明多端口的监听器配置成功。

---Windows客户端通过EZCONNECT使用1526端口连接服务端数据库测试:

C:\Users\Asus>sqlplus sys/oracle@192.168.2.6:1526/PROD as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on星期日12月4 00:00:17 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter service

NAME                                 TYPE

------------------------------------ ----------------------

VALUE

------------------------------

service_names                        string

PROD

#连接成功,证明多端口的监听器配置成功。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值