RAC Management (Crs_stat, Crsctl, Srvctl)

Source: Internet
Author: User
Tags cdata log log

The Oracle clusterware command set can be grouped into the following 4 categories:
Node Layer: Osnodes
Network layer: OIFCFG
Cluster layer: CRSCTL, ocrcheck,ocrdump,ocrconfig
Application layer: Srvctl,onsctl,crs_stat
These commands are described separately below. 1, node layer

Olsnodes, this command is used to display a list of cluster points, with the following parameters available:

$olsnodes-H

Usage: olsnodes [-n] [-p][-i] [<node> |-l] [g] [-V]
-N Print node numbers and section names
-P print Private interconnect names and section names
-I print virtual IP names and section names
<node> print information for the specified node
-L Print Local node information
-G Enable event logging
-V running in verbose mode

These parameters can be used in a mix.
[Root@rac1 bin]# $olsnodes

Racnode1

Racnode2
[Root@rac1 bin] #olsnodes-N

Racnode11

Racnode22

Note: If the command cannot be run, add path or go directly to the directory where the command is running. This example is located at:

/u01/crs/oracle/product/11.1.0/crs/bin 2, Network layer

The network layer consists of the network components of each node, including 2 physical network adapters and 3 IP addresses. There is only one command: Oifcfg.

The format of the OIFCFG command is as follows:

Usage: oifcfg iflist [-P [-N]]
Oifcfg setif {-node <nodename> |-global} {<if_name>/<subnet>:<if_type>}
Oifcfg getif [-node <nodename> |-global] [-if <if_name>[/<subnet>] [-type <if_type>]]
Oifcfg delif [-node <nodename> |-global] [<IF_NAME>[/<SUBNET>]]
oifcfg [-help]

<nodename>-the host name known to the communication network
<if_name>-Name of the interface configured in the system
<subnet>-Subnet address for interface
<if_type>-Interface Type {cluster_interconnect | public | storage}
The OIFCTG command is used to define and modify the network card properties required by the Oracle cluster, including the network segment address of the network card, the subnet mask, the interface type, and so on. To properly use this command, you must first know how Oracle defines the network interface, and each of Oracle's network interfaces includes name, network segment address, interface type 3 attributes: Interface_name/subnet:interface_type.

There are no IP addresses in these properties, but there are two kinds of interface types, public and private, which indicate that interfaces are used for external communication, for Oracle NET and VIP addresses, while the latter describes interfaces for interconnect.

Interfaces are configured in two categories:

Global and Node-specific. The former indicates that the configuration information for all nodes in the cluster is the same, that is, the configuration of all nodes is symmetric, while the latter means that the configuration of this node is different from the other node configuration and is asymmetric.
Iflist: Display the network port list
Getif: Obtain a single network port information
Setif: Configuring a single network port
Delif: Remove the network port
[Root@rac1 bin]#./oifcfg-help

[Root@rac1 bin]#./oifcfg iflist
[Root@rac1 bin]#./oifcfg getif
– View the public type of network adapters
[Root@rac1 bin]#./oifcfg Getif-type Public
– Remove Interface Configuration
[Root@rac1 bin]#./oifcfg Delif–global
– Add Interface Configuration
[Root@rac1 bin]#./oifcfg Setif-global Eth0/192.168.1.119:public
[Root@rac1 bin]#./oifcfg setif-globaleth1/10.85.10.119:cluster_interconnect 3, cluster layer

Cluster layer is a core cluster composed of Clusterware, which is responsible for maintaining the shared devices within the cluster and providing a complete cluster status view for the application cluster, which is adjusted according to this view. There are 4 commands in this layer: Crsctl, Ocrcheck,ocrdump,ocrconfig. The last three are for OCR disks. 3.1 Crsctl

The CRSCTL command can be used to check the CRS process stack, each CRS process state, manage the Votedisk, and track the CRS process functionality.
[Root@rac1 bin]#./crsctl 3.1.1 Check CRS status

[Root@rac1 bin]#./crsctl Check CRS
Cluster Synchronization Services appears healthy

Cluster Ready Services appears healthy

Event Manager appears healthy
– Check individual status
[Root@rac1 bin]#./crsctl Check CSSD
CSS appears healthy
[Root@rac1 bin]#./crsctl Check CRSD
CRS appears healthy
[Root@rac1 bin]#./crsctl Check EVMD
EVM appears healthy 3.1.2 Configure whether the CRS stack is started from

The CRS process stack is started by default as the operating system starts, and sometimes this feature needs to be turned off for maintenance purposes, and the following command can be executed with the root user.
[Root@rac1 bin]#./crsctl Disable CRS
[Root@rac1 bin]#./crsctl Enable CRS
This command actually modifies the contents of the/etc/oracle/scls_scr/raw/root/crsstart file. 3.1.3 Boot, stop the CRS stack

When Oracle is 10.1, it must reboot the system by restarting the Clusterware, but starting with Oracle 10.2, you can start and stop CRS by command.
– Start CRS:
[Root@rac1 bin]#./crsctl start CRS

Attempting to start CRS stack
The CRS stack would be started shortly
– Turn off CRS:
[Root@rac1 bin]#./crsctl Stop CRS
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued. 3.1.4 View Votedisk disk Locations

[Root@rac1 bin]#./crsctl query css Votedisk 3.1.5 View and modify CRS parameters

– View parameters: Using get
[Root@rac1 bin]#./crsctl Get CSS Misscount
60
– Modify parameters: Use Set, but this function should be used with caution
[Root@rac1 bin]#./crsctl Set CSS Miscount 3.1.6 tracking CRS module, providing accessibility

CRS consists of three CRS,CSS,EVM services, each of which consists of a series of module, CRSCTL allows tracking of each module and logs the trace content to the log.
[Root@rac1 bin]#./crsctl lsmodules CSS
[Root@rac1 bin]#./crsctl lsmodules EVM
– Trace the CSSD module, which requires root user execution:
[Root@rac1 bin]#./crsctl debug Log css "Cssd:1"
Configuration parameter trace is now set to 1.
Set CRSD Debug MODULE:CSSD level:1
– View trace logs
[Root@rac1 cssd]# pwd
/u01/app/oracle/product/crs/log/rac1/cssd
[Root@rac1 cssd]# more Ocssd.log
... 3.1.7 Maintenance Votedisk

During the graphical installation of Clusterware, when you configure Votedisk, you can only fill out a votedisk if you select the external redundancy policy. However, even if you use external redundancy as a redundancy policy, you can add more than one vodedisk, but you must add it through the Crsctl command, and after adding multiple votedisk, the votedisk are mirroring each other. Can prevent Votedisk from being a single point of failure.
It is important to note that Votedisk is using a "most available algorithm", if there are multiple votedisk, then more than half of the votedisk must be used at the same time, clusterware to normal use. For example, CONFIGURED 4 Votedisk, bad a votedisk, the cluster can work properly, if 2 broken, can not meet more than half of the cluster will immediately go down, all nodes immediately restart, so if you add votedisk, try not only to add one, but should add 2. This is not the same as OCR. OCR only needs to be configured with one.
Adding and removing votedisk operations is more dangerous, you must stop the database, stop ASM, stop the CRS stack, and you must use the-force parameter when you operate.
1) View current configuration
[Root@rac1 bin]#./crsctl Query CSS Votedisk
2 stop CRS for all nodes:
[Root@rac1 bin]#./crsctl Stop CRS
3) Add Votedisk
[Root@rac1 bin]#./crsctl Add CSS Votedisk/dev/raw/rac1-force
Note: Even after CRS has been shut down, the Votedisk must be added and removed through the-force parameter, and the-force parameter will be safe only if the CRS is shut down, otherwise the cluter is not a ready state for online disk Addition.
4 confirm the added situation:
[Root@rac1 bin]#./crsctl Query CSS Votedisk
5) Start CRS
[Root@rac1 bin]#./crsctl start CRS3.2 OCR Command series

Oracle Clusterware puts the entire cluster's configuration information on shared storage, which is OCR disk. In the entire cluster, only one node can read and write OCR disk, which is called Master node, All nodes retain a copy of the OCR in memory, while yo an OCR process reads the content from this memory. When the OCR content changes, the OCR process from master node is responsible for synchronizing the OCR process to the other nodes.
Because the content of OCR is so important, Oracle backs it up every 4 hours and retains the last 3 backups, as well as the last backup of the previous week. This backup is done by the master Node CRSD process, and the default location for the backup is in the $crs_home\crs\cdata\<cluster_name> directory. After each backup, the backup file name is automatically changed to reflect the backup time sequence, and the most recent backup is called BACKUP00.OCR. In addition to being saved locally, the DBA should also keep a copy of the other storage devices to prevent accidental storage failures. 3.2.1 Ocrdump

The command can print OCR content in ASCII format, but this command cannot be used as a backup restore of OCR, which means that the resulting file can only be used for reading and not for recovery.
Command format: ocrdump [-stdout] [filename] [-keyname name] [-xml]
Parameter description:
-stdout: Print the content to the screen
Filename: Content output to File
-keyname: Print only a key and its child-healthy content
-xml: Printing output in XML format

Example: Print the contents of the SYSTEM.CSS key to the screen in. xml format
[Root@rac1 bin]#./ocrdump-stdout-keyname System.css-xml|more
......
During the execution of this command, a log file is generated in the $crs_home\log\<node_name>\client directory, the filename is ocrdump_<pid>.log, and if there is a problem with the command execution, You can view the cause of the problem from this log. 3.2.2 Ocrcheck

The Ocrcheck command is used to check the consistency of OCR content, and the command execution process generates Ocrcheck_pid.log log files in the $crs_home\log\nodename\client directory. This command does not require arguments.
[Root@rac1 bin]#./ocrcheck 3.2.3 Ocrconfig

This command is used to maintain OCR disks, and if you choose external redundancy redundancy during the clusterware process, you can enter only one OCR disk location. However, Oracle allows two OCR disks to be configured to mirror each other to prevent the single point of failure of OCR disks. OCR disks are not the same as Votedisk disks, with a maximum of two OCR disks, one primary OCR and one mirror OCR.
[Root@rac1 bin]#./ocrconfig–help

– View self-service backups
[Root@rac1 Bin]#./ocrconfig-showbackup
By default, OCR is automatically backed up in the $crs_home\crs\cdata\cluster_name directory and can be modified to the new directory via the Ocrconfig-backuploc <directory_name> command 3.2.4 using exports, importing for backup and recovery

Oracle recommends that you make a backup of OCR before you make adjustments to the cluster, such as adding and removing nodes, and you can use export backup to the specified file, and if you do a replace or restore operation, Oracle suggests using CLUVFY comp ocr-n All commands to do a full check. This command is in the Clusterware installation software.
1 first turn off CRS for all nodes
[Root@rac1 bin]#./crsctl Stop CRS
2 Export OCR content with root user

[Root@rac1 bin]#./ocrconfig-export/u01/ocr.exp

3) Restart CRS
[Root@rac1 bin]#./crsctl start CRS

4) Check CRS status
[Root@rac1 bin]#./crsctl Check CRS
CSS appears healthy
CRS appears healthy
EVM appears healthy

5) Destroy OCR content
[Root@rac1 bin]# dd If=/dev/zero f=/dev/raw/rac1 bs=1024 count=102400
102400+0 Records in
102400+0 Records out
6) Check for OCR consistency
[Root@rac1 bin]#./ocrcheck
Prot-601:failed to initialize Ocrcheck

7) Use the Cluvfy tool to check for consistency  
[Root@rac1 cluvfy]#./runcluvfy.sh comp ocr-n all 
Verifying OCR integrity  ;
Unable to retrieve nodelist from Oracle clusterware. 

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.