[Oracle] Some Common commands in RAC (1)

Source: Internet
Author: User

[Oracle] Some Common commands in RAC (1)

Node layer:

Olsnodes

-N: displays the number of each node.

[Oracle @ rac1 ~] # Olsnodes-n

Rac1 1

Rac2 2 2

-P: displays the name of the network interface used by each node for private interconnect.

[Oracle @ rac1 ~] # Olsnodes-p

Rac1 rac1-priv

Rac2 rac2-priv

-I: displays the VIP addresses of each node.

[Oracle @ rac1 ~] # Olsnodes-I

Rac1 rac1-vip

Rac2 rac2-vip

-G: Print log information

[Oracle @ rac1 ~] # Olsnodes-g

Rac1

Rac2

-V: Print detailed log information

[Oracle @ rac1 ~] # Olsnodes-v

Prlslms: Initializing LXL global

Prlsndmain: Initializing CLSS context

Prlsmemberlist: No of cluster members configured = 256

Prlsmemberlist: Getting information for nodenum = 1

Prlsmemberlist: node_name = rac1

Prlsmemberlist: ctx-> lsdata-> node_num = 1

Prls_printdata: Printing the node data

Rac1

Prlsmemberlist: Getting information for nodenum = 2

Prlsmemberlist: node_name = rac2

Prlsmemberlist: ctx-> lsdata-> node_num = 2

Prls_printdata: Printing the node data

Rac2

Prlsndmain: olsnodes executed successfully

Prlsndterm: Terminating LSF

Network Layer:

[Oracle @ rac1 ~] # Oifcfg

Name:

Oifcfg-Oracle Interface Configuration Tool.

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>-name of the host, as known to a communications network

<If_name>-name by which the interface is configured in the system

<Subnet>-subnet address of the interface

<If_type>-type of the interface {cluster_interconnect | public | storage}

Iflist:

[Oracle @ rac1 ~] # Oifcfg iflist

Eth0 192.168.1.0

Eth1 192.168.2.0

Eth2 192.168.101.0

Getif can obtain the information of a single network port.

[Oracle @ rac1 ~] # Oifcfg getif

Eth0 192.168.1.0 global public

Eth1 192.168.2.0 global cluster_interconnect

[Oracle @ rac1 ~] # Oifcfg getif-type public

Eth0 192.168.1.0 global public

[Oracle @ rac1 ~] # Oifcfg getif-type cluster_interconnect

Eth1 192.168.2.0 global cluster_interconnect

Setif:

[Oracle @ rac1 ~] # Oifcfg setif-global eth2/192.168.101.0: public

Delif:

[Oracle @ rac1 ~] # Oifcfg delif-global eth2/192.168.101.0

Cluster layer:

Crsctl

[Oracle @ rac1 ~] # Crsctl

Usage: crsctl check crs-checks the viability of the CRS stack

Crsctl check cssd-checks the viability of CSS

Crsctl check crsd-checks the viability of CRS

Crsctl check evmd-checks the viability of EVM

Crsctl set css <parameter> <value>-sets a parameter override

Crsctl get css <parameter>-gets the value of a CSS parameter

Crsctl unset css <parameter>-sets CSS parameter to its default

Crsctl query css votedisk-lists the voting disks used by CSS

Crsctl add css votedisk <path>-adds a new voting disk

Crsctl delete css votedisk <path>-removes a voting disk

Crsctl enable crs-enables startup for all CRS daemons

Crsctl disable crs-disables startup for all CRS daemons

Crsctl start crs-starts all CRS daemons.

Crsctl stop crs-stops all CRS daemons. Stops CRS resources in case of cluster.

Crsctl start resources-starts CRS resources.

Crsctl stop resources-stops CRS resources.

Crsctl debug statedump evm-dumps state info for evm objects

Crsctl debug statedump crs-dumps state info for crs objects

Crsctl debug statedump css-dumps state info for css objects

Crsctl debug log css [module: level] {, module: level }...

-Turns on debugging for CSS

Crsctl debug trace css-dumps CSS in-memory tracing cache

Crsctl debug log crs [module: level] {, module: level }...

-Turns on debugging for CRS

Crsctl debug trace crs-dumps CRS in-memory tracing cache

Crsctl debug log evm [module: level] {, module: level }...

-Turns on debugging for EVM

Crsctl debug trace evm-dumps EVM in-memory tracing cache

Crsctl debug log res <resname: level> turns on debugging for resources

Crsctl query crs softwareversion [<nodename>]-lists the version of CRS software installed

Crsctl query crs activeversion-lists the CRS software operating version

Crsctl lsmodules css-lists the CSS modules that can be used for debugging

Crsctl lsmodules crs-lists the CRS modules that can be used for debugging

Crsctl lsmodules evm-lists the EVM modules that can be used for debugging

If necesary any of these commands can be run with additional tracing

Adding a "trace" argument at the very front.

Example: crsctl trace check css

Check the crs status:

[Oracle @ rac1 ~] # Crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

When crs is disabled:

[Oracle @ rac1 ~] # Crsctl check crs

Failure 1 contacting CSS daemon

Cannot communicate with CRS

Cannot communicate with EVM

Check the status of the three components cssd, crsd, and evmd respectively:

[Oracle @ rac1 ~] $ Crsctl check cssd

CSS appears healthy

[Oracle @ rac1 ~] $ Crsctl check crsd

CRS appears healthy

[Oracle @ rac1 ~] $ Crsctl check evmd

EVM appears healthy

Disable CRS Automatic startup (root ):

[Root @ rac1 ~] # Crsctl disable crs

Configure CRS automatic start (root ):

[Root @ rac1 ~] # Crsctl enable crs

These two commands actually modified the/etc/oracle/scls_scr/rac1/root/crsstart file.

Start CRS (root)

[Root @ rac1 ~] # Crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

Stop CRS (root)

[Root @ rac1 ~] # Crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

View the location of votedisk:

[Oracle @ rac1 ~] # Crsctl query css votedisk

0. 0/dev/raw/raw2

Located 1 votedisk (s ).

Get view settings

[Oracle @ rac1 ~] # Crsctl get css misscount

60

Set parameter modification (use with caution and do not tamper with it)

[Oracle @ rac1 ~] # Crsctl set css misscount 60

Configuration parameter misscount is now set to 60.

Trace the CRS module and provide diagnosis assistance

CRS consists of the CRS, CSS, and EVM services, and each Service is composed of a series of modules. crsctl allows each module to be tracked, record the trace content to the log.

Crs lsmodules can be used to view modules under each service:

[Oracle @ rac1 ~] $ Crsctl lsmodules css

The following are the CSS modules ::

CSSD

COMMCRS

COMMNS

[Oracle @ rac1 ~] $ Crsctl lsmodules crs

The following are the CRS modules ::

CRSUI

CRSCOMM

Crsrrti

CRSMAIN

CRSPLACE

CRSAPP

CRSRES

CRSCOMM

CRSOCR

CRSTIMER

CRSEVT

CRSD

CLUCLS

CSSCLNT

COMMCRS

COMMNS

[Oracle @ rac1 ~] $ Crsctl lsmodules evm

The following are the EVM modules ::

EVMD

EVMDMAIN

EVMCOMM

EVMEVT

EVMAPP

EVMAGENT

CRSOCR

CLUCLS

CSSCLNT

COMMCRS

COMMNS

To track the CSSD module, run the following command as the root user:

[Root @ rac1 ~] # Crsctl debug log css "CSSD: 1"

Configuration parameter trace is now set to 1.

Set CRSD Debug Module: CSSD Level: 1

Trace content in $ CRS_HOME/log/rac1/cssd/ocssd. log

[CSSD] 22:32:38. 992 [102603664]> TRACE: clssgmClientConnectMsg: Connect from con (0x8584fa8) proc (0x8584db0) pid () proto (10: 2: 1: 1)

Add Votedisk:

View the current votedisk

[Root @ rac1 cssd] # crsctl query css votedisk

Disable CRS

[Root @ rac1 cssd] # crsctl stop crs

Add votedisk:

[Root @ rac1 cssd] # crsctl add css votedisk/dev/raw/raw2

In this case, adding fails, because the votedisk must be added or deleted through the-force parameter even after the CRS is disabled. The-force parameter is only used when the crs is disabled.

Correct command for adding votedisk:

[Root @ rac1 cssd] # crsctl add css votedisk/dev/raw/raw2-force

View after adding

[Root @ rac1 cssd] # crsctl query css votedisk

Start crs

[Root @ rac1 cssd] # crsctl start crs

OCR command series:

1. ocrdump

Print the content in the ocr file for viewing. backup and recovery are not supported and can only be used for reading.

Ocrdump [-stdout] [filename] [-keyname name] [-xml]

Parameter description:

-Stdout: prints the content to the screen.

Filename: The content is output to the file.

-Keyname: prints only the content of a key and its subkeys.

-Xml: prints the output in xml format.

The following example prints the contents of the system.css key in. xml format to the screen.

[Oracle @ rac1 ~] $ Ocrdump-stdout-keyname SYSTEM.css-xml | more

<OCRDUMP>

<TIMESTAMP> 08/20/2014 23:01:32 </TIMESTAMP>

<COMMAND>/u01/crs1020/bin/ocrdump. bin-stdout-keyname SYSTEM.css-xml </COMMAND

>

<KEY>

<NAME> SYSTEM.css </NAME>

<VALUE_TYPE> UNDEF </VALUE_TYPE>

<VALUE> <! [CDATA []> </VALUE>

<USER_PERMISSION> PROCR_ALL_ACCESS </USER_PERMISSION>

<GROUP_PERMISSION> PROCR_READ </GROUP_PERMISSION>

<OTHER_PERMISSION> PROCR_READ </OTHER_PERMISSION>

<USER_NAME> root </USER_NAME>

<GROUP_NAME> root </GROUP_NAME>

<KEY>

<NAME> SYSTEM.css. interfaces </NAME>

<VALUE_TYPE> UNDEF </VALUE_TYPE>

<VALUE> <! [CDATA []> </VALUE>

<USER_PERMISSION> PROCR_ALL_ACCESS </USER_PERMISSION>

<GROUP_PERMISSION> PROCR_CREATE_SUB_KEY </GROUP_PERMISSION>

<OTHER_PERMISSION> PROCR_READ </OTHER_PERMISSION>

...........

If the command is executed incorrectly, a file named ocrdump _ <pid>. log is generated in the $ CRS_HOME/log/rac1/client directory. If a problem occurs during command execution, you can view the cause of the problem from this log.

2. ocrcheck

If the OCR content is consistent, the following output is generated:

[Oracle @ rac1 ~] $ Ocrcheck

Status of Oracle Cluster Registry is as follows:

Version: 2

Total space (kbytes): 104344

Used space (kbytes): 3808

Available space (kbytes): 100536

ID: 503754514

Device/File Name:/dev/raw/raw1

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

If the OCR content is inconsistent, the following prompt appears in the output:

Device/File needs to be synvhronixed with the other device

The ocrcheck _ <pid>. log file is generated in the $ CRS_HOME/log/<nodename>/client directory.

Oracle Database 10g CRS Release 10.2.0.1.0 Production Copyright 1996,200 5 Oracle. All rights reserved.

19:34:20. 922: [OCRCHECK] [3066518304] ocrcheck starts...

19:34:21. 654: [OCRCHECK] [3066518304] protchcheck: OCR status: total = [104344], used = [1980], avail = [102364]

19:34:21. 654: [OCRCHECK] [3066518304] Exiting [status = success]...

3. ocrconfig

[Oracle @ rac1 client] $ ocrconfig-help

Name:

Ocrconfig-Configuration tool for Oracle Cluster Registry.

Synopsis:

Ocrconfig [option]

Option:

-Export <filename> [-s online]

-Export cluster register contents to a file

-Import <filename>-Import cluster registry contents from a file

-Upgrade [<user> [<group>]

-Upgrade cluster registry from previous version

-Downgrade [-version <version string>]

-Downgrade cluster registry to the specified version

-Backuploc <dirname>-Configure periodic backup location

-Showbackup-Show backup information

-Restore <filename>-Restore from physical backup

-Replace ocr | ocrmirror [<filename>]-Add/replace/remove a OCR device/file

-Overwrite-Overwrite OCR configuration on disk

-Repair ocr | ocrmirror <filename>-Repair local OCR configuration

-Help-Print out this help information

Note:

A log file will be created in

$ ORACLE_HOME/log/

You have file creation privileges in the above directory before

Running this tool.

View the automatic backup of ocr (the ocr backup is completed by the master node and is performed once every four hours by default. If the backup shown on a node is a few months ago, the node is not the current master node ):

[Oracle @ rac1 client] $ ocrconfig-showbackup

Back up and restore OCR using exported import:

Before adjusting the cluster, for example, adding or deleting nodes, you should back up OCR once. You can use export to back up to the specified file. If replace or restore is performed, we recommend that you run the "cluvfy comp ocr-n all" command in Oracle to perform a comprehensive check.

(1) Disable CRS for all nodes

Node 1:

[Root @ rac1 crsd] # crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

Node 2:

[Root @ rac2 ~] # Crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

(2) Export the OCR content.

[Root @ rac1 crsd] # cd

[Root @ rac1 ~] # Ocrconfig-export ocrexp. exp

(3) Start CRS

Node 1:

[Root @ rac1 ~] # Crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

Node 2:

[Root @ rac2 ~] # Crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

[Root @ rac2 ~] # Crs_stat-t

Name Type Target State Host

------------------------------------------------------------

Ora... B1.inst application ONLINE rac1

Ora... B2.inst application ONLINE rac2

Ora. RACDB. db application ONLINE rac1

Ora... SM1.asm application ONLINE rac1

Ora... C1.lsnr application ONLINE rac1

Ora. rac1.gsd application ONLINE rac1

Ora. rac1.ons application ONLINE rac1

Ora. rac1.vip application ONLINE rac1

Ora... SM2.asm application ONLINE rac2

Ora... C2.lsnr application ONLINE rac2

Ora. rac2.gsd application ONLINE rac2

Ora. rac2.ons application ONLINE rac2

Ora. rac2.vip application ONLINE rac2

(4) Damage content in OCR

[Root @ rac2 ~] # Dd if =/dev/zero of =/dev/raw/raw1 bs = 1024 count = 102400

102400 + 0 records in

102400 + 0 records out

104857600 bytes (105 MB) copied, 41.7897 seconds, 2.5 MB/s

(5) Check the cluster status and OCR consistency:

[Root @ rac2 ~] # Crs_stat-t

CRS-0184: Cannot communicate with the CRS daemon.

[Root @ rac2 ~] # Ocrcheck

PROT-601: Failed to initialize ocrcheck

The cluster has been suspended and the consistency cannot be checked.

(6) use the clufy tool in the Clusterware installation package to check consistency

[Root @ rac1 cluvfy] #./runcluvfy. sh comp ocr-n all

Verifying OCR integrity

Unable to retrieve nodelist from Oracle clusterware.

Verification cannot proceed.

Check failed.

(7) use import to restore ocr content.

[Root @ rac1 ~] # Ocrconfig-import ocrexp. exp

(8) Check OCR again

[Root @ rac1 ~] # Ocrcheck

Status of Oracle Cluster Registry is as follows:

Version: 2

Total space (kbytes): 104344

Used space (kbytes): 3820

Available space (kbytes): 100524

ID: 1731255225

Device/File Name:/dev/raw/raw1

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

(9) Check the cluvfy Tool

[Root @ rac1 cluvfy] #./runcluvfy. sh comp ocr-n all

Verifying OCR integrity

Checking OCR integrity...

Checking the absence of a non-clustered configuration...

All nodes free of non-clustered, local-only deployments.

Uniqueness check for OCR device passed.

Checking the version of OCR...

OCR of correct Version "2" exists.

Checking data integrity of OCR...

Data integrity check for OCR passed.

OCR integrity check passed.

Verification of OCR integrity was successful.

Check is OK.

(10) Disable CRS

After the OCR is damaged, the CRS has stopped abnormally, but some processes are still alive. If you do not close the CRS first, directly starting the CRS will fail.

Node 1:

[Root @ rac1 crsd] # crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

Node 2:

[Root @ rac2 crsd] # crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

(10) Start CRS

Node 1:

[Root @ rac1 cluvfy] # crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

Node 2:

[Root @ rac2 ~] # Crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

[Root @ rac2 crsd] # crs_stat-t

Name Type Target State Host

------------------------------------------------------------

Ora... B1.inst application ONLINE rac1

Ora... B2.inst application ONLINE rac2

Ora. RACDB. db application ONLINE rac2

Ora... SM1.asm application ONLINE rac1

Ora... C1.lsnr application ONLINE rac1

Ora. rac1.gsd application ONLINE rac1

Ora. rac1.ons application ONLINE rac1

Ora. rac1.vip application ONLINE rac1

Ora... SM2.asm application ONLINE rac2

Ora... C2.lsnr application ONLINE rac2

Ora. rac2.gsd application ONLINE rac2

Ora. rac2.ons application ONLINE rac2

Ora. rac2.vip application ONLINE rac2

[Root @ rac2 crsd] # crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

Related Article

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.