使用祼设备做 CRS 盘: # ls -alF /dev/*hdiskn 注:(创建别名22 为磁盘路径的主号,4 为磁盘路径的从号,是通过命令ls -l /dev/*hdiskn查看得来的)查看磁盘号: #lscfg |grep hd 查看磁盘的主号和次号: ls -l /dev |grep hd # ls -l /dev/*hdisk4 # ls -l /dev/*hdisk4 brw------- 1 root system 23, 5 Mar 31 01:54 /dev/hdisk4 crw-rw---- 1 oracle oinstall 23, 5 Mar 31 01:54 /dev/rhdisk4 # mknod /dev/ocr_disk c 23 5 # chown oracle:oinstall /dev/ocr_disk # chmod 660 /dev/ocr_disk # ls -l /dev/*hdisk9 # ls -l /dev/*hdisk9 brw------- 1 root system 23, 10 Mar 28 14:07 /dev/hdisk9 crw-rw---- 1 oracle oinstall 23, 10 Mar 28 14:07 /dev/rhdisk9 #mknod /dev/vote_disk c 23 9 # chown oracle:oinstall /dev/vote_disk # chmod 660 /dev/vote_disk (同理,完成*hdisk10-14)
1.8 用户环境变量设置: $ cat .profile PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:. export PATH if [ -s "$MAIL" ] # This is at Shell startup. In normal then echo "$MAILMSG" # operation, the Shell checks fi # periodically.
2.2 将cluster 从10.2.0.1 升级到10.2.0.4 1.先将CRS 停掉: 在一个节点以 oracle 执行 先查看: $ crs_stat –t 停止crs 资源: $ crs_stop –all 然后在每个节点上以root 用户执行下列命令,停掉 crs 进程: # /etc/init.crs stop 使用:crs_stat –t,ps –ef|grep crs 等命令确认crs 已经停掉 2.将升级补丁包上传到服务器,解压 $ unzip p6810189_10204_AIX5L.zip 将包解压到同一个目录下 3.在运行升级程序前需要以root 用户在每个节点执行下面命令: #/usr/sbin/slibclean 4.然后切换到oracle 用户运行升级安装程序: 进入升级程序目录,然后运行: ./runInstaller –ignoreSysPreReqs 提示是否以root 用户运行过:/usr/sbin/slibclean 命令时,选择Y,开始升级安装 5.选择crs_home 目录,然后点下一步,开始升级安装 6.安装完结束前提示如下 To complete the installation of this patchset, you must perform the following tasks on each node:
1.Log in as the root user. 2.As the root user, perform the following tasks:
a.Shutdown the CRS daemons by issuing the following command: /u01/crs/oracle/product/10.2/crs/bin/crsctl stop crs b.Run the shell script located at: /u01/crs/oracle/product/10.2/crs/install/root102.sh This script will automatically start the CRS daemons on the patched node upon completion.
3.After completing this procedure, proceed to the next node and repeat. 要以root 用户停止crs,然后运行root102.sh脚本在第一个节点和第二个节点依次执行下面步骤,第一个节点执行完了后再在第二个节点上执行,两个节点都执行完以后再回到第一个节点点退出。 以 root 用户登录,然后停止crs: # su – root # /oracle/product/10.2.0/crs/bin/crsctl stop crs # /oracle/product/10.2.0/crs/install/root102.sh 7.在两个节点上脚本运行完成后,使用以下命令查看升级是否成功: $ crsctl query crs softwareversion 查看结果显示,如果版本为10.2.0.4 则表示升级成功。
2.6 建ASM 实例和磁盘组 1.这里需安装一个数据库补丁8350262.zip $ unzip 8350262.zip $ cd 8350262 $ ORACLE_HOME/OPatch/opatch apply 2.切换到oracle 用户下,运行以下命令: $dbca 选择Oracle Real Application Clusters database,点击Next 选择Configure Austomatic Storage Management,点击Next 点击“select all”选择所有节点,点击“next” 给出ASM SYS的密码为keyan,选择使用Pfile作为ASM的参数文件,点击Next 点击OK ASM 实例开始启动 出现ASM磁盘组的界面,点击Create New 出现选择磁盘新建磁盘组界面,点击Change Disk Discovery Path按钮 输入Discovery Path为/dev/asm_disk,点击OK 选择/dev/rrac_data01磁盘,选择Redundancy为Extenal,给出Disk Group Name为DATA01,点击OK 完成新建ASM工作
2.7 数据库建立 1.切换到oracle 用户下,运行以下命令: $dbca 选择Oracle Real Application Clusters database,点击Next 选择Create Database,点击Next 点击“select all”选择所有节点,点击“next” 选择General purpose,点击Next 输入Global Database Name和SID prefix为rac,点击Next 去掉Configure the Database with Enterprose Manager,点击Next 输入SYS和SYSTEM的密码,点击Next 储存选择Automatic Storage Management (ASM) ,点击Next 选择第四步建立的DATA01作为存储,点击Next 点击Next 点击Next 点击Next 出现Service配置界面,点击Add添加Service Enter Service name 处填写rac,点击OK TAF Policy 选择Basic,rac1和rac2都使用Perferred,点击Next 内存配置使用系统内存的65%,点击Sizing Tab页 更改Processes 为1024,选择Character Sets Tab页 选择Choose from the list of character sets中的ZHS16GBK, Defatult Language为Simplified Chinese,Default Date Format为China,点击Next 点击Next 点击Finish建立数据库。
验证RAC 集群和数据库配置 所有实例和服务的状态 $ srvctl status database -d rac Instance rac1 is running on node db1 Instance rac2 is running on node db2 单个实例的状态 $ srvctl status instance -d rac -i rac1 Instance rac1 is running on node db1 $ srvctl status instance -d rac -i rac2 Instance rac2 is running on node db2 在数据库全局命名服务的状态 $ srvctl status service -d keyan Service keyandb is running on instance(s) keyan2, keyan1 特定节点上节点应用程序的状态 $ srvctl status nodeapps -n db1 VIP is running on node: db1 GSD is running on node: db1 Listener is running on node: db1 ONS daemon is running on node: db1 $ srvctl status nodeapps -n db2 VIP is running on node: db2 GSD is running on node: db2 Listener is running on node: db2 ONS daemon is running on node: db2 ASM 实例的状态 $ srvctl status asm -n db1 ASM instance +ASM1 is running on node db1. $ srvctl status asm -n db2 ASM instance +ASM2 is running on node db2. 列出配置的所有数据库 $ srvctl config database rac 显示RAC 数据库的配置 $ srvctl config database -d rac db1 rac1 /oracle/product/10.2.0/db_1 db2 rac2 /oracle/product/10.2.0/db_1 显示指定集群数据库 $ srvctl config service -d keyan keyandb PREF: keyan2 keyan1 AVAIL: 显示节点应用程序的配置-(VIP、GSD、ONS、监听器) $ srvctl config nodeapps -n db1 -a -g -s -l VIP exists.: /db1-vip/210.34.96.199/255.255.255.0/en0 GSD exists. ONS daemon exists. Listener exists. $ srvctl config nodeapps -n db2 -a -g -s -l VIP exists.: /db2-vip/210.34.96.193/255.255.255.0/en0 GSD exists. ONS daemon exists. Listener exists. 显示ASM 实例的配置 $ srvctl config asm -n db1 +ASM1 /oracle/product/10.2.0/db_1 $ srvctl config asm -n db2 +ASM2 /oracle/product/10.2.0/db_1 集群中所有正在运行的实例
SQL> select inst_id, instance_number inst_no, instance_name inst_name, parallel, status, database_status db_status, active_state state, host_name host FROM gv$instance ORDER BY inst_id;
INST_ID INST_NO INST_NAME PAR STATUS DB_STATUS STATE HOST --------------------------------------------------------------------------------------------------------------------------------- 1 1 rac1 YES OPEN ACTIVENORMAL db1
2 2 rac2 YES OPEN ACTIVE NORMAL db2
位于磁盘组中的所有数据文件 SQL> select name from v$datafile;
NAME -------------------------------------------------------------------------------- +DATA01/rac/datafile/system.262.776302619 +DATA01/rac/datafile/undotbs1.263.776302627 +DATA01/rac/datafile/sysaux.264.776302633 +DATA01/rac/datafile/undotbs2.266.776302637 +DATA01/rac/datafile/users.267.776302641
SQL> select member from v$logfile;
MEMBER -------------------------------------------------------------------------------- +DATA01/rac/onlinelog/group_1.258.776302615 +DATA01/rac/onlinelog/group_1.259.776302615 +DATA01/rac/onlinelog/group_2.260.776302617 +DATA01/rac/onlinelog/group_2.261.776302617 +DATA01/rac/onlinelog/group_3.268.776304139 +DATA01/rac/onlinelog/group_3.269.776304141 +DATA01/rac/onlinelog/group_4.270.776304141 +DATA01/rac/onlinelog/group_4.271.776304143
8 rows selected.
SQL> select name from v$controlfile;
NAME -------------------------------------------------------------------------------- +DATA01/rac/controlfile/current.256.776302615 +DATA01/rac/controlfile/current.257.776302615