在Oracle 10g环境下搭建数据库监听,可以按照以下步骤进行:
1、配置监听器参数文件
需要创建一个监听器参数文件,在Oracle安装目录下的networkadmin
文件夹中,创建一个新的文本文件,例如listener.ora
,并编辑该文件,添加以下内容:
“`
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
“`
HOST
和PORT
分别表示监听器的主机名和端口号,如果使用IPC通信,还需要设置KEY
参数。
2、启动监听器服务
在命令行中,切换到Oracle安装目录下的bin
文件夹,然后执行以下命令启动监听器服务:
“`
lsnrctl start
“`
如果一切正常,将看到类似以下的输出信息:
“`
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service…
The command completed successfully
“`
3、测试监听器服务
可以使用tnsping
命令测试监听器服务是否正常工作,在命令行中执行以下命令:
“`
tnsping orcl
“`
如果一切正常,将看到类似以下的输出信息:
“`
TNS Ping Utility for 64bit Windows: Version 10.2.0.1.0 Production on 08SEP2022 14:37:49
Using builtin version of tnsping utility.
Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected 24, received 0. Truncated binary data: Incorrect information length: expected