Oracle 10gR2 RAC的啟動和關閉步驟
1.RAC有随伺服器啟動的腳本,放在/etc/inittab裡:
[[email protected] bin]$ cat /etc/inittab
...
h1:35:respawn:/etc/init.d/init.evmd run>/dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal>/dev/null 2>&1 </dev/null
h3:35:respawn:/etc/init.d/init.crsd run>/dev/null 2>&1 </dev/null
一般情況下,RAC叢集伺服器腳本會随伺服器啟動,如果啟動失敗,需要手動啟動。
2.RAC 人工關閉
2.1 可以用指令一次關閉相關所有程序
[[email protected] ~]$ cd /opt/oracle/product/10.2.0/crs_1/bin/
[[email protected] bin]$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.dgstd.db application ONLINE ONLINE node2
ora....d1.inst application ONLINE ONLINE node1
ora....d2.inst application ONLINE ONLINE node2
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
[[email protected] bin]$ ./crs_stop -all
Attempting to stop `ora.node1.ons` on member`node1`
Attempting to stop `ora.node1.gsd` on member`node1`
Attempting to stop `ora.node2.ons` on member`node2`
Attempting to stop `ora.node2.gsd` on member`node2`
Attempting to stop `ora.dgstd.db` on member`node2`
Stop of `ora.node1.gsd` on member `node1`succeeded.
Stop of `ora.node1.ons` on member `node1`succeeded.
Stop of `ora.node2.gsd` on member `node2`succeeded.
Stop of `ora.node2.ons` on member `node2`succeeded.
Stop of `ora.dgstd.db` on member `node2`succeeded.
`ora.dgstd.dgstd1.inst` is already OFFLINE.
`ora.dgstd.dgstd2.inst` is already OFFLINE.
Attempting to stop`ora.node1.LISTENER_NODE1.lsnr` on member `node1`
Attempting to stop `ora.node2.LISTENER_NODE2.lsnr`on member `node2`
Attempting to stop `ora.node1.ASM1.asm` onmember `node1`
Attempting to stop `ora.node2.ASM2.asm` onmember `node2`
Stop of `ora.node1.LISTENER_NODE1.lsnr` onmember `node1` succeeded.
Attempting to stop `ora.node1.vip` on member`node1`
Stop of `ora.node2.LISTENER_NODE2.lsnr` onmember `node2` succeeded.
Attempting to stop `ora.node2.vip` on member`node2`
Stop of `ora.node1.vip` on member `node1`succeeded.
Stop of `ora.node2.vip` on member `node2`succeeded.
Stop of `ora.node1.ASM1.asm` on member `node1`succeeded.
Stop of `ora.node2.ASM2.asm` on member `node2`succeeded.
CRS-0216: Could not stop resource'ora.dgstd.dgstd1.inst'.
CRS-0216: Could not stop resource 'ora.dgstd.dgstd2.inst'.
這裡檢視都已經offline了,說明關閉成功:
[[email protected] bin]$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.dgstd.db application OFFLINE OFFLINE
ora....d1.inst application OFFLINE OFFLINE
ora....d2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....E1.lsnr application OFFLINE OFFLINE
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application OFFLINE OFFLINE
ora.node1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
2.2 手動關閉某個節點
關閉順序:
emctl stop dbconsole
srvctl stop instance -d DGSTD -i dgstd1
srvctl stop instance -d DGSTD -i dgstd2
srvctl stop asm -n dgstd1
srvctl stop asm -n dgstd2
srvctl stop nodeapps -n dgstd1
srvctl stop nodeapps -n dgstd2
檢視是否都已經offline
#./crs_stat–t
2.3 也可以使用 SRVCTL 停止所有執行個體及其啟用的服務。
srvctl stop database -d DGPRI
3.RAC 人工啟動
3.1 可以用指令一次啟動相關所有程序
[[email protected] bin]$ ./crs_start -all
Attempting to start `ora.node1.vip` on member`node1`
Attempting to start `ora.node1.ASM1.asm` onmember `node1`
Attempting to start `ora.dgstd.dgstd2.inst` onmember `node2`
Attempting to start `ora.node2.ASM2.asm` onmember `node2`
Attempting to start `ora.dgstd.dgstd1.inst` onmember `node1`
Attempting to start `ora.node2.vip` on member`node2`
Start of `ora.node1.vip` on member `node1`succeeded.
Attempting to start`ora.node1.LISTENER_NODE1.lsnr` on member `node1`
Start of `ora.node2.vip` on member `node2`succeeded.
Attempting to start`ora.node2.LISTENER_NODE2.lsnr` on member `node2`
Start of `ora.node2.LISTENER_NODE2.lsnr` onmember `node2` succeeded.
Start of `ora.node1.LISTENER_NODE1.lsnr` onmember `node1` succeeded.
Start of `ora.node2.ASM2.asm` on member`node2` succeeded.
Start of `ora.node1.ASM1.asm` on member`node1` succeeded.
Start of `ora.dgstd.dgstd1.inst` on member`node1` succeeded.
Start of `ora.dgstd.dgstd2.inst` on member`node2` succeeded.
CRS-1002: Resource 'ora.node1.ons' is alreadyrunning on member 'node1'
CRS-1002: Resource 'ora.node2.ons' is alreadyrunning on member 'node2'
CRS-1002: Resource 'ora.dgstd.db' is alreadyrunning on member 'node2'
Attempting to start `ora.node1.gsd` on member`node1`
Attempting to start `ora.node2.gsd` on member`node2`
Start of `ora.node1.gsd` on member `node1`succeeded.
Start of `ora.node2.gsd` on member `node2`succeeded.
CRS-0223: Resource 'ora.dgstd.db' hasplacement error.
CRS-0223: Resource 'ora.node1.ons' hasplacement error.
CRS-0223: Resource 'ora.node2.ons' hasplacement error.
檢視叢集伺服器已經全部online了,一般情況下,說明資料庫兩個節點已經啟動
[[email protected] bin]$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.dgstd.db application ONLINE ONLINE node2
ora....d1.inst application ONLINE ONLINE node1
ora....d2.inst application ONLINE ONLINE node2
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
通過sqlplus指令進入伺服器最後确認資料庫的狀态:
[[email protected] bin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production onWed Dec 12 18:19:31 2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release10.2.0.4.0 - 64bit Production
With the Partitioning, Real ApplicationClusters, OLAP, Data Mining
and Real Application Testing options
SQL> selectinst_id,instance_name,version,startup_time,status from gv$instance;
INST_ID INSTANCE_NAME VERSION STARTUP_T STATUS
---------- ---------------- -------------------------- ------------
1 dgstd1 10.2.0.4.0 12-DEC-12 MOUNTED
2 dgstd2 10.2.0.4.0 12-DEC-12MOUNTED
-----發現資料庫還在mounted狀态
SQL> alter database open; ---打開資料庫
Database altered.
SQL> selectinst_id,instance_name,version,startup_time,status from gv$instance;
INST_ID INSTANCE_NAME VERSION STARTUP_T STATUS
---------- ---------------- -------------------------- ------------
1 dgstd1 10.2.0.4.0 12-DEC-12 OPEN
2 dgstd2 10.2.0.4.0 12-DEC-12 MOUNTED
登入到另外一個節點,同樣執行open指令:
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production onWed Dec 12 18:36:29 2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release10.2.0.4.0 - 64bit Production
With the Partitioning, Real ApplicationClusters, OLAP, Data Mining
and Real Application Testing options
SQL> alter database open;
Database altered.
SQL> select inst_id,instance_name,version,startup_time,statusfrom gv$instance;
INST_ID INSTANCE_NAME VERSION STARTUP_T STATUS
---------- ---------------- -------------------------- ------------
2 dgstd2 10.2.0.4.0 12-DEC-12 OPEN
1 dgstd1 10.2.0.4.0 12-DEC-12 OPEN -
---資料庫已經完全打開,至此,已經完全啟動
3.2 手動啟動某個節點
啟動順序:
srvctl stop nodeapps -n dgstd1
srvctl stop nodeapps -n dgstd2
srvctl stop asm -n dgstd1
srvctl stop asm -n dgstd2
srvctl stop instance -d DGSTD -i dgstd1
srvctl stop instance -d DGSTD-i dgstd2
emctl stop dbconsole
啟動後檢視各個服務是否啟動;
crs_stat -t
3.3 也可以使用srvctl指令啟動所有執行個體及其啟用的服務
srvctl start database -d DGPRI
4.其他情況
4.1 如果出現offline和unknown的情況:
1) 用crs_stat 檢視程序全部資訊(詳細的服務名:name):
# ./crs_stat
2) 有offline的情況,手動啟動
#./crs_start name
3) 有UNKNOWN 的程序,先stop,再start
#./crs_stop name
# ./crs_start name
3) 如果crs_stop不能結束,crs_start 不能啟動的程序,可用下列其中一種方法解決
A、./crs_stop -f name 停止unknown的程序(兩個節點上執行)
./crs_start -f name 啟動所有的服務(兩個節點上執行)
B、root使用者下用/etc/init.d/init.crs stop先禁用crs,然後再用/etc/init.d/init.crs start去啟用crs,
啟用crs後會自動啟動crs的一系列服務(兩個節點上執行)
5. 在啟動的過程中最好檢測crs、ASM和資料庫的日志:
crs日志:
[[email protected] ~]$ tail -f/opt/oracle/product/10.2.0/crs_1/log/node1/alertnode1.log
[[email protected] ~]$ tail -f/opt/oracle/product/10.2.0/crs_1/log/node2/alertnode2.log
ASM日志:
[ora[email protected] ~]$ tail -f/opt/oracle/admin/+ASM/bdump/alert_+ASM1.log
[[email protected] ~]$ tail -f/opt/app/oracle/admin/+ASM/bdump/alert_+ASM2.log
資料庫日志:
[[email protected] ~]$ tail -f / opt/oracle/admin/dgstd/bdump/alert_dgstd1.log
[[email protected] ~]$ tail -f / opt/oracle/admin/dgstd/bdump/alert_dgstd2.log