windows 2008 server 64位添加数据库监听

文档课题:windows 2008 server 64位添加数据库监听
系统:windows 2008 server r2 64位
数据库:oracle 11.2.0.1
1、tnsnames.ora
修改tnsnames.ora文件.
# tnsnames.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1521))

LISTENER2 =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1561))


ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
说明:蓝色高亮为新增部分.
2、local_listener
修改local_listener.
SQL> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1521))','(ADDRESS = (PR
OTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1561))';
SQL> show parameter list

NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
listener_networks string
local_listener string (ADDRESS = (PROTOCOL = TCP)(HO
ST = 192.168.133.192)(PORT = 1
521)), (ADDRESS = (PROTOCOL =
TCP)(HOST = 192.168.133.192)(P
ORT = 1561))
remote_listener string
3、listener.ora
修改listener.ora文件.
3.1、原信息
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = D:\app\Administrator
3.2、LISTENER2
添加LISTENER2监听.

windows 2008 server 64位添加数据库监听

windows 2008 server 64位添加数据库监听

windows 2008 server 64位添加数据库监听

3.3、查看listener.ora
添加listener2之后,查看listener.ora文件.
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

LISTENER2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-9EU17D7KKMU)(PORT = 1561))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)

ADR_BASE_LISTENER2 = D:\app\Administrator\product\11.2.0\dbhome_1\log

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.192)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = D:\app\Administrator

说明:蓝色高亮为新增部分.此处测试将“ADR_BASE_LISTENER2 = D:\app\Administrator\product\11.2.0\dbhome_1\log”修改为“ADR_BASE_LISTENER2 = D:\app\Administrator”后能通过新增加监听连接数据库.
4、listener2使用
使用新创建的监听连接数据库.
4.1、启动新监听
C:\Users\Administrator>lsnrctl start listener2

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 20-9月 -2022 12:58:39

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

启动tnslsnr: 请稍候...

TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
写入d:\app\administrator\product\11.2.0\dbhome_1\log\diag\tnslsnr\WIN-9EU17D7KKMU\listener2\alert\log.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WIN-9EU17D7KKMU)(PORT=1561)))

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=WIN-9EU17D7KKMU)(PORT=1561)))
LISTENER 的 STATUS
------------------------
别名 listener2
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 20-9月 -2022 12:58:44
正常运行时间 0 天 0 小时 0 分 5 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 d:\app\administrator\product\11.2.0\dbhome_1\log\diag\tnslsnr\WIN-9EU17D7KKMU\listener2\alert\
log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WIN-9EU17D7KKMU)(PORT=1561)))
监听程序不支持服务
命令执行成功
C:\Users\Administrator>lsnrctl status listener2

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 20-9月 -2022 13:01:16

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

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=WIN-9EU17D7KKMU)(PORT=1561)))
LISTENER 的 STATUS
------------------------
别名 listener2
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 20-9月 -2022 12:58:44
正常运行时间 0 天 0 小时 2 分 35 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 d:\app\administrator\product\11.2.0\dbhome_1\log\diag\tnslsnr\WIN-9EU17D7KKMU\listener2\alert\log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WIN-9EU17D7KKMU)(PORT=1561)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.133.192)(PORT=1561)))
服务摘要..
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
4.2、使用新监听
C:\Users\Administrator>sqlplus sys/oracle_4U@192.168.133.192:1561/orcl as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 9月 20 13:02:28 2022

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


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
结论:可以看到使用新监听成功连接.