ITPub博客

首页 > 数据库 > Oracle > Oracle RAC搭建(三)

Oracle RAC搭建(三)

Oracle 作者:lively1982 时间:2014-09-04 17:54:22 0 删除 编辑
1.创建ASM存储盘:
1)安装所需软件包
[root@rac2 ~]# uname -a
Linux rac2 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux
[root@rac1 asmlib]# ls
oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.8-1.el5.i386.rpm
[root@rac1 asmlib]# rpm -ivh oracleasm-support-2.1.8-1.el5.i386.rpm
warning: oracleasm-support-2.1.8-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]
[root@rac1 asmlib]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
warning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.18-164.el########################################### [100%]
[root@rac1 asmlib]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm
warning: oracleasmlib-2.0.4-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasmlib           ########################################### [100%]
[root@rac2 asmlib]# rpm -ivh oracleasm-support-2.1.8-1.el5.i386.rpm
[root@rac2 asmlib]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
[root@rac2 asmlib]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm
2).我们将绑定的15G大小的裸设备raw2和raw3作为创建asm盘
节点1上执行:
[root@rac1 ~]# /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 []:
Default group to own the driver interface []:
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
在节点2上执行:
[root@rac2 ~]# /etc/init.d/oracleasm configure
3)创建ASM盘如下:
在节点rac1上操作如下:
[root@rac1 ~]# /etc/init.d/oracleasm createdisk ASMDISK1 /dev/sdc1
Marking disk "ASMDISK1" as an ASM disk:                    [  OK  ]
[root@rac1 ~]# /etc/init.d/oracleasm createdisk ASMDISK2 /dev/sdd1
Marking disk "ASMDISK2" as an ASM disk:                    [  OK  ]
扫描ASM盘:
[root@rac1 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@rac1 ~]# /etc/init.d/oracleasm listdisks
ASMDISK1
ASMDISK2
节点2上扫描并查看ASM盘:
[root@rac2 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@rac2 ~]# /etc/init.d/oracleasm listdisks
ASMDISK1
ASMDISK2
2.安装数据库软件:
[oracle@rac1 ~]$ cd /u01/app/database/
[oracle@rac1 database]$ ll
total 28
dr-xr-xr-x 9 oracle oinstall 4096 May 14 09:44 doc
dr-xr-xr-x 5 oracle oinstall 4096 May 14 09:44 install
dr-xr-xr-x 2 oracle oinstall 4096 May 14 09:44 response
-r-xr-xr-x 1 oracle oinstall 1327 May 14 09:44 runInstaller
dr-xr-xr-x 9 oracle oinstall 4096 May 14 09:45 stage
-r-xr-xr-x 1 oracle oinstall 5213 May 14 09:45 welcome.html
[oracle@rac1 database]$ ./runInstaller
此处采用企业级模式:

指定数据库安装目录:

对两个节点选中:

仅安装数据库软件:

按照提示执行脚本:

[root@rac1 ~]# /u01/app/oracle/db_1/root.sh
[root@rac2 ~]# /u01/app/oracle/db_1/root.sh
3.对数据库进行升级:
1)准备工作,两个节点分别在root下执行/u01/app/oracle/crs/bin/crsctl stop crs
#停止crs,确保除/bin/sh /etc/init.d/init.crsd run该进程外,没有其他crs进程运行。
[root@rac1 ~]# /u01/app/oracle/crs/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac2 ~]# /u01/app/oracle/crs/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 ~]# ps -ef |grep crs
root     29438     1  0 10:07 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root     29715 25495  0 10:07 pts/2    00:00:00 grep crs
[root@rac2 ~]# ps -ef |grep crs
root      5744     1  0 10:07 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root      6024 29841  0 10:08 pts/2    00:00:00 grep crs
2)执行补丁包中的runInstaller:
[root@rac1 p6810189_10204_Linux-x86.zip]# unzip p6810189_10204_Linux-x86.zip
[root@rac1 p6810189_10204_Linux-x86]# chown -R oracle:oinstall Disk1/
[root@rac1 p6810189_10204_Linux-x86]# ll
total 1030248
drwxr-xr-x 5 oracle oinstall       4096 Feb 22  2008 Disk1
-rw-r--r-- 1 root   root     1053748381 Nov  1  2010 p6810189_10204_Linux-x86.zip
-rw-r--r-- 1 root   root         178473 Feb 26  2008 README.html
[root@rac1 Disk1]# ll
total 1784
-rw-r--r--  1 oracle oinstall 1620786 Feb 22  2008 10204_buglist.htm
drwxr-xr-x  4 oracle oinstall    4096 Feb 17  2008 install
-rw-r--r--  1 oracle oinstall  178465 Feb 23  2008 patch_note.htm
drwxr-xr-x  2 oracle oinstall    4096 Feb 17  2008 response
-rwxr-xr-x  1 oracle oinstall    1756 Feb 17  2008 runInstaller
drwxr-xr-x 10 oracle oinstall    4096 Feb 22  2008 stage
先对clusterware打补丁:
指定CRS的目录:

此处默认两个节点已经选中,只需下一步:

按照提示执行脚本:


[root@rac1 ~]# /u01/app/oracle/crs/bin/crsctl stop crs
Stopping resources.
Error while stopping resources. Possible cause: CRSD is down.
Stopping CSSD.
Unable to communicate with the CSS daemon.
[root@rac1 ~]# /u01/app/oracle/crs/install/root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /u01/app/oracle/crs
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
.
.
. . . . . .
Timed out waiting for the CRS daemons to start. Look at the
system message file and the CRS log files for diagnostics.
[root@rac2 ~]# /u01/app/oracle/crs/bin/crsctl stop crs
[root@rac2 ~]# /u01/app/oracle/crs/install/root102.sh
验证节点的CRS是否已经起来:
[oracle@rac2 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
----------------------------------------------------------------------
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2
对数据库进行升级:
指定之前配置的数据库软件目录:



在弹出的错误框中依据提示,root用户终端执行如下命令:

[root@rac1 ~]# /u01/app/oracle/db_1/root.sh
[root@rac2 ~]#  /u01/app/oracle/db_1/root.sh
3)验证CRS和数据库的版本是否升级:
[oracle@rac1 ~]$ cd /u01/app/oracle/crs/OPatch/
[oracle@rac1 OPatch]$ ll
total 48
drwxrwx--- 2 oracle oinstall  4096 May 14 10:20 docs
-rw-r--r-- 1 oracle oinstall 19263 Dec 26  2006 emdpatch.pl
drwxrwx--- 2 oracle oinstall  4096 May 14 10:20 jlib
-rwxr-xr-x 1 oracle oinstall  6315 Nov 23  2007 opatch
-rw-r--r-- 1 oracle oinstall    49 May 14 10:20 opatch.ini
-rw-r--r-- 1 oracle oinstall  2571 Aug  8  2006 opatch.pl
drwxrwx--- 4 oracle oinstall  4096 May 14 10:20 opatchprereqs
[oracle@rac1 OPatch]$  ./opatch lsinventory
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/db_1
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.2
OUI version       : 10.2.0.4.0
OUI location      : /u01/app/oracle/db_1/oui
Log file location : /u01/app/oracle/db_1/cfgtoollogs/opatch/opatch2014-05-14_10-53-55AM.log
Lsinventory Output file location : /u01/app/oracle/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-05-14_10-53-55AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g                                                  10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3                            10.2.0.4.0
There are 2 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

Rac system comprising of multiple nodes
  Local node = rac1
  Remote node = rac2
--------------------------------------------------------------------------------
OPatch succeeded.
4.配置ASM实例和数据库实例
1)配置监听
[oracle@rac1 ~]$ netca



检查监听状态:
[oracle@rac2 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
----------------------------------------------------------------------
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2
2)配置ASM实例
首先在两个节点执行查看ASM磁盘看是否存在:
[oracle@rac1 admin]$ oracleasm listdisks
ASMDISK1
ASMDISK2
[oracle@rac2 ~]$ oracleasm listdisks
ASMDISK1
ASMDISK2
[oracle@rac1 admin]$ dbca




指定磁盘组的名字:

显示在第二个节点上无法挂载磁盘组,此处先不管它,稍后手动挂载:

磁盘组挂载情况:

配置完成之后查看ASM,如下:
[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
----------------------------------------------------------------------
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2
在节点rac2上挂载磁盘组,如下;

[oracle@rac2 ~]$ export ORACLE_SID=+ASM2
[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Wed May 14 20:52:15 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select inst_id,name,state from gv$asm_diskgroup;

   INST_ID NAME                           STATE
---------- ------------------------------ -----------
         1 RAC_GROUP                      MOUNTED
         2 RAC_GROUP                      DISMOUNTED

SQL> show parameter asm;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string      RAC_GROUP
asm_diskstring                       string
asm_power_limit                      integer     1
SQL> alter system set asm_diskstring='/dev/raw/raw2,/dev/raw/raw3';

System altered.

SQL> alter diskgroup RAC_GROUP mount;
alter diskgroup RAC_GROUP mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"RAC_GROUP"                          #出现挂载不了的情况
重启节点rac2,查看是否能够挂载:
[oracle@rac2 ~]$ export ORACLE_SID=+ASM2
[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Wed May 14 21:13:01 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select inst_id,state,name from gv$asm_diskgroup;

   INST_ID STATE       NAME
---------- ----------- ------------------------------
         1 MOUNTED     RAC_GROUP
         2 MOUNTED     RAC_GROUP               #是不是很邪乎,ASM是oracle10g出来的产品,可能存在一些需要改进的地方,此处不再敖述
3)创建数据库实例
[oracle@rac1 ~]$ dbca
指定创建的是集群数据库:

创建数据库实例:

选中两个节点:

此处选择一般用途:

指定全局数据库名:

禁用企业管理器:

设置数据库管理员的密码:

采用ASM自动存储管理方式:

输入之前设置的磁盘组的密码:

查看磁盘组挂载情况,此处需要两个节点都要挂载:

数据库文件管理方式采用磁盘组模式:

此处对恢复区先不做配置:

数据库内容,此处选择默认,继续下一步:

数据库服务,此处选择默认,继续下一步:


安装成功界面:

验证:使用数据库实例登录数据库

[oracle@rac1 ~]$ export ORACLE_SID=orcl1
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Thu May 15 11:47:03 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
orcl1            OPEN
[oracle@rac2 ~]$ export ORACLE_SID=orcl2
[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Thu May 15 11:48:20 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
orcl2            OPEN

补充:对于已经创建了数据库,想从低版本升级到高版本,要先对原有数据库进行备份,然后删除数据库,先对crs进行升级,然后对数据库进行升级。
注意,在对数据库进行的升
级的时候lsnrctl和ASM要处于offline状态,否则无法完成数据库的升级,这是笔者亲身经历过得事情。

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

下一篇: Oracle RAC搭建(一)
请登录后发表评论 登录
全部评论

注册时间:2013-11-27

  • 博文量
    31
  • 访问量
    59135