【Oracle】RAC下的一些经常使用命令(一)
节点层:
olsnodes
-n:显示每一个节点编号。
[oracle@rac1 ~]# olsnodes -n
rac1 1
rac2 2
-p:显示每一个节点用于private interconnect的网络接口名称。
[oracle@rac1 ~]# olsnodes -p
rac1 rac1-priv
rac2 rac2-priv
-i:显示每一个节点的VIP
[oracle@rac1 ~]# olsnodes -i
rac1 rac1-vip
rac2 rac2-vip
-g:打印日志信息
[oracle@rac1 ~]# olsnodes -g
rac1
rac2
-v:打印具体日志信息
[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
网络层:
[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能够获得单个网口的信息
[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
集群层:
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 by
adding a "trace" argument at the very front.
Example: crsctl trace check css
检查crs状态:
[oracle@rac1 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
crs关闭的情况下:
[oracle@rac1 ~]# crsctl check crs
Failure 1 contacting CSS daemon
Cannot communicate with CRS
Cannot communicate with EVM
分别检查cssd、crsd、evmd三个组件的状态:
[oracle@rac1 ~]$ crsctl check cssd
CSS appears healthy
[oracle@rac1 ~]$ crsctl check crsd
CRS appears healthy
[oracle@rac1 ~]$ crsctl check evmd
EVM appears healthy
禁止CRS自己主动启动(root):
[root@rac1 ~]# crsctl disable crs
配置CRS自己主动启动(root):
[root@rac1 ~]# crsctl enable crs
这两个命令实际是改动了/etc/oracle/scls_scr/rac1/root/crsstart文件
启动CRS(root)
[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
停止CRS(root)
[root@rac1 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
查看votedisk的位置:
[oracle@rac1 ~]# crsctl query css votedisk
0. 0 /dev/raw/raw2
located 1 votedisk(s).
get查看设置
[oracle@rac1 ~]# crsctl get css misscount
60
set改动參数(要慎用,不能乱动)
[oracle@rac1 ~]# crsctl set css misscount 60
Configuration parameter misscount is now set to 60.
跟踪CRS模块。提供诊断辅助
CRS由CRS、CSS、EVM这3个服务组成。而每一个服务又是由一系列module(模块)组成,crsctl同意对于每一个module进行跟踪。并把跟踪内容记录记到日志中。
crs lsmodules能够用来查看每一个服务下的module:
[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
CRSRTI
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
跟踪CSSD模块,须要root用户运行:
[root@rac1 ~]# crsctl debug log css "CSSD:1"
Configuration parameter trace is now set to 1.
Set CRSD Debug Module: CSSD Level: 1
$CRS_HOME/log/rac1/cssd/ocssd.log中的跟踪内容
[ CSSD]2014-08-20 22:32:38.992 [102603664] >TRACE: clssgmClientConnectMsg: Connect from con(0x8584fa8) proc(0x8584db0) pid() proto(10:2:1:1)
加入Votedisk:
查看眼下的votedisk
[root@rac1 cssd]# crsctl query css votedisk
关闭CRS
[root@rac1 cssd]# crsctl stop crs
加入votedisk:
[root@rac1 cssd]# crsctl add css votedisk /dev/raw/raw2
此时会加入失败,由于即使是在CRS关闭以后。也必须通过-force參数来添加或删除votedisk。而且-force參数仅仅有在crs关闭的场合下使用才安全。
正确加入votedisk的命令:
[root@rac1 cssd]# crsctl add css votedisk /dev/raw/raw2 -force
加入完后查看
[root@rac1 cssd]# crsctl query css votedisk
启动crs
[root@rac1 cssd]# crsctl start crs
OCR命令系列:
1.ocrdump
打印出ocr中的内容进行查看。不能进行备份恢复,仅仅能用于阅读。
ocrdump [-stdout] [filename] [-keyname name] [-xml]
參数说明:
-stdout:把内容打印输出到屏幕上。
Filename:内容输出到文件里。
-keyname:仅仅打印某个键及其子键的内容。
-xml:以xml格式打印输出。
以下样例把SYSTEM.css键的内容以.xml格式打印输出到屏幕。
[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>
...........
假设此命令运行有问题,会在$CRS_HOME/log/rac1/client文件夹下产生文件,文件名称ocrdump_<pid>.log。
假设命令运行出现故障,能够从这个日志查看问题原因。
2.ocrcheck
假设OCR内容一致,产生例如以下输出:
[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
假设OCR内容不一致。输出中会出现下面提示:
Device/File needs to be synvhronixed with the other device
运行这个命令过程中。会在$CRS_HOME/log/<nodename>/client文件夹下产生ocrcheck_<pid>.log日志文件。
Oracle Database 10g CRS Release 10.2.0.1.0 Production Copyright 1996, 2005 Oracle. All rights reserved.
2014-08-20 19:34:20.922: [OCRCHECK][3066518304]ocrcheck starts...
2014-08-20 19:34:21.654: [OCRCHECK][3066518304]protchcheck: OCR status : total = [104344], used = [1980], avail = [102364]
2014-08-20 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/<hostname>/client/ocrconfig_<pid>.log. Please ensure
you have file creation privileges in the above directory before
running this tool.
查看ocr的自己主动备份(ocr的备份由master节点完毕。默认四小时一次,假设在某个节点上看到的备份为几个月前的。则该节点不是当前的master节点):
[oracle@rac1 client]$ ocrconfig -showbackup
使用导出导入进行OCR的备份和恢复:
在对集群做调整前,如:增删节点等操作前。应该对OCR进行一次备份,能够使用export备份到指定文件。
假设做了replace或restore等操作,Oracle建议使用”cluvfy comp ocr -n all”命令做一次全面检查。
(1)关闭全部节点的CRS
节点1:
[root@rac1 crsd]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
节点2:
[root@rac2 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
(2)导出OCR的内容。
[root@rac1 crsd]# cd
[root@rac1 ~]# ocrconfig -export ocrexp.exp
(3)启动CRS
节点一:
[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
节点二:
[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 ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
(4)破坏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)检查集群状态,OCR一致性:
[root@rac2 ~]# crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
[root@rac2 ~]# ocrcheck
PROT-601: Failed to initialize ocrcheck
集群已经挂掉,一致性无法检查。
(6)使用Clusterware安装包中的clufy工具检查一致性
[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.
Verification cannot proceed.
检查失败。
(7)使用import恢复ocr内容。
[root@rac1 ~]# ocrconfig -import ocrexp.exp
(8)再次检查OCR
[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)cluvfy工具检查
[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 configurations.
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.
检查也没问题。
(10)关闭CRS
OCR被破坏后CRS已经异常停止,但有些进程依旧存活。假设不先关闭下CRS,直接启动CRS会无法启动。
节点一:
[root@rac1 crsd]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
节点二:
[root@rac2 crsd]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
(10)启动CRS
节点一:
[root@rac1 cluvfy]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
节点二:
[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 ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac2
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac2 crsd]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
【Oracle】RAC下的一些经常使用命令(一)的更多相关文章
- ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)
不论是单实例还是RAC,对于非缺省端口下(1521)的监听器,pmon进程不会将service/instance注册到监听器,即不会实现动态注册.与单实例相同,RAC非缺省端口的监听器也是通过设置参数 ...
- [ArcGIS]Oracle RAC下创建地理数据库(Create Enterprise Geodatabase)失败的解决方法
转载请注明原文地址:http://www.cnblogs.com/litou/p/8028843.html 环境:Oracle 11g 11.2.0.1.0(双节点RAC群集),ArcGIS Desk ...
- oracle rac下调节redo log file 文件大小
rac下调节redo log file 文件大小 (1)查看当前日志信息: select * from v$logfile; (步骤2中得路径能够在这里MEMBER列看到,redo文件名称自己命名.比 ...
- Oracle Linux下使用sqlplus的edit命令
1.使当前会话生效 define_editor=vi SQL> select * from dual; D - X SQL> edit Wrote file afiedt.buf 21 1 ...
- oracle rac常用的命令
oracle rac常用的命令 节点层:olsnodes 网络层: oifcfg 集群层:crsctl,ocrcheck,ocrdump,ocrconfig 应用层:srvctl,onsctl,crs ...
- Oracle RAC 环境下的 v$log v$logfile
通常情况下,在Oracle RAC 环境中,v$视图可查询到你所连接实例的相关信息,而gv$视图则包含所有实例的信息.然而在RAC环境中,当我们查询v$log视图时说按照常理的话,v$log视图应当看 ...
- Oracle RAC 负载均衡测试(结合服务器端与客户端)
Oracle RAC 负载均衡使得从客户端发起的连接能够有效地分配到监听器负载较小的实例上.有两种方式实现客户端负载均衡,一是通过配置客户端的load_balance,一是通过配置服务器端的remot ...
- Oracle RAC 服务器端连接负载均衡(Load Balance)
Oracle RAC服务器端的负载均衡是根据RAC中各节点的连接负荷数情况,将新的连接请求分配到负荷最小的节点上去.当数据库处于运行时,RAC中各节点的PMON进程每3秒会将各自节点的连接负荷数更新到 ...
- Oracle RAC 客户端连接负载均衡(Load Balance)
实现负载均衡(Load Balance)是Oracle RAC最重要的特性之一,主要是把负载平均分配到集群中的各个节点,以提高系统的整体吞吐能力.通常情况下有两种方式来实现负载均衡,一个是基于客户端连 ...
随机推荐
- 用开源项目circular progress button实现有进度条的Button
circular progress button可以让button实现进度条,效果和动画都做的很赞,只是有点小bug.需要注意的是按钮上的文字不能太大,否则会出现错位. 项目的地址:https://g ...
- 使用Python读取Mp3的标签信息
什么是ID3 MP3是音频文件最流行的格式,它的全称是 MPEG layer III.但是这种格式不支持对于音频内容的描述信息,包括歌曲名称.演唱者.专辑等等. 因此在1996年,Eric Kemp在 ...
- LaTeX技巧:LaTeX括号总结
功能 语法 显示 不好看 ( \frac{1}{2} ) 好一点 \left( \frac{1}{2} \right) 您可以使用\left和\right来显示不同的括号: 功能 语法 显示 ...
- HTTPS安全证书介绍
IIS配置web SSL 安全证书Https访问 From : http://cao416451347ming.blog.163.com/blog/static/1154556162010217441 ...
- ptime概述
官方给出的ptime的定义是:ptime gives the length of time in milliseconds represented by themedia in a packet.简单 ...
- android 很多应用中用到的 listView + viewPager
比如网易啊啥的, 有些界面的 listview 第一行是可以 左右滑动的 viewpager,当滑动下面listView的时候 会一起滑动上去 工程目录: 效果图: ...
- C#如何判断线程池中所有的线程是否已经完成(转)
其 实很简单用ThreadPool.RegisterWaitForSingleObject方法注册一个定时检查线程池的方法,在检查线程的方法内调用 ThreadPool.GetAvailableThr ...
- impala 导出CSV 或excel
1.介绍 impala-shell导入导出 参数说明: • -q query (--query=query) 从命令行执行查询,不进入impala-shell • -d default_db (--d ...
- BuildTask & BuildType
Build Tasks 在build文件中使用了Android或者Java插件之后就会自动创建一系列可以运行的任务. Gradle中有如下一下默认约定的任务: assemble 该任务包含了项目中的所 ...
- 【Scala】Java-Scala-单例模式实现方法
Java-Scala-单例模式实现方法 scala 单例_百度搜索 scala实现单例模式-博客-云栖社区-阿里云