在经历了几次服务器意外断电,启动rac报错;觉得之前直接“shutdown -h now”这种方式还是太“粗暴”,需要一种“温柔”的方式来操作她。
查看一下RAC节点的服务状态 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [grid@rac1 ~]$ crs_stat -t -v Name Type R/RA F/FT Target State Host ---------------------------------------------------------------------- ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1 ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE rac1 ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1 ora.OCR.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1 ora....DISK.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1 ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE rac1 ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE rac1 ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE ora....network ora....rk.type 0/5 0/ ONLINE ONLINE rac1 ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE rac2 ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE rac1 ora.orcl.db ora....se.type 0/2 0/1 ONLINE ONLINE rac1 ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1 ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1 ora.rac1.gsd application 0/5 0/0 OFFLINE OFFLINE ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1 ora.rac1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1 ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2 ora....C2.lsnr application 0/5 0/0 OFFLINE OFFLINE ora.rac2.gsd application 0/5 0/0 OFFLINE OFFLINE ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2 ora.rac2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac2 ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1 ora.sx21.db ora....se.type 0/2 0/1 ONLINE ONLINE rac1
关闭RAC 关闭顺序:关闭数据库(实例)–>关闭ASM实例–>关闭节点服务
关闭数据库 1 2 3 --关闭数据库 srvctl stop database -d sx21 srvctl stop database -d orcl
关闭ASM实例 从11.2 Grid Infrastructure开始, ASM diskgroups也注册为CRS资源。而diskgroup资源是依赖于ASM的,所以不能首先要停止’ora.ASM.dg’这个服务,或者直接使用-f选项强制停止ASM。
1 2 3 4 5 6 7 8 -- 查看asm磁盘相关信息 sqlplus / as sysasm SQL> select instance_name,status from v$instance; SQL> col name format a10 SQL> set line 9999 SQL> col path format a15 SQL> select group_number,path,name,disk_number,total_mb,free_mb,create_date,mount_status,mount_date from v$asm_disk order by group_number desc,disk_number; SQL> select name,state,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup;
1 2 3 4 --关闭磁盘组, 状态从ONLINE变成OFFLINE srvctl stop diskgroup -g data srvctl stop diskgroup -g ocr srvctl stop diskgroup -g votingdisk
1 2 3 --关闭asm srvctl stop asm -n rac1 srvctl stop asm -n rac2
关闭各节点的服务包括:listener、gsd、ons、vip 1 2 srvctl stop nodeapps -n rac1 srvctl stop nodeapps -n rac2
启动RAC 启动顺序:启动节点服务–>启动ASM实例–>启动数据库实例
启动各节点的服务包括:listener、gsd、ons、vip 1 2 srvctl start nodeapps -n rac1 srvctl start nodeapps -n rac2
启动asm 1 2 srvctl start asm -n rac1 srvctl start asm -n rac2
启动数据库 1 2 srvctl start database -d sx21 srvctl start database -d orcl
RAC常用操作命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 --查看集群状态 crsctl stat res -t crsctl check cluster -all crs_stat -t -v --查看数据库配置 srvctl config database -d sx21 --查看数据库状态 srvctl status database -d sx21 --启动数据库 srvctl start database -d sx21 --关闭数据库 srvctl stop database -d sx21 --查看asm状态 srvctl status asm -n rac1 srvctl status asm -n rac2 --关闭asm 状态从ONLINE变成OFFLINE srvctl stop diskgroup -g data srvctl stop diskgroup -g ocr srvctl stop diskgroup -g votingdisk --开启asm srvctl start diskgroup -g data srvctl start diskgroup -g ocr srvctl start diskgroup -g votingdisk --查看vip状态 srvctl status vip -n rac1 -v --启动vip srvctl start vip -n rac1 -v --停止vip srvctl stop vip -n rac2 -f -v srvctl stop vip -n rac1 -f -v -- 查看asm磁盘相关信息 sqlplus / as sysasm SQL> select instance_name,status from v$instance; SQL> col name format a10 SQL> set line 9999 SQL> col path format a15 SQL> select group_number,path,name,disk_number,total_mb,free_mb,create_date,mount_status,mount_date from v$asm_disk order by group_number desc,disk_number; SQL> select name,state,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup; --------------------------------------------------------- 以下操作需要使用root用户 -- 单一节点启动 crsctl start has crsctl start crs crsctl check crs -- 所有节点启动 crsctl status cluster -n rac1 rac2 crsctl start cluster -all crsctl check cluster -all