oracle ons(OracleNotificationService)

Oracle ONS(Oracle Notification Service)是RAC环境下实现FAN Event Push的基础,用于快速连接故障切换。配置ONS涉及配置文件ons.config,包括localport、remoteport等参数。onsctl命令用于管理ONS,如启动、停止、调试和重新加载配置。Fast Connection Failover(FCF)的启用要求正确配置并启动ONS,应用程序通过设置DataSource属性来订阅远程ONS。在FCF启用后,应用程序在遇到服务失败时会自动进行重试和事务回滚。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Onsctl

Onsctl这个命令是用来管理ONS(Oracle Notification Service)是OracleClustser实现FAN Event Push模型的基础。

Oracle Notification Service (ONS)--A publish and subscribe service for communicating Fast Application Notification (FAN) events.

在RAC环境下,需要使用$CRS_HOME下的ONS,而不是$ORACLE_HOME下的ONS,这点需要注意。配置文件位于$CRS_HOME/opmn/conf/ons.config。

[oracle@felix2 conf]$ pwd

/u01/oracle/10.2.0/crs_1/opmn/conf

[oracle@felix2 conf]$ cat ons.config

localport=6113

remoteport=6200

loglevel=3

useocr=on

[oracle@felix2 conf]$ netstat -ano | grep 6200

tcp 0 0 0.0.0.0:6200 0.0.0.0:* LISTEN off (0.00/0/0)

tcp 0 0 192.168.10.102:8471 192.168.10.101:6200 ESTABLISHED off (0.00/0/0)

[oracle@felix2 conf]$ netstat -ano | grep 6113

tcp 0 0 127.0.0.1:6113 0.0.0.0:* LISTEN off (0.00/0/0)

tcp 0 0 127.0.0.1:42331 127.0.0.1:6113 ESTABLISHED keepalive (2251.34/0/0)

tcp 0 0 127.0.0.1:42328 127.0.0.1:6113 ESTABLISHED keepalive (2185.99/0/0)

tcp 0 0 127.0.0.1:6113 127.0.0.1:42331 ESTABLISHED off (0.00/0/0)

tcp 0 0 127.0.0.1:6113 127.0.0.1:42328 ESTABLISHED off (0.00/0/0)

unix 3 [ ] STREAM CONNECTED 6113

[oracle@felix2 conf]$

配置ONS:

添加ONS:

[oracle@felix2 conf]$ racgons add_configfelix11:6200 felix22:6200

删除ONS:

[oracle@felix2 conf]$ racgons remove_configfelix11:6200 felix22:6200

[oracle@felix2 conf]$

Onsctl命令:

使用onsctl命令可以启动、停止、调试ONS,并重新载入配置文件,其命令格式如下:

注意:

ONS进程运行,并不一定代表ONS正常工作,需要使用ping命令来确认。

[oracle@felix2 conf]$ onsctl

usage: /u01/oracle/10.2.0/db_1/bin/onsctlstart|stop|ping|reconfig|debug

start - Start opmn only.

stop - Stop ons daemon

ping - Test to see ifons daemon is running

debug - Display debuginformation for the ons daemon

reconfig - Reload the onsconfiguration

help - Print a shortsyntax description (this).

detailed - Print a verbosesyntax description. 

(1)在os级别查看进程

[oracle@felix2 conf]$ ps -ef | grep ons

root 2530 1 0 20:19 ? 00:00:00 sendmail: acceptingconnections

oracle 5223 1 0 20:22 ? 00:00:00/u01/oracle/10.2.0/crs_1/opmn/bin/ons -d

oracle 5224 5223 0 20:22 ? 00:00:00 /u01/oracle/10.2.0/crs_1/opmn/bin/ons-d

oracle 10833 29589 0 21:59 pts/2 00:00:00 grep ons

[oracle@felix2 conf]$ 

(2)确认ONS服务的状态 

[oracle@felix2 conf]$ onsctl ping

Number of configuration nodes retrieved: 2

0: {node = felix1, port = 6200}

Adding remote host felix1:6200

1: {node = felix2, port = 6200}

Remote port for local node in local config doesnot match that from OCR.

ons is not running ...

[oracle@felix2 conf]$ 

从输出的信息课件,ONS服务是停止的。 

(3)启动ONS服务

[oracle@felix2 conf]$ onsctl start

Number of configuration nodes retrieved: 2

0: {node = felix1, port = 6200}

Adding remote host felix1:6200

1: {node = felix2, port = 6200}

……

…… 

Configuring ONS for Fast Connection Failover

In order for Fast Connection Failover to work, you must configure ONS correctly. ONS is shipped as part of Oracle Database 11g.

This section covers the following topics:

ONS Configuration File

Client-Side ONS Configuration

Server-Side ONS Configuration Using racgons

Remote ONS Subscription

ONS Configuration File

ONS configuration is controlled by the ONS configuration file, ORACLE_HOME/opmn/conf/ons.config. This file tells the ONS daemon details about how it should behave and who it should talk to. Configuration information within ons.config is defined in simple name and value pairs. There are three values that should always be configured within ons.config. The first is localport, the port that ONS binds to on the localhost interface to talk to local clients. An example of thelocalport configuration is the following:

?
1
localport=4100

The second value is remoteport, the port that ONS binds to on all interfaces for talking to other ONS daemons. An example of the remoteport configuration is the following:

?
1
remoteport=4200

The third value specifies nodes, a list of other ONS daemons to talk to. Node values are given as a comma-delimited list of either host names or IP ad

### Oracle 19c ONS Service Disconnect Troubleshooting and Solutions For addressing the issue of an Oracle Notification Service (ONS) disconnection in Oracle 19c, several approaches can be taken to diagnose and resolve this problem. #### Verify Network Configuration Ensure that network configurations are correctly set up between nodes. This includes checking firewall settings as well as ensuring there is no network congestion or packet loss which could affect communication[^1]. #### Review Logs for Errors Examine logs such as `qopatch_log.log` located within the Oracle home directory where operations related to patching and configuration changes are recorded. Look specifically at entries around times when disconnections occur; these may provide clues about what caused them[^2]. ```bash cat /path/to/qopatch_log.log | grep 'ERROR' ``` #### Check Listener Status Confirm whether listeners on all involved databases are running properly by using commands like: ```sql lsnrctl status LISTENER_NAME ``` This command checks if the listener associated with a specific database instance is active and listening on expected ports without issues preventing connections from being established successfully. #### Validate Environment Variables Make sure environment variables including ORACLE_HOME, PATH, TNS_ADMIN among others point towards correct locations containing necessary binaries and configuration files required for proper functioning of services including ONS. #### Restart Services If after performing above steps problems persist consider restarting both sides' ONS daemons along with any dependent components they interact closely with during operation timeframes experiencing instability events reported earlier through logging mechanisms mentioned previously. --related questions-- 1. How does one configure firewalls appropriately for optimal performance while maintaining security? 2. What tools exist outside standard log analysis methods that might aid in diagnosing connectivity issues more effectively? 3. Can you explain how setting certain environment variables impacts various aspects of Oracle Database functionality beyond just enabling features? 4. Is it possible to automate parts of the troubleshooting process via scripts or other means? If so, what would those look like syntactically speaking? 5. Under what circumstances should entire systems rather than isolated processes undergo restarts due to potential underlying causes not immediately apparent upon initial investigation efforts made thus far?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值