管理ONS(OracleNotificationService)
Onsctl Onsctl这个命令是用来管理ONS(Oracle Notification Service)是OracleClustser实现FAN Event Push模型的基
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:
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:
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 addresses plus ports. Note that the port value that is given is the remote port that each ONS instance is listening on. In order to maintain an identical file on all nodes, thehost:port of the current ONS node can also be listed in the nodes list. It will be ignored when reading the list.
The nodes listed in the nodes line correspond to the individual nodes in the RAC instance. Listing the nodes ensures that the middle-tier node can communicate with the RAC nodes. At least one middle-tier node and one node in the RAC instance must be configured to see one another. As long as one node on each side is aware of the other, all nodes are visible. You need not list every single cluster and middle-tier node in the ONS config file of each Oracle RAC node. In particular, if one ONS config file cluster node is aware of the middle tier, then all nodes in the cluster are aware of it.
An example of the nodes configuration is the following:
nodes=myhost.example.com:4200,123.123.123.123:4200
There are also several optional values that can be provided in ons.config.The first optional value is a loglevel. This specifies the level of messages that should be logged by ONS. This value is an integer that ranges from 1, which indicates least messages logged, to 9, which indicates most messages logged. The default value is 3. The following is an example:
loglevel=3
The second optional value is a logfile name. This specifies a log file that ONS should use for logging messages. The default value for logfile is$ORACLE_HOME/opmn/logs/ons.log. The following is an example:
logfile=/private/oraclehome/opmn/logs/myons.log
The third optional value is a walletfile name. A wallet file is used by the Oracle Secure Sockets Layer (SSL) to store SSL certificates. If a wallet file is specified to ONS, it will use SSL when communicating with other ONS instances and require SSL certificate authentication from all ONS instances that try to connect to it. This means that if you want to turn on SSL for one ONS instance, then you must turn it on for all instances that are connected. This value should point to the directory where your ewallet.p12 file is located. The following is an example:
walletfile=/private/oraclehome/opmn/conf/ssl.wlt/default
One optional value is reserved for use on the server-side. useocr=on is used to tell ONS to store all Oracle RAC nodes and port numbers in Oracle Cluster Registry (OCR) instead of in the ONS configuration file. Do not use this option on the client-side.
The ons.config file allows blank lines and comments on lines that begin with the number sign (#).
Client-Side ONS Configuration
You can access the client-side ONS through ORACLE_HOME/opmn. On the client-side, there are two ways to set up ONS:
Remote ONS configuration
See Also:
"Remote ONS Subscription"ONS daemon on the client-side
Example 26-1 illustrates how a sample configuration file may look.
Example 26-1 Example of a Sample ons.config File
# This is an example ons.config file # # The first three values are required localport=4100 remoteport=4200 nodes=racnode1.example.com:4200,racnode2.example.com:4200
After configuring ONS, you start the ONS daemon with the onsctl command. It is the user's responsibility to make sure that an ONS daemon is running at all times.
Using the onsctl Command
After configuring, use ORACLE_HOME/opmn/bin/onsctl to start, stop, reconfigure, and monitor the ONS daemon. Table 26-1 is a summary of the commands thatonsctl supports.
Table 26-1 onsctl Commands
Command | Effect | Output |
---|---|---|
start |
Starts the ONS daemon |
onsctl: ons started |
stop |
Stops the ONS daemon |
onsctl: shutting down ons daemon... |
ping |
Verifies whether or not the ONS daemon is running |
ons is running ... |
reconfig |
Triggers a reload of the ONS configuration without shutting down the ONS daemon |
|
help |
Prints a help summary message for onsctl |
|
detailed |
Prints a detailed help message for onsctl |
Server-Side ONS Configuration Using racgons
You can access the server-side ONS through ORA_CRS_HOME/opmn. You configure the server-side by using racgons to add the middle-tier node information to OCR. This command is found in ORA_CRS_HOME/bin/racgons. Before using racgons, you must edit ons.config to set useocr=on.
The middle-tier nodes should be configured in OCR, so that all nodes share the configuration, and no matter which Oracle RAC nodes are up they can communicate to the middle-tier. When running on a cluster, always configure the ONS hosts and ports not by using the ONS configuration files but usingracgons. The racgons command stores the ONS hosts and ports in OCR, where every node can see it. That way, you do not need to edit a file on every node to change the configuration, just run a single command on one of the cluster nodes.
The racogns command enables you to specify hosts and ports on one node, then propagate your changes among all nodes in a cluster. The command takes two forms:
racgons add_config hostname:port [hostname:port] [hostname:port] ... racgons remove_config hostname[:port] [hostname:port] [hostname:port] ...
The add_config version adds the listed host name(s), the remove_config version removes them. Both commands propagate the changes among all instances in a cluster.
If multiple port numbers are configured for a host, the specified port number is removed from hostname. If only hostname is specified, all port numbers for that host are removed.
See Also:
Oracle Real Application Clusters Administration and Deployment GuideOther Uses of racgons
You should run racgons whenever you add a new node to the cluster.
Remote ONS Subscription
The advantages of remote ONS subscription are the following:
Support for an All Java middle-tier stack
No ONS daemon needed on the client computer and, therefore, no need to manage this process
Simple configuration using the DataSource property
When using remote ONS subscription for Fast Connection Failover, the application invokes the following method on an OracleDataSource instance:
setONSConfiguration(String remoteONSConfig)
The remoteONSConfig parameter is a list of name and value pairs of the form name=value that are separated by a new line character (\n). name can be one ofnodes, walletfile, or walletpassword. This parameter should specify at least the nodes ONS configuration attribute, which is a list of host:port pairs, each pair separated by comma (,). The hosts and ports denote the remote ONS daemons available on the Oracle RAC nodes.
See Also:
"ONS Configuration File"SSL could be used in communicating with the ONS daemons when the walletfile attribute is specified as an Oracle wallet file. In such cases, if thewalletpassword attribute is not specified, single sign-on (SSO) would be assumed.
Following are a few examples, assuming ods is an OracleDataSource instance:
ods.setONSConfiguration("nodes=racnode1.example.com:4200,racnode2.example.com:4200"); ods.setONSConfiguration("nodes=racnode1:4200,racnode2:4200\nwalletfile=/mydir/Wallet\nwalletpassword=mypasswd"); ods.setONSConfiguration("nodes=racnode1:4200,racnode2:4200\nwalletfile=/mydir/conf/Wallet");
Note:
The ons.jar file must be in the CLASSPATH on the client. In the case of Oracle Application Server, ONS is embedded in Oracle Process Manager and Notification Server (OPMN), as before, and JDBC Fast Connection Failover continues to work as before.Enabling Fast Connection Failover
An application enables Fast Connection Failover by calling setFastConnectionFailoverEnabled(true) on a DataSource instance, before retrieving any connections from that instance.
You cannot enable Fast Connection Failover when reinitializing a connection cache. You must enable it before using the OracleDataSource instance.
Example 26-2 illustrates how to enable Fast Connection Failover.
Note:
After a cache is Fast Connection Failover-enabled, you cannot disable Fast Connection Failover during the lifetime of that cache.To enable Fast Connection Failover, you must perform the following:
Configure and start ONS. If ONS is not correctly set up, then implicit connection cache creation fails and an ONSException is thrown at the firstgetConnection request.
Set the FastConnectionFailoverEnabled property before making the first getConnection request to an OracleDataSource. When Fast Connection Failover is enabled, the failover applies to all connections in the connection cache. If your application explicitly creates a connection cache using the Connection Cache Manager, then you must first set FastConnectionFailoverEnabled before retrieving any connections.
Use a service name rather than a service identifier when setting the OracleDataSource url property.
Example 26-2 Enabling Fast Connection Failover
// declare datasource ods.setUrl( "jdbc:oracle:oci:@(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=cluster_alias) (PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=service_name)))"); ods.setUser("scott"); ods.setConnectionCachingEnabled(true); ods.setFastConnectionFailoverEnabled(true): ctx.bind("myDS",ods); ds=(OracleDataSource) ctx.lookup("MyDS"); try { ds.getConnection(); // transparently creates and accesses cache catch (SQLException SE { } } ...
Querying Fast Connection Failover Status
An application determines if Fast Connection Failover is enabled by calling OracleDataSource.getFastConnectionFailoverEnabled, which returns true if failover is enabled, false otherwise.
Understanding Fast Connection Failover
After Fast Connection Failover is enabled, the mechanism is automatic; no application intervention is needed. This section discusses how a connection failover is presented to an application and what steps the application takes to recover.
This section covers the following topics:
What the Application Sees
How It Works
What the Application Sees
By the time an Oracle RAC service failure is propagated to the JDBC application, the database already rolls back the local transaction. The cache manager then cleans up all invalid connections. When an application holding an invalid connection tries to do work through that connection, it is possible to receiveSQLException, ORA-17008, Closed Connection.
When an application receives a Closed Connection error message, it should do the following:
Retry the connection request. This is essential, because the old connection is no longer open.
Replay the transaction. All work done before the connection was closed has been lost.
Note:
The application should not try to roll back the transaction. The transaction was already rolled back in the database by the time the application received the exception.How It Works
Under Fast Connection Failover, each connection in the cache maintains a mapping to a service, instance, database, and host name.
When a database generates an Oracle RAC event, that event is forwarded to the JVM in which JDBC is running. A daemon thread inside the JVM receives the Oracle RAC event and passes it on to the Connection Cache Manager. The Connection Cache Manager then throws SQL exceptions to the applications affected by the Oracle RAC event.
A typical failover scenario may work like the following:
A database instance fails, leaving several stale connections in the cache.
The RAC mechanism in the database generates an Oracle RAC event which is sent to the JVM containing JDBC.
The daemon thread inside the JVM finds all the connections affected by the Oracle RAC event, notifies them of the closed connection through SQL exceptions, and rolls back any open transactions.
Each individual connection receives a SQL exception and must retry.
Comparison of Fast Connection Failover and TAF
Fast Connection Failover differs from Transparent Application Failover (TAF) in the following ways:
Application-level connection retries
Fast Connection Failover supports application-level connection retries. This gives the application control of responding to connection failovers. The application can choose whether to retry the connection or to rethrow the exception. TAF supports connection retries only at the OCI/Net layer.
Integration with the implicit connection cache
Fast Connection Failover is well-integrated with the implicit connection cache, which allows the Connection Cache Manager to manage the cache for high availability. For example, failed connections are automatically invalidated in the cache. TAF works at the network level on a per-connection basis, which means that the connection cache cannot be notified of failures.
Event-based
Fast Connection Failover is based on the Oracle RAC event mechanism. This means that Fast Connection Failover is efficient and detects failures quickly for both active and inactive connections.
Load-balancing support
Fast Connection Failover supports UP event load balancing of connections and run-time work request distribution across active Oracle RAC instances.

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Redis를 사용하여 분산 트랜잭션 관리를 구현하는 방법 소개: 인터넷의 급속한 발전으로 인해 분산 시스템의 사용이 점점 더 널리 보급되고 있습니다. 분산 시스템에서 트랜잭션 관리는 중요한 과제입니다. 기존의 트랜잭션 관리 방법은 분산 시스템에서 구현하기 어렵고 비효율적입니다. Redis의 특성을 활용하여 분산 트랜잭션 관리를 쉽게 구현하고 시스템의 성능과 안정성을 향상시킬 수 있습니다. 1. Redis 소개 Redis는 효율적인 읽기 및 쓰기 성능과 풍부한 데이터를 갖춘 메모리 기반 데이터 저장 시스템입니다.

Java로 학생 성과 관리 기능을 구현하는 방법은 무엇입니까? 현대 교육 시스템에서 학생의 성과 관리는 매우 중요한 업무입니다. 학생 성과를 관리함으로써 학교는 학생의 학습 진행 상황을 더 잘 모니터링하고, 학생의 약점과 장점을 이해하며, 이 정보를 기반으로 보다 구체적인 교육 계획을 세울 수 있습니다. 이 기사에서는 Java 프로그래밍 언어를 사용하여 학생 성과 관리 기능을 구현하는 방법에 대해 설명합니다. 먼저, 학생 성적의 데이터 구조를 결정해야 합니다. 일반적으로 학생의 성적은 다음과 같이 나타낼 수 있습니다.

Laravel 확장 패키지 관리: 타사 코드와 기능을 쉽게 통합합니다. 소개: Laravel 개발에서는 프로젝트의 효율성과 안정성을 향상시키기 위해 타사 코드와 기능을 사용하는 경우가 많습니다. Laravel 확장 패키지 관리 시스템을 사용하면 이러한 타사 코드와 기능을 쉽게 통합할 수 있어 개발 작업이 더욱 편리하고 효율적으로 이루어집니다. 이 글에서는 Laravel 확장 패키지 관리의 기본 개념과 사용법을 소개하고, 몇 가지 실용적인 코드 예제를 사용하여 독자들이 이를 더 잘 이해하고 적용할 수 있도록 돕습니다. 라라란 무엇인가

Kirin 운영 체제에서 네트워크 서버를 설정하고 관리하는 방법은 무엇입니까? Kirin 운영 체제는 중국에서 독자적으로 개발된 Linux 기반 운영 체제입니다. 이는 오픈 소스, 보안 및 안정성의 특성을 가지며 중국에서 널리 사용되었습니다. 이 기사에서는 Kirin 운영 체제에서 네트워크 서버를 설정하고 관리하는 방법을 소개하여 독자가 자신의 네트워크 서버를 더 잘 구축하고 관리할 수 있도록 돕습니다. 1. 관련 소프트웨어 설치 네트워크 서버 설정 및 관리를 시작하기 전에 몇 가지 필요한 소프트웨어를 설치해야 합니다. Kirin OS에서는 다음을 수행할 수 있습니다.

win10 시스템을 사용할 때 마우스를 사용하여 바탕화면을 마우스 오른쪽 버튼으로 클릭하거나 메뉴를 마우스 오른쪽 버튼으로 클릭하면 메뉴가 열리지 않고 컴퓨터를 정상적으로 사용할 수 없는 것을 발견했습니다. 이때 복원이 필요합니다. 문제를 해결하기 위한 시스템. Win10 마우스 오른쪽 버튼 클릭 메뉴 관리를 열 수 없습니다. 1. 먼저 제어판을 열고 클릭합니다. 2. 그런 다음 보안 및 유지 관리 아래를 클릭합니다. 3. 시스템을 복원하려면 오른쪽의 를 클릭하세요. 4. 그래도 사용할 수 없다면 마우스 자체에 문제가 있는지 확인해 보세요. 5. 마우스에 문제가 없다고 확신하면 +를 누르고 Enter를 누르세요. 6. 실행이 완료되면 컴퓨터를 다시 시작합니다.

디스크 관리 분할 방법 컴퓨터 기술의 지속적인 발전으로 인해 디스크 관리는 컴퓨터 사용에 없어서는 안 될 부분이 되었습니다. 디스크 관리의 중요한 부분인 디스크 파티셔닝은 하드 디스크를 여러 부분으로 나눌 수 있어 데이터를 보다 유연하게 저장하고 관리할 수 있습니다. 그렇다면 디스크 관리를 분할하는 방법은 무엇입니까? 아래에서 자세한 소개를 드리겠습니다. 우선, 디스크를 분할하는 방법은 하나만 있는 것이 아니라는 점을 분명히 해야 합니다. 다양한 필요와 목적에 따라 적절한 디스크 분할 방법을 유연하게 선택할 수 있습니다. 자주

캐시 관리를 위해 Hyperf 프레임워크를 사용하는 방법 캐시는 애플리케이션 성능을 향상시키는 중요한 수단 중 하나이며 최신 프레임워크는 보다 편리한 캐시 관리 도구를 제공합니다. 이 문서에서는 캐시 관리를 위해 Hyperf 프레임워크를 사용하는 방법을 소개하고 특정 코드 예제를 제공합니다. Hyperf 프레임워크는 Swoole을 기반으로 개발된 고성능 프레임워크로, 강력한 캐시 관리 기능을 포함하여 풍부한 내장 구성요소 및 도구 세트를 갖추고 있습니다. Hyperf 프레임워크는 Redis 및 Memcach와 같은 여러 캐시 드라이버를 지원합니다.

MongoDB 기술 개발 시 발생하는 트랜잭션 관리 문제에 대한 솔루션 분석 최신 애플리케이션이 점점 더 복잡해지고 커지면서 데이터에 대한 트랜잭션 처리 요구 사항도 점점 더 높아지고 있습니다. 널리 사용되는 NoSQL 데이터베이스인 MongoDB는 데이터 관리 측면에서 탁월한 성능과 확장성을 갖추고 있습니다. 그러나 MongoDB는 데이터 일관성과 트랜잭션 관리 측면에서 상대적으로 취약하여 개발자에게 어려움을 안겨줍니다. 이 글에서는 MongoDB 개발 시 발생하는 트랜잭션 관리 문제를 살펴보고 몇 가지 해결 방법을 제안합니다.
