天天看点

Oracle 10gR2 RAC的启动和关闭步骤

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