Oracle clusterware tool 4

Source: Internet
Author: User

Application Layer:

The application layer refers to the RAC database. This layer consists of several resources, each of which is a complete service composed of a process or a group of processes. The management and maintenance of this layer are
These resources. There are three commands: onsctl, srvctl, and crs_stat.

Command: onsctl

This command is used to manage and configure ONS (Oracle Notification Service). ONS is the basis for Oracle clusterware to implement the fan event PUSH model. In traditional models
The client needs to regularly check the server to determine the server status. Essentially, it is a pull model. Oracle 10 Gb introduces a new push mechanism-fan (fast
Application Notification). When some events occur on the server, the server actively notifies the client of this change, so that the client can know the changes on the server as soon as possible. The introduction of this mechanism relies on ons implementation. before using the onsctl command, you must configure the ONS service.

ONS configuration content:

In the RAC environment, you must use ons under $ crs_home instead of ONS under $ ORACLE_HOME. The configuration file is in $ crs_home/OPMN/CONF/ons. config.

[Root @ Rac1 conf] # PWD /Opt/ora10g/product/ 10.2 . 0 /Crs_1/OPMN/ Conf [Oracle @ node1 conf] $  More  ONS. configlocalport = 6113  Remoteport = 6200 Loglevel = 3  Useocr = On parameter description: localport: this parameter represents the local listening port, specifically:  127.0 . 0  . 1. This loopback address is used to communicate with the local client. remoteport: this parameter indicates the remote listening port, except 127.  0.0  All local IP addresses other than. 1 are used to communicate with remote clients. Loglevel: Oracle allows you to track the running of ONS processes and record logs to local files. This parameter is used to define the log level to be recorded by ONS processes, from 1 - 9  The default value is 3. logfile: this parameter is used with the loglevel parameter to define the location of the ONS process log file. The default value is $ crs_home. /OPMN/logs/OPMN. lognodes and useocr: these two parameters jointly determine the local ons daemon to communicate with ONS daemon on which remote nodes. The nodes parameter value format is as follows: Hostname /IP: Port [ Hostname / IP: Port] such as useoce = Offnodes = Rac1: 6200 , Rac2: 6200  Useocr parameter value: On /Off. If useocr is on, the information is saved in OCR. If useocr is off, the information is configured in nodes. For a single instance, set useocr to off.

When useocr = on, the information is saved in the database. ons_hosts key. As follows:

[Oracle @ node1 bin] $./ocrdump-stdout-keyname database. ons_hosts-XML | More <Name> database. ons_hosts.node1 </Name> <value_type> oratext </value_type> <value> <! [CDATA [node1]> </value> <user_permission> procr_all_access </user_permission> <group_permission> procr_read </group_permission> <strong> procr_read </strong> <user_name> Oracle /user_name> <group_name> oinstall </group_name> <Name> database. ons_hosts.node1.port </Name> <value_type> oratext </value_type> <value> <! [CDATA [ 6200 ]> </Value> <user_permission> partition </user_permission> <group_permission> procr_read </group_permission> <partition> procr_read </other_permission> <user_name> Oracle </user_name> <group_name> oinstall </group_name> .......... <Name> database. ons_hosts.node2 </Name> <value_type> oratext </value_type> <value> <! [CDATA [node2]> </value> <user_permission> procr_all_access </user_permission> <group_permission> procr_read </group_permission> <strong> procr_read </strong> <user_name> Oracle /user_name> <group_name> oinstall </group_name> <Name> database. ons_hosts.node2.port </Name> <value_type> oratext </value_type> <value> <! [CDATA [ 6200 ]> </Value> <user_permission> partition </user_permission> <group_permission> procr_read </group_permission> <partition> procr_read </other_permission> <user_name> Oracle </user_name> <group_name> oinstall </group_name> ... [Oracle @ node1 bin] $ 

Configure ONS:

You can directly compile the ONS configuration file to modify the configuration. If OCR is used, you can use the racgons command for configuration, but it must be executed as a root user. If you use Oracle, no errors are prompted, but no configuration changes are made.

 
To add a configuration, run the following command: racgons add_config Rac1:6200Rac2:6200To delete the configuration, run the following command: racgons remove_config Rac1:6200Rac2:6200

Onsctl command:

Use the onsctl command to start, stop, debug ons, and reload the configuration file. The command format is as follows:

[Oracle @ node1 bin] $ ./ Onsctlusage :. /Onsctl START | stop | Ping | Reconfig | Debugstart -Start OPMN only. Stop - Stop ons daemon  Ping -Test to see If  ONS daemon is runningdebug -Display debug information For  The ONS daemonreconfig - Reload the ONS configurationhelp -Print Short  Syntax description (this). Detailed -Print a verbose syntax description. [Oracle @ node1 bin] $ 

Example:

 1  . View the process status at the OS level. [Oracle @ node1 bin] $  PS -Ef | Grep -V Grep | Grep  Onsoracle  5909       1    0   21 : 59 ? 00 :00 : 00 /Opt/ora10g/product/ 10.2 . 0 /Crs_1/OPMN/bin/ons- Doracle  5910    5909    0   21 : 59 ? 00 : 00 : 00 /Opt/ora10g/product/ 10.2 .0 /Crs_1/OPMN/bin/ons- D [Oracle @ node1 bin] $  2  . Confirm the ONS service status [Oracle @ node1 bin] $. /Onsctl Ping  Number of onsconfiguration retrieved, numcfg = 2  Onscfg [  0  ] {Node = Node1, Port = 6200  } Adding remote host node1:  6200  Onscfg [ 1  ] {Node = Node2, Port = 6200  } Adding remote host node2:  6200  ONS is running... [Oracle @ node1 bin] $  3  . Start ons service [root @ Rac1 bin] #. /Onsctl start

4. Use the debug option to view the details. The most meaningful one is to display all connections:

[Oracle @ node1 bin] $ ./ Onsctl debugnumber of onsconfiguration retrieved, numcfg = 2  Onscfg [  0 ] {Node = Node1, Port = 6200  } Adding remote host node1:  6200  Onscfg [  1  ] {Node = Node2, Port = 6200  } Adding remote host node2:  6200  HTTP / 1.1   200  Okcontent -Length: 1357 Content -Type: text/ Htmlresponse: ========= Ons ======== Listeners: Name bind address port flags socket ----------------------------------------- Local  127.000 . 000.001    6113   00000142        7  Remote  192.168 . 002.100    6200  00000101        8  Request No listenerserver connections: Id IP port flags sendq worker busy Subs ------------------------------------------------------------------- 1   192.168 . 002.101    6200   00104205            0                 1       0  Client Connections: Id IP port flags sendq worker busy Subs ------------------------------------------------------------------- 3   127.000 . 000.001    6113 0001001a 0                 1       0           4   127.000 . 000.001    6113 0001001a 0                 1       1 Pending connections: Id IP port flags sendq worker busy Subs ------------------------------------------------------------------- 0   127.000 . 000.001    6113   00020812            0                 1       0  Worker ticket:  7 / 7 , Idle: 208 Thread flags ---------------- B7ec0b90  00000012  B6d03b90  00000012  B6302b90  00000012  Resources: communications: Replicated Ed:  3 , In Receive Q: 0 , Processed: 3 , In Process Q: 0 Pools: Message:  24 / 25 ( 1 ), Link: 25 / 25 ( 1 ), Subtasks: 24 / 25 ( 1  ) [Oracle @ node1 bin] $ 

 

-- From Oracle RAC

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.