ITPub博客

首页 > Linux操作系统 > Linux操作系统 > AIX 5.3+HACMP5.4+ORACLE10.2双机热备

AIX 5.3+HACMP5.4+ORACLE10.2双机热备

原创 Linux操作系统 作者:hunterjoy 时间:2012-03-25 22:33:02 0 删除 编辑

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

转载请注明出去:http://blog.sina.com.cn/rootking

PS:文档中没有注明在第一个节点操作或在第二个节点操作的地方,是需要在两个节点上都要操作的地方

第一章 AIX系统调整

1:查询系统版本:

-bash-3.2# oslevel -r

5300-08

2:查询系统是否 64 位:

-bash-3.2# getconf HARDWARE_BITMODE

64

3:查询物理内存大小(2G):

-bash-3.2# lsattr -E -l sys0 -a realmem

realmem 2097152 Amount of usable physical memory in Kbytes False

4:增大交换空间

1)查看当前交换空间大小

-bash-3.2# lsps -a

Page Space Physical Volume Volume Group Size %Used Active Auto Type

hd6 hdisk0 rootvg 512MB 24 yes yes lv

2)增大交换空间到4G(当前PP大小为64M

-bash-3.2# chps -s 56 hd6

3)查看当前交换空间大小

-bash-3.2# lsps -a

Page Space Physical Volume Volume Group Size %Used Active Auto Type

hd6 hdisk0 rootvg 4096MB 7 yes yes lv

4:改变文件系统大小

-bash-3.2# chfs -a size=1G /

-bash-3.2# chfs -a size=1G /home

-bash-3.2# chfs -a size=1G /tmp

-bash-3.2# chfs -a size=2G /var

-bash-3.2# chfs -a size=2G /usr

-bash-3.2# df -g

Filesystem GB blocks Free %Used Iused %Iused Mounted on

/dev/hd4 1.00 0.93 7% 4383 2% /

/dev/hd2 2.00 0.45 78% 38242 26% /usr

/dev/hd9var 2.00 1.98 1% 502 1% /var

/dev/hd3 1.00 1.00 1% 37 1% /tmp

/dev/hd1 1.00 0.98 3% 115 1% /home

/proc - - - - - /proc

/dev/hd10opt 0.12 0.04 69% 1741 16% /opt

5:创建LVFS

创建ORACLE安装软件的LVFS

-bash-3.2# mklv -y oraclelv -t jfs2 rootvg 10G

-bash-3.2# crfs -v jfs2 -d oraclelv -A yes -m /app/oracle

-bash-3.2# mount /app/oracle

6:安装依赖包

1)安装软件

安装HACMP5.4oracle10g所需的依赖包:

bos.adt.*

bos.net.*

bos.rte.*

rsct.basic.*

rsct.compat.*

bos.clvm.*

bos.perf.*

rsct.compat.client.*

bos.data.*

rsct.opt.storagerm

xlC.aix50.rte:9.0.0.1 or later     //版本必须为7.0.0.1以上

xlC.rte:9.0.0.1 or later        //版本必须为7.0.0.1以上

2)检查补丁是否打成功

参考文章:http://download-west.oracle.com/docs/cd/B19306_01/install.102/b19075/pre_install.htm#sthref110

IY58143 IY59386 IY60930 IY66513 IY68989 IY70159

-bash-3.2# instfix -ik IY58143 IY59386

All filesets for IY58143 were found.

-bash-3.2# instfix -ik IY59386

All filesets for IY59386 were found.

-bash-3.2# instfix -ik IY60930

All filesets for IY60930 were found.

-bash-3.2# instfix -ik IY66513

All filesets for IY66513 were found.

-bash-3.2# instfix -ik IY68989

All filesets for IY68989 were found.

-bash-3.2# instfix -ik IY70159

All filesets for IY70159 were found.

7:修改系统最大进程数参数

-bash-3.2# chdev -l sys0 -a maxuproc=2048 -a maxpout=32 -a minpout=24

-bash-3.2# smit chaio

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

8:创建数据库用户和组

-bash-3.2# mkgroup id=300 oinstall

-bash-3.2# mkgroup id=301 oradba

-bash-3.2# mkuser id=300 pgrp=oinstall groups=oradba fsize=-1 data=-1 stack=-1 core=-1 oracle

9:更改系统文件大小限制

AIX 5.3的系统默认文件大小限制为1G,我们除了需要修改用户限制后最好还修改一下/etc/security/limits中的限制,将fsize值改成-1

-bash-3.2# vi /etc/security/limits

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

10:创建共享文件系统

在第一个节点上操作

1)创建共享VG

-bash-3.2# mkvg -y oravg -V 60 hdisk2

2)创建ORACLE数据文件的LVFS

-bash-3.2# mklv -y oralv -t jfs2 oravg 100G

-bash-3.2# crfs -v jfs2 -d oralv -A yes -m /app/oradata

3) 在第一个节点上VARYOFF共享VG

-bash-3.2# varyoffvg oravg

在第二个节点上操作

-bash-3.2# importvg -y oravg -V 60 hdisk2 (导入VG)

-bash-3.2# varynovg oravg (激活VG)

-bash-3.2# lsvg -l oravg              (查看VG里的LV是否正常)

11:安装HACMP5.4软件

除了 cluster.hativolicluster.haview 两个包以外,其他所有包都需要安装

12:配置串口

1) 将串口线连到两台小机的第一个COM

2) 删除掉系统里以前的串口sa0

-bash-3.2# rmdev -dl sa0

3) 重新安装串口sa0

mkdev -c tty -t tty -s rs232 -p sa0 -w 0

4) 测试

-bash-3.2# cat /etc/hosts > /dev/tty0       (在第一个节点上操作)

-bash-3.2# cat              (在第二个节点上操作)

如果在第二个节点上看到输出,则串口配置成功

13:配置/etc/hosts文件

-bash-3.2# tail -n 7 /etc/hosts

127.0.0.1 loopback localhost # loopback (lo0) name/address

192.168.30.171 wishdb1-boot wishdb1

192.168.30.172 wishdb2-boot wishdb2

192.168.130.181 wishdb1-svc

172.16.30.1 wishdb1-priv

172.16.30.2 wishdb2-priv

14:数据库切换脚本

-bash-3.2# passwd oracle

Changing password for "oracle"

oracle's New password:

Enter the new password again:

-bash-3.2# su - oracle

-bash-3.2$ vi .profile

.profile文件中添加以下以行

export ORACLE_BASE=/app/oracle

export ORACLE_SID=wishdb

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export PATH=$PATH:$ORACLE_HOME/bin:.:/usr/local/bin

15:创建HACMP切换脚本

1)数据库开启脚本

-bash-3.2# cat /app/oracle/script/startdb.sh

su - oracle <

source /home/oracle/.profile

lsnrctl start

sqlplus / as sysdba <

startup

exit

EOF

exit

EOF

2)数据库关闭脚本

-bash-3.2# cat /app/oracle/script/stopdb.sh

su - oracle <

source /home/oracle/.profile

lsnrctl stop

sqlplus / as sysdba <

shutdown immediate

exit

EOF

exit

EOF

3)给脚本可执行权限

-bash-3.2# chmod +x /app/oracle/script/startdb.sh

-bash-3.2# chmod +x /app/oracle/script/stopdb.sh

15:数据库状态监控脚本

-bash-3.2# cat agent_wishdb.sh

#!/usr/bin/ksh

su - oracle <

source /home/oracle/.profile

# check the ORAClE status

sqlplus / as sysdba > /app/oracle/status.log <

select version,status,logins from v\\\$instance;

exit;

EOF

export LOGFILE=/app/oracle/agent_wishdb.log

to_log()

{

echo $1 >> $LOGFILE

}

show_time()

{

echo "[`date '+%Y-%m-%d %H:%M:%S'`]"

}

SQLRESULT=`cat /app/oracle/status.log`

if [ `echo $SQLRESULT | awk -F"SQL>" '{print $3}' | awk '/.*ORA-/' | wc -l` -ne 0 ]

then

to_log "`show_time` Monitoring returned the output :\n$SQLRESULT"

exit 99

fi

to_log "`show_time` the Oracle Process is normal!"

exit 0

第二章 安装ORACLE

1:解压安装文件

-bash-3.2# gunzip 10gr2_aix5l64_database.cpio.gz

-bash-3.2# cpio -icdmv 10gr2_aix5l64_database.cpio

2:安装ORACLE软件

-bash-3.2# cd Disk1/rootpre

-bash-3.2# ./rootpre.sh

-bash-3.2# su - oracle

-bash-3.2$ cd /soft/oracle_10g/Disk1/

-bash-3.2$ ./runInstaller

安装步骤和WINDOWSLINUX下一样,在这里我就不省略掉了。安装的时候选择只安装ORACLE软件不创建数据库。

打补丁的过程中,如果出现报错:

/app/oracle/product/10.2.0/db_1/jdk/jre/bin/libdbgmalloc.a 文件busy

root 用户执行命令

mv /app/oracle/product/10.2.0/db_1/jdk/jre/bin/libdbgmalloc.a

/app/oracle/product/10.2.0/db_1/jdk/jre/bin/libdbgmalloc.a.old

retry 就可以了

最后根据提示以root用户执行两个脚本。

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

-bash-3.2# /app/oracle/oraInventory/orainstRoot.sh

-bash-3.2# /app/oracle/product/10.2.0/db_1/root.sh

3:创建listener

-bash-3.2$ netca     (监听地址应该是集群的虚拟地址)

剩下的步骤和WINDOWSLINUX下一样,在这里我就不省略掉了

4:在第一个节点创建数据库        (此步骤只需在第一个节点上操作)

-bash-3.2$ dbca

剩下的步骤和WINDOWSLINUX下一样,在这里我就不省略掉了

5:在第二个节点创建参数文件、密码文件、目录构  (此步骤只需在第二个节点上操作)

-bash-3.2# cd /app/oracle/product/10.2.0/db_1/dbs/

-bash-3.2# scp wishdb2:/app/oracle/product/10.2.0/db_1/spfilewishdb.ora ./

-bash-3.2# scp wishdb2:/app/oracle/product/10.2.0/db_1/orapwwishdb.ora ./ 

-bash-3.2# chown oracle:oinstall spfilewishdb.ora

-bash-3.2# chown oracle:oinstall orapwwishdb.ora

-bash-3.2# su - oracle

-bash-3.2$ mkdir -p /app/oracle/admin/wishdb/adump

-bash-3.2$ mkdir /app/oracle/admin/wishdb/bdump

-bash-3.2$ mkdir /app/oracle/admin/wishdb/cdump

-bash-3.2$ mkdir /app/oracle/admin/wishdb/udump

-bash-3.2$ mkdir /app/oracle/admin/wishdb/dpdump

第三章 升级数据库

1:解压升级软件

1) 安装unzip解压软件

方法1

下载地址:ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/unzip/unzip-5.51-1.aix5.1.ppc.rpm

-bash-3.2# unzip-5.51-1.aix5.1.ppc.rpm

方法2

下载地址:http://jnxx.zjedu.org/download/unzip_aix.Z

-bash-3.2# uncompress unzip_aix.Z

-bash-3.2# ls unzip_aix

unzip_aix

-bash-3.2# chmod 751 unzip_aix

-bash-3.2# pwd

-bash-3.2# mv unzip_aix /usr/bin/unzip

2)解压软件

-bash-3.2# unzip p8202632_10205_AIX64-5L_2of2.zip

-bash-3.2# unzip p8202632_10205_AIX64-5L_2of2.zip

PS:实际上AIX5.3中用jar命令同样可以解压zip格式的压缩文件,这样就不需要安装unzip

命令格式:jar -xvf 文件名

2:替换fuser命令

系统默认的fuser可能会干扰补丁升级,所心最好我们在打ORACLE补丁前替换掉该命令

-bash-3.2# cd /usr/sbin/

-bash-3.2# mv fuser fuser.orig

-bash-3.2# touch /usr/sbin/fuser

-bash-3.2# chmod +x /usr/sbin/fuser

3:关闭ORACLE软件

在升级补丁之前,我们必须先要关闭数据库,并关掉监听程序。

-bash-3.2# su - oracle

-bash-3.2$ lsnrctl stop

-bash-3.2$ sqlplus / as sysdba

SQL> shutdown immediate

关闭完成之后再次用ps命令确认所有的ORACLE用户的进程已经关闭

-bash-3.2# ps -ef |grep oracle

4:备份ORACLE软件目录

在升级补丁之前,我们最好把整个ORACLE软件目录打包,以备升级失败后还原回原来的状态。

-bash-3.2# su - oracle

-bash-3.2$ cd /app/oracle/

-bash-3.2$ tar -cvf product.tar product

5:升级ORACLE软件

-bash-3.2# su - oracle

-bash-3.2$ cd /soft/oracle_10g/Disk1/

-bash-3.2$ ./runInstaller

在安装前会提示你用ROOT用户执行一下/usr/sbin/slibclean脚本

-bash-3.2# /usr/sbin/slibclean

升级步骤和安装时一样,在这里我就不省略掉了

升级完成之后会提示你执行以下脚本

-bash-3.2# /app/oracle/product/10.2.0/db_1/root.sh

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

6:还原fuser命令

-bash-3.2# cd /usr/sbin/

-bash-3.2# mv fuser.orig fuser

7:更新数据字典 (此步骤只需在一个节点上操作)

$ sqlplus / as sysdba

SQL> startup upgrade; (以升级模式启动数据库)

SQL> SPOOL /tmp/patch102050.log

SQL> @?/rdbms/admin/catupgrd.sql (重建数据字典, 若有问题可重复执行)

Total Upgrade Time: 01:25:12 (数据库大小60G)

SQL> SPOOL off

SQL> !egrep "ORA-|Error" /tmp/patch102050.log (查看是否有错误)

SQL> shutdown immediate;

8:清理失效的对象 (此步骤只需在一个节点上操作)

SQL> startup;

SQL> select count(1) from dba_objects where status='INVALID';

COUNT(1)

----------

1683

SQL> @?/rdbms/admin/utlrp.sql (编译失效PLSQL包对象, 尽管第一次访问包是会自动编译, 还是推荐操作)

SQL> select count(1) from dba_objects where status='INVALID';

COUNT(1)

----------

0

第四章 HACMP的配置

1:创建一个名为oradbha的集群

smit hacmp

Extended Configuration

Extended Topology Configuration

Configure an HACMP Cluster

Add/Change/Show an HACMP Cluster

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

2:向oradbha的集群中添加节点

1)添加第一个节点

Extended Configuration

Extended Topology Configuration

Configure HACMP Nodes

Add a Node to the HACMP Cluster

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

2)添加第二个节点

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

3:自动扫描拓扑结构

1)添加第一个节点

Extended Configuration

Extended Topology Configuration

Discover HACMP-related Information from Configured Nodes

返回OK结果才行

4:添加IP网络

Extended Configuration

Extended Topology Configuration

Configure HACMP Networks

Add a Network to the HACMP Cluster

选择ether

PS:由于我们的BOOT IPSVR IP不在同一网段,所以替换IP一项要选择NO

5:添加串口网络

Extended Configuration

Extended Topology Configuration

Configure HACMP Networks

Add a Network to the HACMP Cluster

选择rs232

6:配置通信接口

1)HACMP中配置串口通信

Extended Configuration

Extended Topology Configuration

Configure HACMP Communication Interfaces/Devices

Add Communication Interfaces/Devices

Add Pre-defined Communication Interfaces and Devices

Communication Devices

net_rs232_01

将两个节点上的串口分别添加进去

2)HACMP中配置网口通信

Extended Configuration

Extended Topology Configuration

Configure HACMP Communication Interfaces/Devices

Add Communication Interfaces/Devices

Add Pre-defined Communication Interfaces and Devices

Communication Interfaces

net_ether_01

将两个节点上的BOOT IPSTDBY IP分别添加进去

7:添加一个wishdbsrc的服务

Extended Configuration

Extended Resource Configuration

HACMP Extended Resources Configuration

Configure HACMP Application Servers

Add an Application Server

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

8:添加一个wishdbsrc的服务

Extended Configuration

Extended Resource Configuration

HACMP Extended Resources Configuration

Configure HACMP Service IP Labels/Addresses

Add a Service IP Label/Address

Configurable on Multiple Nodes

net_ether_01 (192.168.30.0/24 172.16.30.0/24)

wishdb1-svc的地址添加进服务

9:添加一个wishdbrg的资源组

Extended Configuration

Extended Resource Configuration

HACMP Extended Resource Group Configuration

Add a Resource Group

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

10:改变wishdbrg资源组的属性

Extended Configuration

Extended Resource Configuration

HACMP Extended Resource Group Configuration

Change/Show Resources and Attributes for a Resource Group

wishdbrg

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

11:配置应用监控

1)配置数据库监听程序监控

Extended Configuration

Extended Resource Configuration

HACMP Extended Resources Configuration

Configure HACMP Application Servers

Configure HACMP Application Monitoring

Configure Process Application Monitors

Add a Process Application Monitor

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

2)配置数据库状态监控

Extended Configuration

Extended Resource Configuration

HACMP Extended Resources Configuration

Configure HACMP Application Servers

Configure HACMP Application Monitoring

Configure Custom Application Monitors

Add a Custom Application Monitor

AIX 5.3++HACMP5.4+ORACLE10.2双机热备

12:同步配置到另一个节点

Extended Configuration

Extended Verification and Synchronization

13HACMP的管理

1) 开启HACMP

-bash-3.2# smit clstart

2) 关闭HACMP

-bash-3.2# smit clstop

3) 移动资源组

System Management (C-SPOC)

HACMP Resource Group and Application Management

Move a Resource Group to Another Node / Site

Move Resource Groups to Another Node

4) 查看节点状态

Problem Determination Tools

View Current State

5) 查看资源组的状态

System Management (C-SPOC)

HACMP Resource Group and Application Management

Show the Current State of Applications and Resource Groups

 

Hacmp的应用监控的挂起与恢复

5.1 应用监控的挂起

root用户登录,执行smitty hacmp命令,依次选择下面的选项

System Management (C-SPOC)

  HACMP Resource Group and Application Management

   Suspend/Resume Application Monitoring

    Suspend Application Monitoring

上面状态行出现“OK”后,按“Esc+0”退出。

 

5.2 应用监控的恢复

同样以root用户登录,执行smitty hacmp命令,依次选择下面的选项

System Management (C-SPOC)

  HACMP Resource Group and Application Management

   Suspend/Resume Application Monitoring

    Resume Application Monitoring

上面状态行出现“OK”后,按“Esc+0”退出。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/543979/viewspace-719497/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-31

  • 博文量
    155
  • 访问量
    348764