热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

默认及非默认端口的动态监听/静态监听实验汇总

步骤大致是:1.配置一个非默认的动态监听,运行在1525端口2.默认动态监听同时要运行3.配置一个静态监听,运行在1526端口4.打开这些监听,并使用sqlplus登陆测试数据库内一些参数:SYS@bys3showparameterserviceNAMETYPEVALUE--------------------

步骤大致是:1.配置一个非默认的动态监听,运行在1525端口 2.默认动态监听同时要运行 3.配置一个静态监听,运行在1526端口 4.打开这些监听,并使用sqlplus登陆测试 数据库内一些参数: SYS@ bys3show parameter service NAME TYPE VALUE --------------------

步骤大致是:1.配置一个非默认的动态监听,运行在1525端口
2.默认动态监听同时要运行
3.配置一个静态监听,运行在1526端口
4.打开这些监听,并使用sqlplus登陆测试


数据库内一些参数:
SYS@ bys3>show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string bys3
SYS@ bys3>show parameter db_na
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string bys3
SYS@ bys3>show parameter db_unique
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string bys3
SYS@ bys3>show parameter db_domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string
SYS@ bys3>show parameter instance_na

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string bys3
关于这几个参数的设置及替换,详见:ORACLE监听之动态监听与静态监听特点

配置默认及非默认动态监听

1.配置listener.ora,增加非默认动态监听的地址、端口条目

[oracle@bys3 admin]$ more 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 = bys3.bys.com)(PORT = 1525))
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))
)
)

ADR_BASE_LISTENER = /u01

2.在数据库中配置 local_listener参数,语句如下:--就是把listener.ora中的几行复制过来,注意换行的括号不要少了。

alter system set local_listener='(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1525))
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521)))';
SYS@ bys3>alter system register; --手动注册,或者等上一分钟,让PMON自动进行动态监听注册。

3.查看监听状态,动态监听已经注册成功:

[oracle@bys3 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-JAN-2014 22:20:16
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1525)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 14-JAN-2014 22:02:22
Uptime 0 days 0 hr. 17 min. 54 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/diag/tnslsnr/bys3/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1525)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
Services Summary...
Service "bys3" has 1 instance(s).
Instance "bys3", status READY, has 1 handler(s) for this service...
The command completed successfully

4.使用SQLPLUS进行登陆测试:

[oracle@bys3 admin]$ cat tnsnames.ora
bys3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT =1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bys3)
)
)
test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT =1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bys3)
)
)
[oracle@bys3 admin]$ tnsping test
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 14-JAN-2014 22:30:42
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT =1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bys3)))
OK (0 msec)
[oracle@bys3 admin]$ tnsping bys3
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 14-JAN-2014 22:30:46
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT =1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bys3)))
OK (10 msec)
[oracle@bys3 admin]$ sqlplus bys/bys@bys3
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 14 22:32:02 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
BYS@ bys3>exit

[oracle@bys3 admin]$ sqlplus bys/bys@test
BYS@ test>exit
###############################################################

配置静态监听:

1.配置listener.ora,增加相应条目

[oracle@bys3 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 = bys3.bys.com)(PORT = 1525))
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))
)
)

l3 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1526))
)
)
SID_LIST_l3=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=bys9)
(SID_NAME=bys3)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)))
ADR_BASE_LISTENER = /u01

2.启动监听,查看状态:

[oracle@bys3 ~]$ lsnrctl status l3
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-JAN-2014 22:19:49
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias l3
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 14-JAN-2014 22:15:15
Uptime 0 days 0 hr. 4 min. 34 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/diag/tnslsnr/bys3/l3/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1526)))
Services Summary...
Service "bys9" has 1 instance(s).
Instance "bys3", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
#################

3.使用SQLPLUS进行登陆测试

[oracle@bys3 admin]$ cat tnsnames.ora
test9 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT =1526))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bys9)
)
)
[oracle@bys3 ~]$ tnsping test9
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 14-JAN-2014 22:37:56
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT =1526))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bys9)))
OK (10 msec)
[oracle@bys3 ~]$ sqlplus bys/bys@test9
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 14 22:38:05 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
BYS@ test9>

推荐阅读
author-avatar
汽车一族coolboy_518
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有