用crs实现single instance的HA

数据库的高可用方案我们通常采用的是双机热备模式,一个机器跑主机,另一个机器进行standby。当发生故障的时候,故障机上的数据库被切换到备机,在备机上起浮动IP和数据库,对应用来讲是透明的,只是发生了短暂的切换。目前行业中常用的高可用软件如HP的Service Guard、IBM的HACMP,价格都不低。在这里,我们可以使用oracle的crs application failover来实现同样的保护,而且更重要的是:crs免费。

本文的配置为:Linux AS4 U5+Oracle 10.2.0.0.1+ASM存储。(看不到图的同学请见这里《如何看到本站的图片》

先说一下磁盘的规划:

一、 系统配置:
等操作系统安装完毕后,进行一下参数的配置。
1. 建立oracle用户和设置密码:
# groupadd oinstall
# groupadd dba
# mkdir -p /export/home/oracle /ocfs
# useradd -d /export/home/oracle -g oinstall -G dba -s /bin/ksh oracle
# chown oracle:dba /export/home/oracle /u01
# passwd oracle
New Password:
Re-enter new Password:
passwd: password successfully changed for oracle

2.建oracle用户的环境变量:
# vi /export/home/oracle/.profile
export PS1="/bin/hostname -s-> "
export EDITOR=vi
export ORACLE_SID=hadb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/bin:
/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022

3.创建文件路径:
mkdir -p $ORACLE_BASE/admin
mkdir -p $ORACLE_HOME
mkdir -p $ORA_CRS_HOME
mkdir -p /u01/oradata/hadb

4.设置shell limited:
# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

# vi /etc/pam.d/login
session required /lib/security/pam_limits.so

# vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

5.设置核心参数:
# vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

6.设置hosts文件:
# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.190.142 hadb02.mycorpdomain.com hadb02
192.168.190.141 hadb01.mycorpdomain.com hadb01
192.168.190.41 hadb01-vip.mycorpdomain.com hadb01-vip
192.168.190.42 hadb02-vip.mycorpdomain.com hadb02-vip
10.10.10.41 hadb01-priv.mycorpdomain.com hadb01-priv
10.10.10.42 hadb02-priv.mycorpdomain.com hadb02-priv
# ntp server
191.168.190.1 HEJIANMIN

7.设置hangcheck timer:
#vi /etc/modprobe.conf
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

为了立即生效,执行:
# modprobe -v hangcheck-timer
insmod /lib/modules/2.6.9-42.0.0.0.1.ELsmp/kernel/drivers/char/hangcheck-timer.ko hangcheck_tick=30 hangcheck_margin=180

8.配置ntp服务:
ntp的配置请见此文《ntp服务的安装》

9.用fdisk对磁盘进行分区:

10.由于我们用到了asm,所以我们还需要装asm的rpm:
[root@hadb01 tmp]# rpm -Uvh oracleasmlib-2.0.2-1.i386.rpm
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
[root@hadb01 tmp]# rpm -qa |grep asm
ibmasm-3.0-7
oracleasmlib-2.0.2-1
oracleasm-support-2.0.3-2
oracleasm-2.6.9-42.0.0.0.1.ELsmp-2.0.3-2
[root@hadb01 tmp]#

11.创建裸设备:
# vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdc1
/dev/raw/raw2 /dev/sdd1
/dev/raw/raw3 /dev/sde1
重启rawdevice服务使之生效:
# service rawdevices restart

更改裸设备宿主
[root@hadb01 tmp]# chown oracle:dba /dev/raw/raw*
[root@hadb01 tmp]# chmod 660 /dev/raw/raw*

由于裸设备重启会恢复到root宿主,所以要加到rc.local

重启机器

12.节点2也同样的配置。只是在第9步骤进行不必再次进行分区,只需执行:
/sbin/partprobe /dev/sdb
/sbin/partprobe /dev/sdc
/sbin/partprobe /dev/sdd
/sbin/partprobe /dev/sde
/sbin/service rawdevices restart

即可。

13.配置用户信任关系:
hadb01-> mkdir ~/.ssh
hadb01-> chmod 700 ~/.ssh
hadb01> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
87:54:4f:92:ba:ed:7b:51:5d:1d:59:5b:f9:44:da:b6 oracle@hadb01.mycorpdomain.com
habd01-> ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
31:76:96:e6:fc:b7:25:04:fd:70:42:04:1f:fc:9a:26 oracle@hadb01.mycorpdomain.com

hadb02-> mkdir ~/.ssh
hadb02-> chmod 700 ~/.ssh
hadb02-> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
29:5a:35:ac:0a:03:2c:38:22:3c:95:5d:68:aa:56:66 oracle@rac2.mycorpdomain.com
hadb02-> ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
4c:b2:5a:8d:56:0f:dc:7b:bc:e0:cd:3b:8e:b9:5c:7c oracle@hadb02.mycorpdomain.com

hadb01-> cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
hadb01-> cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
hadb01-> ssh hadb02 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'hadb02 (192.168.2.132)' can't be established.
RSA key fingerprint is 63:d3:52:d4:4d:e2:cb:ac:8d:4a:66:9f:f1:ab:28:1f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadb02,192.168.2.132' (RSA) to the list of kno
oracle@hadb02's password:
hadb01-> ssh hadb02 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@hadb02's password:
hadb01-> scp ~/.ssh/authorized_keys hadb02:~/.ssh/authorized_keys
oracle@hadb02's password:
authorized_keys 100% 1716 1.7KB/s 00:00

在2个节点上都运行以下语句,如果提示需要密码,请重复执行:
ssh hadb01 date
ssh hadb02 date
ssh hadb01-priv date
ssh hadb02-priv date
ssh hadb01.mycorpdomain.com date
ssh hadb02.mycorpdomain.com date
ssh hadb01-priv.mycorpdomain.com date
ssh hadb02-priv.mycorpdomain.com date

14.配置asm:
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
Create ASM disks. Create the ASM disks on any one node as the root user.
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [ OK ]
Verify that the ASM disks are visible from every node.
# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3

另外,由于asm启动时候,会默认去查找/dev/raw/下所以文件,认为下面的所以是asm的盘,但是我们的/dev/raw/raw1和/dev/raw/raw2是ocr和votingdisk,因此需要手工的指定剩余的盘为asm diskstring:
hadb02-> cat init+ASM.ora
*.asm_diskstring='/dev/raw/raw3','/dev/raw/raw4','/dev/raw/raw5'
*.asm_diskgroups='DG1','RECOVERYDEST'
*.background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'
*.core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/u01/app/oracle/admin/+ASM/udump'

否则,在asm启动的时候,将会报错:

二、 安装clusterware和数据库,用asm做存储:
安装clusterware在图形化界面进行,
在运行之前,我们先检查一边crs环境是否已经准备可以安装,执行clusterware安装包中的runcluvfy.sh:

上述的vip问题,我们将再安装的过程中解决,可以见下面的安装步骤;关于Package failed的问题,我们可以忽略。

好,我们开始图形化安装,我们看图说话:
在clusterware目录,运行runInstaller开始安装cluster:

选择inventory的目录:

选择crs home,注意这里的crs home为crs_1,不要选择成db_1:

系统检查,可以忽略内存的告警提示:

cluster配置:

网络配置:

网络配置中要把eth0改成public:

选择ocr文件的路径:

选择votingdisk路径:

提示summary:

在各个节点上执行以下2个脚本,注意!执行之后不要基于点ok,我们还有别的工作要做,就是上面提到的在-pre检查时候的vip的问题:

我们另外在hadb02上开一个窗口,以root权限运行:
# /u01/app/oracle/product/10.2.0/crs_1/bin/vipca

这里全部选中:

写上各个节点的vip别名和地址:

summary检查配置情况:

开始progress:

完成vip配置:

此时在回去刚刚的界面,点击ok,就进入到了下一步的配置:

clusterware安装完成:

此时,cluster已经安装完毕,要看是否创建成功,我们可以运行以下的脚本来进行验证:

如果没有问题,好,我们开始来建数据库,同样也是图形化的安装方式,注意选择local installation:
点击db的runInstaller:

选择需要的数据库版本:

选择oracle home:

注意这里选择local installation:

忽略内存的提示告警:

选择advance:

选择create database:

检查summary:

开始安装数据库软件:

选择customer类型的database:

写上你的db name和sid:

用EM管理数据库

设置系统账户的密码:

设置asm系统账户的密码:

建立asm实例,点ok:

设置asm的diskgroup,先设一个DG1,以raw3和raw4做normal的冗余:

DG1建立完成,继续点create new:

建recoverydest,不需要冗余,点external:

diskgroup都创建完成:

指定flash recovery recovery area路径,我们选择asm上的recoverydest:

取消sample schema的安装:

数据库的相关参数设置:

database各个文件的配置:

最后确认创建db:

db开始建立:

db自动配置:

执行db的root.sh:

db配置完成:

我们在hadb02上也用runInstaller安装,这次仅安装数据库软件,不用建数据库即可。

至此,数据库已经安装完毕。
三、 cluster的配置:
1.在$ORA_CRS_HOME/crs/pubic下建立5个脚本:
act_asm.pl
act_db.pl
act_listener.pl
act_resgroup.pl
action_scr.scr

(这5个脚本见文档末尾附件处。)

注意以上脚本要有执行权限:
# cd /u01/app/oracle/product/10.2.0/crs_1/crs/public
# chmod +x *
# su – oracle
hadb01-> cd /u01/app/oracle/product/10.2.0/crs_1/crs/public
hadb01-> scp * hadb02: /u01/app/oracle/product/10.2.0/crs_1/crs/public

2.将hosts文件中的原来的vip去掉,改成:
192.168.190.143 hadb-vip

3.改侦听名称:
LISTENER_RG1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hadb-vip)(PORT = 1521)(IP = FIRST))
)
)

4.将各个资源注册到crs:
在注册之前,我们可以将之前以rac方式安装的crs的一些资源进行unregister掉:
crs_unregister ora.hadb01.gsd
crs_unregister ora.hadb02.gsd
crs_unregister ora.hadb01.ons
crs_unregister ora.hadb02.ons
crs_unregister ora.hadb01.vip
crs_unregister ora.hadb02.vip

注意unregister vip的时候,要用root权限

4.1 注册rg1:
hadb01->crs_profile -create rg1 -t application -a $CRS_HOME/crs/public/act_resgroup.pl -o ci=600
hadb01->crs_register rg1

4.2 注册vip:
hadb01->crs_profile -create rg1.vip -t application -r rg1 -a $CRS_HOME/bin/usrvip \
> -o oi=eth0,ov=192.168.190.143,on=255.255.255.0

注意oi是用作应用的网卡,可以通过ifconfig看,他的地址应该是192.168.190.141;ov指vip的地址,on指子网掩码。
hadb01-> crs_register rg1.vip
再退回到root权限,修改vip资源的权限:
# ./crs_setperm rg1.vip -o root
# ./crs_setperm rg1.vip -u user:oracle:r-x

4.3 测试vip资源是否能正常启动:


hadb01-> ping hadb-vip
PING hadb-vip.mycorpdomain.com (192.168.190.143) 56(84) bytes of data.
64 bytes from hadb-vip.mycorpdomain.com (192.168.190.143): icmp_seq=0 ttl=64 time=4.93 ms
64 bytes from hadb-vip.mycorpdomain.com (192.168.190.143): icmp_seq=1 ttl=64 time=15.2 ms
64 bytes from hadb-vip.mycorpdomain.com (192.168.190.143): icmp_seq=2 ttl=64 time=1.38 ms
64 bytes from hadb-vip.mycorpdomain.com (192.168.190.143): icmp_seq=3 ttl=64 time=5.14 ms
64 bytes from hadb-vip.mycorpdomain.com (192.168.190.143): icmp_seq=4 ttl=64 time=0.522 ms

4.4注册侦听:

4.5 注册asm:
hadb01-> crs_profile -create rg1.asm -t application \
> -r rg1 -a $ORA_CRS_HOME/crs/public/act_asm.pl \
> -o ci=20,ra=5,osrv=+ASM,ol=$ORACLE_HOME,oflags=1,rt=600
hadb01->
hadb01->
hadb01-> crs_register rg1.asm
hadb01->
hadb01->
hadb01->
hadb01-> cr_stat -t
ksh: cr_stat: not found
hadb01-> crs_stat -t
Name Type Target State Host
------------------------------------------------------------
rg1 application ONLINE ONLINE hadb01
rg1.asm application OFFLINE OFFLINE
rg1.listener application ONLINE ONLINE hadb01
rg1.vip application ONLINE ONLINE hadb01
hadb01->
hadb01-> crs_start rg1.asm
Attempting to start rg1 on member hadb01
Start of rg1 on member hadb01 succeeded.
Attempting to start rg1.asm on member hadb01
Start of rg1.asm on member hadb01 succeeded.
hadb01-> crs_stat -t
Name Type Target State Host
------------------------------------------------------------
rg1 application ONLINE ONLINE hadb01
rg1.asm application ONLINE ONLINE hadb01
rg1.listener application ONLINE ONLINE hadb01
rg1.vip application ONLINE ONLINE hadb01

4.6 注册db:
hadb01-> crs_profile -create rg1.hadb -t application \
> -r rg1.asm -a $ORA_CRS_HOME/crs/public/act_db.pl \
> -o ci=20,ra=5,osrv=hadb,ol=$ORACLE_HOME,oflags=1,rt=600
hadb01-> crs_register rg1.hadb
hadb01-> crs_start rg1.hadb
Attempting to start rg1.hadb on member hadb01
Start of rg1.hadb on member hadb01 succeeded.
hadb01-> crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
rg1 application 0/1 0/0 ONLINE ONLINE hadb01
rg1.asm application 0/5 0/0 ONLINE ONLINE hadb01
rg1.hadb application 0/5 0/0 ONLINE ONLINE hadb01
rg1.listener application 0/5 0/0 ONLINE ONLINE hadb01
rg1.vip application 0/1 0/0 ONLINE ONLINE hadb01

至此我们已经完成了所以的安装工作。

四、Failover测试
现在,我们进行failover的测试。为了简单起见,这边直接把测试项目和测试结果列举了出来:

附件:
进行crs切换的5个脚本:
act_asm.pl
## act_asm.pl start here.
#!/usr/bin/perl
#
# $Header: act_db.pl 05-apr-2007.14:21:24 rvenkate Exp $
#
# act_asm.pl
#
# Copyright (c) 2007, Oracle. All rights reserved.
#
# NAME
# act_db.pl -
#
# DESCRIPTION
# This perl script is the action script for start / stop / check
# the Oracle Instance in a cold failover configuration.
#
# Place this file in /crs/public/
#
# NOTES
# Edit the perl installation directory as appropriate.
#
# MODIFIED (MM/DD/YY)
# pnewlan 05/25/07 . use grep -w
# rvenkate 04/05/07 - checkin into demo dir
# pnewlan 01/17/07 - Use Environment variables rather than hard code
# - HOME & SID
# pnewlan 11/23/06 - oracle OS user invoker
# rknapp 05/22/06 - Creation
#
$ORACLE_HOME = "$ENV{_USR_ORA_LANG}";
$ORACLE_SID = "$ENV{_USR_ORA_SRV}";
if ($#ARGV != 0 ) {
print "usage: start stop check required \n";
exit;
}
$command = $ARGV[0];
# Database start stop check
# Start database
if ($command eq "start" ) {
system ("
export ORACLE_SID=$ORACLE_SID
export ORACLE_HOME=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
$ORACLE_HOME/bin/sqlplus /nolog <

act_db.pl
## act_db.pl start here.
#!/usr/bin/perl
#
# $Header: act_db.pl 05-apr-2007.14:21:24 rvenkate Exp $
#
# act_db.pl
#
# Copyright (c) 2007, Oracle. All rights reserved.
#
# NAME
# act_db.pl -
#
# DESCRIPTION
# This perl script is the action script for start / stop / check
# the Oracle Instance in a cold failover configuration.
#
# Place this file in /crs/public/
#
# NOTES
# Edit the perl installation directory as appropriate.
#
# MODIFIED (MM/DD/YY)
# pnewlan 05/25/07 . use grep -w
# rvenkate 04/05/07 - checkin into demo dir
# pnewlan 01/17/07 - Use Environment variables rather than hard code
# - HOME & SID
# pnewlan 11/23/06 - oracle OS user invoker
# rknapp 05/22/06 - Creation
#
$ORACLE_HOME = "$ENV{_USR_ORA_LANG}";
$ORACLE_SID = "$ENV{_USR_ORA_SRV}";
if ($#ARGV != 0 ) {
print "usage: start stop check required \n";
exit;
}
$command = $ARGV[0];
# Database start stop check
# Start database
if ($command eq "start" ) {
system ("
export ORACLE_SID=$ORACLE_SID
export ORACLE_HOME=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
$ORACLE_HOME/bin/sqlplus /nolog <

act_listener.pl
## act_listener.pl start here.
#!/usr/bin/perl
#
# $Header: act_listener.pl 05-apr-2007.14:14:24 rvenkate Exp $
#
# act_listener.pl
#
# Copyright (c) 2007, Oracle. All rights reserved.
#
# NAME
# act_listener.pl - action script for the listener resource
#
# DESCRIPTION
# This perl script is the action script for start / stop / check
# the Oracle Listener in a cold failover configuration.
#
# NOTES
# Edit the perl installation directory as appropriate.
#
# Place this file in /crs/public/
#
# MODIFIED (MM/DD/YY)
# rknapp 06/24/07 - fixed bug with multiple listener
# rvenkate 04/05/07 - checkin as demo
# pnewlan 01/17/07 - Use Environment variables rather than hard code
# HOME & LISTENER
# pnewlan 11/23/06 - oracle OS user invoker and listener name
# rknapp 05/22/06 - Creation
#
$ORACLE_HOME = "$ENV{_USR_ORA_LANG}";
$ORA_LISTENER_NAME = "$ENV{_USR_ORA_SRV}";
if ($#ARGV != 0 ) {
print "usage: start stop check required \n";
exit;
}
$command = $ARGV[0];
# start listener
if ($command eq "start") {
system ("
export ORACLE_HOME=$ORACLE_HOME
export ORA_LISTENER_NAME=$ORA_LISTENER_NAME
export TNS_ADMIN=$ORACLE_HOME/network/admin # optionally set TNS_ADMIN here
$ORACLE_HOME/bin/lsnrctl start $ORA_LISTENER_NAME");
}
# stop listener
if ($command eq "stop") {
system ("
export ORACLE_HOME=$ORACLE_HOME
export ORA_LISTENER_NAME=$ORA_LISTENER_NAME
export TNS_ADMIN=$ORACLE_HOME/network/admin # optionally set TNS_ADMIN here
$ORACLE_HOME/bin/lsnrctl stop $ORA_LISTENER_NAME");
}
# check listener
if ($command eq "check") {
check_listener();
}
sub check_listener {
my($check_proc_listener,$process_listener) = @_;
$process_listener = "$ORACLE_HOME/bin/tnslsnr $ORA_LISTENER_NAME";
$check_proc_listener = qx(ps -aef | grep -w "tnslsnr $ORA_LISTENER_NAME" | grep -v grep | head -n 1 | awk '{print \$8,\$9}');
chomp($check_proc_listener);
if ($process_listener eq $check_proc_listener) {
exit 0;
} else {
exit 1;
}
}
## act_listener.pl stop here.

act_resgroup.pl
## act_listener.pl start here.
#!/usr/bin/perl
#
# $Header: act_resgroup.pl 05-apr-2007.14:39:52 rvenkate Exp $
#
# act_resgroup.pl
#
# Copyright (c) 2007, Oracle. All rights reserved.
#
# NAME
# act_resgroup.pl - action script for generic resource group
#
# DESCRIPTION
# This perl script is the action script for a generic resource group
#
# NOTES
# Edit the perl installation directory as appropriate.
#
# Place this file in /crs/public/
#
# MODIFIED (MM/DD/YY)
# rvenkate 04/05/07 - checkin into demo dir
# pnewlan 04/05/07 - Creation
#
exit 0;
## act_listener.pl stop here.

action_scr.scr
## action_scr.scr start here.
#!/bin/sh
# *****************************************************************
# * *
# * Copyright (c) 2002, 2003 Oracle Corporation. *
# * All rights reserved. *
# * *
# * Copyright (c) 1991, 1999, 2002 Digital Equipment *
# * Corporation *
# * *
# * *
# * All Rights Reserved. Unpublished rights reserved under *
# * the copyright laws of the United States. *
# * *
# * The software contained on this media is proprietary to *
# * and embodies the confidential technology of Digital *
# * Equipment Corporation and Oracle Corporation. Possession, *
# * use, duplication or dissemination of the software *
# * and media is authorized only pursuant to a valid written *
# * license from Digital Equipment Corporation and Oracle *
# * Corporation *
# * *
# * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
# * by the U.S. Government is subject to restrictions as set *
# * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
# * or in FAR 52.227-19, as applicable. *
# * *
# * *
# *****************************************************************
#
SCRIPT=$0
ACTION=$1 # Action (start, stop or check)
#########################################################################
#
# Main section of Action Script - starts, stops, or checks an application
#
# This script is invoked by CRS when managing the application associated
# with this script.
#
# Argument: $1 - start | stop | check
#
# Returns: 0 - successful start, stop, or check
# 1 - error
#
#########################################################################
#
# Start section - start the process and report results
#
# If the Application Startup Commands (see description above) were used,
# little, if any modifications are needed in this section. If not used,
# you may replace most of the contents in this section with your own
# start procedure code.
#
case $1 in
'start')
echo "Resource STARTED"
;;
#
# Stop section - stop the process and report results
#
# If the Application Stop Commands or Associated Processes (see descriptions
# above) were used,little, if any modifications are needed in this section.
# If not used, you may replace most of the contents in this section with
# your own stop procedure code.
#
'stop')
echo "Resource STOPPED"
;;
#
# Check section - check the process and report results
#
#
# Your application might allow you to implement more accurate process
# checking. If so, you may choose to implement that code here.
#
'check')
echo "Resource CHECKED"
;;
*)
echo "usage: $0 {start stop check}"
;;
esac
exit 0
## action_scr.scr stop here.

相关文章

6条评论

  1. 这篇文章涵盖了非常多的知识点,我是在as5上做的实验,当初在node2上执行root.sh的时候就挂死在这里,后来又无法在2节点同时mount diskgroup,花了二个星期的时间才搞定这二个问题啊,这篇文章值得收藏。

  2. re 无为而为:可以通过脚本来实现挂存储而不是asm的。注意root权限。

  3. ASM建為CLUSTER的ASM不就不用腳本去另一節點開啟ASM了?

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据