在这里记录下RAC的基本管理手段,一点一滴添加和备注信息。
各种RAC词汇
RAC:Real application clusters
CRS:Cluster ready service
CSS:Cluster Synchronization Services
OCR:Oracle cluster register
Votingdisk:表决磁盘
一、管理日志:
集群后台进程日志路径:/u01/app/11.2.0/grid/log/rac1
这里可以看到许多后台进程日志目录,根据各个组件情况对应查看日志文件。
[grid@rac1 rac1]$ ll
total 112
drwxr-x--- 2 grid oinstall 4096 Jan 7 17:25 admin
drwxrwxr-t 4 root oinstall 4096 Jan 7 17:25 agent
-rw-rw-r-- 1 root root 46979 Jan 14 11:05 alertrac1.log
drwxr-x--- 2 grid oinstall 4096 Jan 14 11:29 client
drwxr-x--- 2 root oinstall 4096 Jan 8 12:41 crsd
drwxr-x--- 2 grid oinstall 4096 Jan 7 17:26 cssd
drwxr-x--- 2 root oinstall 4096 Jan 14 11:54 ctssd
drwxr-x--- 2 grid oinstall 4096 Jan 8 14:24 diskmon
drwxr-x--- 2 grid oinstall 4096 Jan 7 17:30 evmd
drwxr-x--- 2 grid oinstall 4096 Jan 7 17:26 gipcd
drwxr-x--- 2 root oinstall 4096 Jan 7 17:25 gnsd
drwxr-x--- 2 grid oinstall 4096 Jan 14 11:02 gpnpd
drwxr-x--- 2 grid oinstall 4096 Jan 7 17:26 mdnsd
drwxr-x--- 2 root oinstall 4096 Jan 7 17:26 ohasd
drwxrwxr-t 5 grid oinstall 4096 Jan 13 00:04 racg
drwxr-x--- 2 grid oinstall 4096 Jan 14 11:03 srvm
二、管理命令:
crsctl 命令
crsctl check crs
[grid@rac1 rac1]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
crsctl check css
[grid@rac1 rac1]$ crsctl check css
CRS-4529: Cluster Synchronization Services is online
crsctl check cluster -all
[grid@rac1 rac1]$ crsctl check cluster -all
**************************************************************
rac1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
rac2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
crsctl start/stop resources
crsctl stop crs
查看组件资源的互相依赖关系
crsctl stat res ora.orcl.db -p
crsctl stat res ora.scan1.vip -p
crs_stat命令
crs_stat -t 查看组件资源服务
[grid@rac1 rac1]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.BACK.dg ora....up.type ONLINE ONLINE rac1
ora.DATA.dg ora....up.type ONLINE ONLINE rac1
ora.FILES.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.eons ora.eons.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE rac1
ora.orcl.db ora....se.type ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
crs_stat -v 查看指定组件资源服务
[grid@rac1 rac1]$ crs_stat -v ora.scan1.vip
NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
RESTART_ATTEMPTS=0
RESTART_COUNT=0
FAILURE_THRESHOLD=0
FAILURE_COUNT=0
TARGET=ONLINE
STATE=ONLINE on rac
crsctl register resource
OCR
ocrconfig -showbackup
[grid@rac1 rac1]$ ocrconfig -showbackup
rac2 2015/01/13 22:41:57 /u01/app/11.2.0/grid/cdata/rac-cluster/backup00.ocr
rac2 2015/01/13 18:41:57 /u01/app/11.2.0/grid/cdata/rac-cluster/backup01.ocr
rac2 2015/01/13 14:41:56 /u01/app/11.2.0/grid/cdata/rac-cluster/backup02.ocr
rac1 2015/01/12 15:33:05 /u01/app/11.2.0/grid/cdata/rac-cluster/day.ocr
rac1 2015/01/07 21:45:05 /u01/app/11.2.0/grid/cdata/rac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
导出导入OCR
ocrconfig -export
ocrconfig -import
恢复OCR
ocrcheck
[grid@rac1 rac1]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2568
Available space (kbytes) : 259552
ID : 1018222697
Device/File Name : +DATA
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check bypassed due to non-privileged user
VOTINGDISK
crsctl query css votedisk
[grid@rac1 rac1]$ crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 69b8a9f606a74f0cbf2ba5e9bded9d9e (ORCL:VOL1) [DATA]
2. ONLINE 715323d6e1a84f39bf492e94c7bb208b (ORCL:VOL2) [DATA]
3. ONLINE 64ffd38b5a2d4f6dbf4a47adef5c9340 (ORCL:VOL3) [DATA]
Located 3 voting disk(s).
srvctl 命令
启动和关闭实例
srvctl stop database -d db_unique_name
tail -f /u01/app/oracle/diag/rdbms/orcl/orcl1/trace/alert_orcl1.log
用crs_stat -t 查看组件资源
ora.orcl.db ora....se.type OFFLINE OFFLINE
或者执行
[grid@rac1 ~]$ crs_stat -v ora.orcl.db
NAME=ora.orcl.db
TYPE=ora.database.type
RESTART_ATTEMPTS=2
RESTART_COUNT=0
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=orcl1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=orcl2
USR_ORA_INST_NAME@SERVERNAME(rac1)=orcl1
USR_ORA_INST_NAME@SERVERNAME(rac2)=orcl2
FAILURE_THRESHOLD=1
FAILURE_COUNT=0
TARGET=OFFLINE
STATE=OFFLINE
srvctl start database -d db_unique_name
启动时也可以按照此方法查看。
查看DB状态
srvctl status database -d db_unique_name
[grid@rac1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node rac1
Instance orcl2 is not running on node rac2
三、系统进程
rac进程、ASM实例进程
ps -U grid -f
[root@rac1 ~]# ps -U grid -f
UID PID PPID C STIME TTY TIME CMD
grid 2800 1 0 11:02 ? 00:00:21 /u01/app/11.2.0/grid/bin/oraagent.bin
grid 2813 1 0 11:02 ? 00:00:00 /u01/app/11.2.0/grid/bin/gipcd.bin
grid 2818 1 0 11:02 ? 00:00:00 /u01/app/11.2.0/grid/bin/mdnsd.bin
grid 2832 1 0 11:02 ? 00:00:14 /u01/app/11.2.0/grid/bin/gpnpd.bin
grid 2893 1 4 11:02 ? 00:07:01 /u01/app/11.2.0/grid/bin/ocssd.bin
grid 2909 1 0 11:02 ? 00:00:12 /u01/app/11.2.0/grid/bin/diskmon.bin -d -f
grid 2989 1 0 11:02 ? 00:00:26 /u01/app/11.2.0/grid/bin/evmd.bin
grid 3064 1 0 11:03 ? 00:00:01 asm_pmon_+ASM1
grid 3066 1 2 11:03 ? 00:03:30 asm_vktm_+ASM1
grid 3070 1 0 11:03 ? 00:00:00 asm_gen0_+ASM1
grid 3072 1 0 11:03 ? 00:00:05 asm_diag_+ASM1
grid 3074 1 0 11:03 ? 00:00:00 asm_ping_+ASM1
grid 3076 1 0 11:03 ? 00:00:00 asm_psp0_+ASM1
grid 3078 1 0 11:03 ? 00:00:28 asm_dia0_+ASM1
grid 3080 1 0 11:03 ? 00:00:15 asm_lmon_+ASM1
grid 3083 1 0 11:03 ? 00:00:11 asm_lmd0_+ASM1
grid 3087 1 0 11:03 ? 00:00:34 asm_lms0_+ASM1
grid 3091 1 0 11:03 ? 00:00:00 asm_lmhb_+ASM1
grid 3093 1 0 11:03 ? 00:00:00 asm_mman_+ASM1
grid 3095 1 0 11:03 ? 00:00:00 asm_dbw0_+ASM1
grid 3097 1 0 11:03 ? 00:00:00 asm_lgwr_+ASM1
grid 3099 1 0 11:03 ? 00:00:00 asm_ckpt_+ASM1
grid 3101 1 0 11:03 ? 00:00:00 asm_smon_+ASM1
grid 3103 1 0 11:03 ? 00:00:03 asm_rbal_+ASM1
grid 3105 1 0 11:03 ? 00:00:03 asm_gmon_+ASM1
grid 3107 1 0 11:03 ? 00:00:00 asm_mmon_+ASM1
grid 3109 1 0 11:03 ? 00:00:01 asm_mmnl_+ASM1
grid 3111 1 0 11:03 ? 00:00:10 /u01/app/11.2.0/grid/bin/oclskd.bin
grid 3115 1 0 11:03 ? 00:00:00 asm_lck0_+ASM1
grid 3161 1 0 11:03 ? 00:00:00 asm_asmb_+ASM1
grid 3163 1 0 11:03 ? 00:00:00 oracle+ASM1_asmb_+asm1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=be
grid 3189 1 0 11:03 ? 00:00:00 oracle+ASM1_ocr (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 3234 2989 0 11:03 ? 00:00:00 /u01/app/11.2.0/grid/bin/evmlogger.bin -o /u01/app/11.2.0/grid/evm/l
grid 3280 1 0 11:03 ? 00:00:09 /u01/app/11.2.0/grid/bin/oraagent.bin
grid 3411 1 0 11:03 ? 00:00:00 /u01/app/11.2.0/grid/opmn/bin/ons -d
grid 3412 3411 0 11:03 ? 00:00:00 /u01/app/11.2.0/grid/opmn/bin/ons -d
grid 3427 1 0 11:03 ? 00:00:15 /u01/app/11.2.0/grid/jdk/jre//bin/java -Doracle.supercluster.cluster
grid 3512 1 0 11:03 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid 3514 1 0 11:03 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
grid 7850 7846 0 13:24 pts/1 00:00:00 -bash
grid 7873 7850 2 13:24 pts/1 00:00:18 /u01/app/11.2.0/grid/jdk/jre/bin/java -DORACLE_HOME=/u01/app/11.2.0/
grid 8025 7873 0 13:24 pts/1 00:00:00 /u01/app/11.2.0/grid/bin/sqlplus -S -N
grid 8034 8025 0 13:24 ? 00:00:00 oracle+ASM1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
查看Oracle 、root
[root@rac1 ~]# ps -U root -f|grep /u01
root 2477 1 1 11:00 ? 00:02:10 /u01/app/11.2.0/grid/bin/ohasd.bin reboot
root 2843 1 1 11:02 ? 00:01:55 /u01/app/11.2.0/grid/bin/cssdmonitor
root 2862 1 1 11:02 ? 00:01:43 /u01/app/11.2.0/grid/bin/cssdagent
root 2896 1 0 11:02 ? 00:00:04 /u01/app/11.2.0/grid/bin/orarootagent.bin
root 2974 1 0 11:02 ? 00:00:06 /u01/app/11.2.0/grid/bin/octssd.bin reboot
root 3145 1 0 11:03 ? 00:01:07 /u01/app/11.2.0/grid/bin/crsd.bin reboot
root 3186 1 0 11:03 ? 00:00:10 /u01/app/11.2.0/grid/bin/oclskd.bin
root 3284 1 0 11:03 ? 00:00:44 /u01/app/11.2.0/grid/bin/orarootagent.bin
[root@rac1 ~]# ps -U oracle -f
UID PID PPID C STIME TTY TIME CMD
oracle 3563 1 0 11:03 ? 00:00:18 /u01/app/11.2.0/grid/bin/oraagent.bin
oracle 3679 1 0 11:04 ? 00:00:01 ora_pmon_orcl1
oracle 3681 1 2 11:04 ? 00:03:33 ora_vktm_orcl1
oracle 3685 1 0 11:04 ? 00:00:00 ora_gen0_orcl1
oracle 3687 1 0 11:04 ? 00:00:06 ora_diag_orcl1
oracle 3689 1 0 11:04 ? 00:00:00 ora_dbrm_orcl1
oracle 3691 1 0 11:04 ? 00:00:00 ora_ping_orcl1
oracle 3693 1 0 11:04 ? 00:00:00 ora_psp0_orcl1
oracle 3695 1 0 11:04 ? 00:00:00 ora_acms_orcl1
oracle 3697 1 0 11:04 ? 00:00:33 ora_dia0_orcl1
oracle 3699 1 0 11:04 ? 00:00:15 ora_lmon_orcl1
oracle 3701 1 0 11:04 ? 00:00:12 ora_lmd0_orcl1
oracle 3705 1 0 11:04 ? 00:01:07 ora_lms0_orcl1
oracle 3709 1 0 11:04 ? 00:00:00 ora_rms0_orcl1
oracle 3711 1 0 11:04 ? 00:00:00 ora_lmhb_orcl1
oracle 3713 1 0 11:04 ? 00:00:00 ora_mman_orcl1
oracle 3715 1 0 11:04 ? 00:00:01 ora_dbw0_orcl1
oracle 3717 1 0 11:04 ? 00:00:01 ora_lgwr_orcl1
oracle 3719 1 0 11:04 ? 00:00:03 ora_ckpt_orcl1
oracle 3721 1 0 11:04 ? 00:00:00 ora_smon_orcl1
oracle 3723 1 0 11:04 ? 00:00:00 ora_reco_orcl1
oracle 3725 1 0 11:04 ? 00:00:00 ora_rbal_orcl1
oracle 3727 1 0 11:04 ? 00:00:00 ora_asmb_orcl1
oracle 3729 1 0 11:04 ? 00:00:02 ora_mmon_orcl1
oracle 3731 1 0 11:04 ? 00:00:01 ora_mmnl_orcl1
oracle 3733 1 0 11:04 ? 00:00:00 ora_d000_orcl1
oracle 3735 1 0 11:04 ? 00:00:00 ora_s000_orcl1
oracle 3737 1 0 11:04 ? 00:00:11 /u01/app/11.2.0/grid/bin/oclskd.bin
grid 3739 1 0 11:04 ? 00:00:00 oracle+ASM1_asmb_orcl1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 3742 1 0 11:04 ? 00:00:04 ora_lck0_orcl1
oracle 3747 1 0 11:04 ? 00:00:00 ora_mark_orcl1
oracle 3753 1 0 11:04 ? 00:00:00 ora_rsmn_orcl1
oracle 3813 1 0 11:04 ? 00:00:00 ora_arc0_orcl1
oracle 3815 1 0 11:04 ? 00:00:00 ora_arc1_orcl1
oracle 3817 1 0 11:04 ? 00:00:00 ora_arc2_orcl1
oracle 3819 1 0 11:04 ? 00:00:00 ora_arc3_orcl1
oracle 3837 1 0 11:05 ? 00:00:00 ora_gtx0_orcl1
oracle 3839 1 0 11:05 ? 00:00:00 ora_rcbg_orcl1
oracle 3841 1 0 11:05 ? 00:00:00 ora_qmnc_orcl1
oracle 3860 1 0 11:05 ? 00:00:09 oracleorcl1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 3874 1 0 11:05 ? 00:00:00 ora_q000_orcl1
oracle 3878 1 0 11:05 ? 00:00:00 ora_q001_orcl1
oracle 3904 1 0 11:05 ? 00:00:03 ora_cjq0_orcl1
oracle 4046 1 0 11:10 ? 00:00:00 ora_smco_orcl1
oracle 5499 1 0 12:04 ? 00:00:00 ora_pz99_orcl1
oracle 8421 1 0 13:40 ? 00:00:00 ora_w000_orcl1