王者荣耀ad扁鹊:AIX?5.3++HACMP5.4+ORACLE10.2双机热备
来源:百度文库 编辑:中财网 时间:2024/04/29 00:12:21
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
hd6
2)增大交换空间到4G(当前PP大小为64M)
-bash-3.2# chps -s 56 hd6
3)查看当前交换空间大小
-bash-3.2# lsps -a
Page Space
hd6
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
/dev/hd4
/dev/hd2
/dev/hd9var
/dev/hd3
/dev/hd1
/proc
/dev/hd10opt
5:创建LV 和FS
创建ORACLE安装软件的LV和FS
-bash-3.2# mklv -y oraclelv -t jfs2
-bash-3.2# crfs -v jfs2 -d oraclelv -A yes -m /app/oracle
-bash-3.2# mount /app/oracle
6:安装依赖包
1)安装软件
安装HACMP5.4和oracle10g所需的依赖包:
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
-bash-3.2# instfix -ik IY58143 IY59386
-bash-3.2# instfix -ik IY59386
-bash-3.2# instfix -ik IY60930
-bash-3.2# instfix -ik IY66513
-bash-3.2# instfix -ik IY68989
-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
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
10:创建共享文件系统
在第一个节点上操作
1)创建共享VG
-bash-3.2# mkvg -y oravg -V 60 hdisk2
2)创建ORACLE数据文件的LV和FS
-bash-3.2# mklv -y oralv -t jfs2
-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
-bash-3.2# varynovg oravg
-bash-3.2# lsvg -l oravg (查看VG里的LV是否正常)
11:安装HACMP5.4软件
除了 cluster.hativoli、cluster.haview 两个包以外,其他所有包都需要安装
12:配置串口
1)
2)
-bash-3.2# rmdev -dl sa0
3)
mkdev -c tty
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
192.168.30.171
192.168.30.172
192.168.130.181
172.16.30.1
172.16.30.2
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 fi to_log "`show_time` the Oracle Process is normal!" exit 0 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 安装步骤和WINDOWS、LINUX下一样,在这里我就不省略掉了。安装的时候选择只安装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用户执行两个脚本。 -bash-3.2# /app/oracle/product/10.2.0/db_1/root.sh 3:创建listener -bash-3.2$ netca (监听地址应该是集群的虚拟地址) 剩下的步骤和WINDOWS、LINUX下一样,在这里我就不省略掉了 4:在第一个节点创建数据库 (此步骤只需在第一个节点上操作) -bash-3.2$ dbca 剩下的步骤和WINDOWS、LINUX下一样,在这里我就不省略掉了 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) 方法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 6:还原fuser命令 -bash-3.2# cd /usr/sbin/ -bash-3.2# mv fuser.orig fuser 7:更新数据字典 $ SQL> SQL> SQL> Total SQL> SQL> SQL> 8:清理失效的对象 SQL> SQL> ---------- SQL> SQL> ---------- 1:创建一个名为oradbha的集群 smit hacmp Extended Configuration Extended Topology Configuration Configure an HACMP Cluster Add/Change/Show an HACMP Cluster 2:向oradbha的集群中添加节点 1)添加第一个节点 Extended Configuration Extended Topology Configuration Configure HACMP Nodes Add a Node to the HACMP Cluster 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 IP和SVR 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 IP 和STDBY IP分别添加进去 7:添加一个wishdbsrc的服务 Extended Configuration Extended Resource Configuration HACMP Extended Resources Configuration Configure HACMP Application Servers Add an Application Server 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 10:改变wishdbrg资源组的属性 Extended Configuration Extended Resource Configuration HACMP Extended Resource Group Configuration Change/Show Resources and Attributes for a Resource Group wishdbrg 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 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 12:同步配置到另一个节点 Extended Configuration Extended Verification and Synchronization 13:HACMP的管理 1) -bash-3.2# smit clstart 2) -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第二章
-bash-3.2# /app/oracle/oraInventory/orainstRoot.sh第三章
第四章
2)配置数据库状态监控