【原创】RedHat Enterprise 5.6 安装Oracle 10 RAC,并升级至10.0.2.5实录

 高可用数据库安装手册(Oracle RAC)

  

1       概述... 1

1.1        系统拓扑图... 1

1.2        磁盘阵列需求... 1

2       数据库服务器规划... 1

2.1        主机系统规划... 1

2.1.1         系统软件规划... 1

2.1.2         操作系统参数规划... 2

2.1.3         操作系统Patch规划... 2

2.1.4         本机磁盘规划... 3

2.1.5         用户组规划... 3

2.2        系统安装配置规划... 3

2.2.1         安装Oracle 10.2.0.1产品... 3

2.2.2         安装Oracle Clusterware产品... 3

2.2.3         数据库实例... 3

3       服务器环境... 4

3.1       配置网络... 4

3.2       创建Oracle用户... 5

3.2.1         创建oracle安装目录... 6

3.3       提高oracle 用户限制... 6

3.4       安装Oracle安装所需软件包... 7

3.5       配置内核参数... 7

3.6       修改/etc/hosts. 7

3.7       配置 hangcheck timer 内核模块... 7

3.8       安装oracleasmlib程序包... 8

3.9       修改redhat-release文件... 8

3.10         划分存储并创建卷组... 8

3.10.1       为磁盘创建物理卷标... 8

3.10.2       划分存储分区... 8

3.11         在卷组中创建逻辑卷... 10

3.11.1       在节点1(oradb1)创建逻辑卷... 10

3.11.2       在节点2(oradb2)激活逻辑卷... 13

3.12         为存储分区映射裸设备... 17

3.13         使SSH等效... 20

3.14         配置Oracle ASM.. 22

3.15         创建Oracle集群目录... 22

4       高可用数据库安装... 22

4.1       安装Oracle集群件... 22

4.2       安装Oracle数据库10g. 36

4.3       安装10.2.0.5集群件补丁... 42

4.4       安装10.2.0.5数据库软件补丁... 47

4.5       创建数据库监听Listener. 53

4.6       创建数据库oradb. 58

5       了解Oracle RAC数据库... 71

5.1       检查数据库集群运行状况... 71

5.2       数据库TNS. 71

5.3       检查Oracle集群件的状态... 72

5.4       列出Oracle 实例... 72

5.5       检查连接... 73

5.6       检查数据库配置... 73

5.7       启动和停止应用程序资源... 74

5.8       启动和停止数据库控制台... 74

6       如何扩展表空间... 76

7       如何新增表空间... 78

8       如何使用扩充存储... 79

9       Oracle RAC常见问题... 79

9.1       无法通过JDBC URL以负载均衡方式连接数据库... 79

 

1  概述

1.1 系统拓扑图

1.2 磁盘阵列需求

存储路径

分区编号

空间大小(GB

备注

/dev/mpath/mpath1

mpath1p1

2GB

ocr磁盘

mpath1p2

2GB

vote磁盘

mpath1p3

245GB

oravg卷组成员

/dev/mpath/mpath2

mpath2p1

250GB

oravg卷组成员

/dev/mpath/mpath3

mpath3p1

250GB

oravg卷组成员

/dev/mpath/mpath4

mpath4p1

250GB

oravg卷组成员

 2  数据库服务器规划

2.1 主机系统规划

2.1.1   系统软件规划

说明:两台服务器临时称为A机和B机

项目

A机与B

备注

主机机型

PC Server

 

阵列类型

RAID5

 

CPU

24

 

内存(G)

32

 

内置盘个数×容量(G)

1*300G

 

阵列磁盘个数×容量(G)

4*250G

 

网络要求

千兆网卡*2

 

IP地址

4

 

操作系统

RedHat Enterprise Linux 5

 

操作系统补丁

5.6

 

2.1.2   操作系统参数规划

参数

调整后值

备注

kernel.shmmni

4096

 

kernel.sem

250 32000 100 128

 

fs.file-max

6815744

 

fs.aio-max-nr

1048576

 

net.ipv4.ip_local_port_range

1024 65000

 

net.core.rmem_default

1048576

 

net.core.rmem_max

4194304

 

net.core.wmem_default

262144

 

net.core.wmem_max

1048576

 

kernel.msgmnb

65536

 

kernel.msgmax

65536

 

kernel.shmmax

68719476736

 

kernel.shmall

4294967296

 

2.1.3   操作系统Patch规划

编号

Filesets名称

检查方法

1

oracleasm-support-2.1.7-1.el5
oracleasmlib-2.0.4-1.el5
oracleasm-2.6.18-238.el5xen-2.0.5-1.el5

rpm -qa | grep oracleasm

如果未安装,使用rpm –ivh *.rpm命令安装。

2.1.4   本机磁盘规划

文件系统挂接点

(Mount Point)

小型机A/小型机B  规划

备注

/

238G

剩余空间划分至“/”节点

swap

32G

 

/boot

100M

 

2.1.5   用户组规划

创建用户oracle和组dba、oinstall

2.2 系统安装配置规划

服务器为ORACLE 10g for RAC

2.2.1   安装Oracle 10.2.0.1产品

Oracle主目录 Oracle_Base=/oracle并升级10.2.0.5补丁

2.2.2   安装Oracle Clusterware产品

安装Oracle Clusterware 10.2.0.1并升级10.2.0.5补丁

2.2.3   数据库实例

²  数据库实例名Oracle_SID=ORADB

²  使用Enterprise Manager配置数据库。

²  数据库组件只选择“Enterprise Manager”资料档案库和标准数据库组件中的Oracle JVM,其它都不选。

²  归档模式:在没有配置备份软件前,先不要开启归档模式。正式上线后要使用归档模式备份。

²  专用服务器模式。

²  监听器名称listener,端口1521

²  初始化参数:

processes=800

nls_date_format=YYYY-MM-DD

nls_date_language=AMERICAN

²  字符集

    <characterSet>GBK</characterSet>

<nationalCharacterSet>AL16UTF16</nationalCharacterSet>

²  表空间

表空间名称

大小

system

5G

sysaux

5G

undotbs1

5G

undotbs2

5G

users

2G

temp01

2G

temp02

2G

3  服务器环境

3.1 配置网络

  1. 网络配置

主机名

网卡名称

IP地址

子网掩码

oradb1

eth1

10.1.3.8

255.255.252.192

eth0

192.168.1.198

255.255.255.0

oradb2

eth1

10.1.3.10

255.255.252.192

eth0

192.168.1.199

255.255.255.0

  1. 主机hosts信息

127.0.0.1       localhost

::1             localhost6

10.1.3.8      oradb1

10.1.3.9      oradb1-vip

10.1.3.10     oradb2

10.1.3.11     oradb2-vip

192.168.1.198   oradb1-priv

192.168.1.199   oradb2-priv

3.2 创建Oracle用户

以root身份在oradb1和oradb2上分别运行如下命令:

# groupadd dba

# groupadd oinstall

# useradd oracle -g oinstall -G dba,oinstall

# passwd oracle

New Password:
Re-enter new Password:
passwd: password successfully changed for oracle

(1) 修改oracle用户环境变量

以root身份在ORADB1上以编辑/home/oracle/.bash_profile文件中加入以下环境变量

export LANG=en_US

export EDITOR=vi

export ORACLE_SID=oradb1

export ORACLE_BASE=/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

以root身份在ORADB2上编辑/home/oracle/.bash_profile文件中加入以下环境变量

export LANG=en_US

export EDITOR=vi

export ORACLE_SID=oradb2

export ORACLE_BASE=/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.2.1   创建oracle安装目录

以root身份分别在两个节点运行以下命令:

# mkdir -p /oracle

# chown -R oracle:oinstall /oracle

# su - oracle

$ mkdir -p $ORACLE_HOME

$ mkdir -p $ORACRS_HOME

3.3 提高oracle 用户限制

以root身份分别在两个节点执行以下操作:

在/etc/security/limits.conf、/etc/pam.d/login和/etc/profile文件中加入如下代码:

/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

/etc/pam.d/login

session required pam_limits.so

/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

3.4 安装Oracle安装所需软件包

以root身份分别在两个节点安装Oracle所需文件:

libaio-0.3.105-2.i386.rpm

openmotif21-2.1.30-11.RHEL4.6.i386.rpm

以root用户执行下面命令:

rpm –ivh *.rpm

3.5 配置内核参数

以root身份分别在两个节点将下列代码加入/etc/sysctl.conf,要立即生效可执行/sbin/sysctl –p:

kernel.shmall                = 2097152
kernel.shmmax                = 2147483648
kernel.shmmni                = 4096
kernel.sem                   = 250 32000 100 128
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

3.6 修改/etc/hosts

以root身份分别在两个节点将以下内容加入到/etc/hosts中:
127.0.0.1       localhost
::1             localhost6
10.1.3.8      oradb1
10.1.3.9      oradb1-vip
10.1.3.10     oradb2
10.1.3.11     oradb2-vip
192.168.1.198   oradb1-priv
192.168.1.199   oradb2-priv

3.7 配置 hangcheck timer 内核模块

以root身份分别在两个节点/etc/modprobe.conf中加入如下代码,要想立即生效请执行modprobe –v hangcheck-timer

/etc/modprobe.conf

options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

3.8 安装oracleasmlib程序包

以root身份分别在两个节点上执行以下操作

rpm –ivh oracleasmlib-2.0.2-1.i386.rpm

安装完成后,确认已经安装了如下软件包:
[root@oradb1]# rpm -qa | grep oracleasm

oracleasm-support-2.1.7-1.el5

oracleasmlib-2.0.4-1.el5

oracleasm-2.6.18-238.el5xen-2.0.5-1.el5

3.9 修改redhat-release文件

/etc/redhat-release

Red Hat Enterprise Linux Server release 4 (Tikanga)

3.10  划分存储并创建卷组

3.10.1 为磁盘创建物理卷标

先以root身份在第一个节点上执行:

[root@oradb1 ~]# pvcreate /dev/mapper/mpath1

[root@oradb1 ~]# pvcreate /dev/mapper/mpath2

[root@oradb1 ~]# pvcreate /dev/mapper/mpath3

[root@oradb1 ~]# pvcreate /dev/mapper/mpath4

3.10.2 划分存储分区

以root身份在第一个节点上执行fdisk进行存储磁盘分区:

[root@oradb1 ~]# fdisk /dev/mapper/mpath1

为第一块存储创建3个分区,前两个分别为2GB大小,第三个为250G大小,输入:

【n、p、1、回车、+2G、n、p、2、回车、+2G、n、p、3、回车、回车、w】

[root@oradb1 ~]# fdisk /dev/mapper/mpath2

为第二块存储创建1个分区,为整个磁盘大小【输入n、p、1、回车、回车、w】

[root@oradb1 ~]# fdisk /dev/mapper/mpath3

为第三块存储创建1个分区,为整个磁盘大小【输入n、p、1、回车、回车、w】

[root@oradb1 ~]# fdisk /dev/mapper/mpath4

为第四块存储创建1个分区,为整个磁盘大小【输入n、p、1、回车、回车、w】

 

创建oravg卷组

vgcreate oravg /dev/mapper/mpath1p3 /dev/mapper/mpath2p1 /dev/mapper/mpath3p1 /dev/mapper/mpath4p1

创建完成后执行vgscan

[root@oradb1 ~]# vgscan

  Reading all physical volumes.  This may take a while...

  Found volume group "oravg" using metadata type lvm2

  Found volume group "VolGroup00" using metadata type lvm2

再执行vgdisplay oravg

[root@oradb1 ~]# vgdisplay oravg

  --- Volume group ---

  VG Name               oravg

  System ID            

  Format                lvm2

  Metadata Areas        4

  Metadata Sequence No  80

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                79

  Open LV               34

  Max PV                0

  Cur PV                4

  Act PV                4

  VG Size               1.00 TB

  PE Size               4.00 MB

  Total PE              262875

  Alloc PE / Size       254377 / 993.66 GB

  Free  PE / Size       8498 / 993.66 GB

  VG UUID               mVRTxm-Dmwe-3Ces-XoM7-QGKE-x3ch-OtgUIc

则从上图中看出有1TB的存储被划分,磁盘划分完毕后运行fdisk -l列出分区信息:

[root@oradb1 ~]# fdisk -l

 

Disk /dev/sda: 299.4 GB, 299439751168 bytes

255 heads, 63 sectors/track, 36404 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14       36404   292310707+  8e  Linux LVM

 

Disk /dev/dm-2: 276.6 GB, 276649082880 bytes

255 heads, 63 sectors/track, 33634 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-2p1               1         244     1959898+  83  Linux

/dev/dm-2p2             245         488     1959930   83  Linux

/dev/dm-2p3             489       33634   266245245   83  Linux

 

Disk /dev/dm-3: 276.6 GB, 276649082880 bytes

255 heads, 63 sectors/track, 33634 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-3p1               1       33634   270165073+  83  Linux

 

Disk /dev/dm-4: 276.6 GB, 276649082880 bytes

255 heads, 63 sectors/track, 33634 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-4p1               1       33634   270165073+  83  Linux

 

Disk /dev/dm-5: 276.6 GB, 276649082880 bytes

255 heads, 63 sectors/track, 33634 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-5p1               1       33634   270165073+  83  Linux

提示:盘阵上目前共1000G空间,共分为6个分区。

3.11  在卷组中创建逻辑卷

3.11.1 在节点1(oradb1)创建逻辑卷

以root身份在第一个节点上执行lvcreate进行逻辑卷划分:

lvcreate -n system -L 5G oravg

lvcreate -n sysaux -L 5G oravg

lvcreate -n undotbs1 -L 5G oravg

lvcreate -n undotbs2 -L 5G oravg

lvcreate -n users -L 2G oravg

lvcreate -n temp01 -L 2G oravg

lvcreate -n temp02 -L 2G oravg

lvcreate -n control1 -L 2G oravg

lvcreate -n control2 -L 2G oravg

lvcreate -n control3 -L 2G oravg

lvcreate -n spfile -L 100M oravg

lvcreate -n redo1_1 -L 200M oravg

lvcreate -n redo1_2 -L 200M oravg

lvcreate -n redo1_3 -L 200M oravg

lvcreate -n redo1_4 -L 200M oravg

lvcreate -n redo2_1 -L 200M oravg

lvcreate -n redo2_2 -L 200M oravg

lvcreate -n redo2_3 -L 200M oravg

lvcreate -n redo2_4 -L 200M oravg

lvcreate -n data_10g_01 -L 10G oravg

lvcreate -n data_10g_02 -L 10G oravg

lvcreate -n data_10g_03 -L 10G oravg

lvcreate -n data_10g_04 -L 10G oravg

lvcreate -n data_10g_05 -L 10G oravg

lvcreate -n data_10g_06 -L 10G oravg

lvcreate -n data_10g_07 -L 10G oravg

lvcreate -n data_10g_08 -L 10G oravg

lvcreate -n data_10g_09 -L 10G oravg

lvcreate -n data_10g_10 -L 10G oravg

lvcreate -n data_10g_11 -L 10G oravg

lvcreate -n data_10g_12 -L 10G oravg

lvcreate -n data_10g_13 -L 10G oravg

lvcreate -n data_10g_14 -L 10G oravg

lvcreate -n data_10g_15 -L 10G oravg

lvcreate -n data_10g_16 -L 10G oravg

lvcreate -n data_10g_17 -L 10G oravg

lvcreate -n data_10g_18 -L 10G oravg

lvcreate -n data_10g_19 -L 10G oravg

lvcreate -n data_10g_20 -L 10G oravg

lvcreate -n data_20g_01 -L 20G oravg

lvcreate -n data_20g_02 -L 20G oravg

lvcreate -n data_20g_03 -L 20G oravg

lvcreate -n data_20g_04 -L 20G oravg

lvcreate -n data_20g_05 -L 20G oravg

lvcreate -n data_20g_06 -L 20G oravg

lvcreate -n data_20g_07 -L 20G oravg

lvcreate -n data_20g_08 -L 20G oravg

lvcreate -n data_20g_09 -L 20G oravg

lvcreate -n data_20g_10 -L 20G oravg

lvcreate -n data_20g_11 -L 20G oravg

lvcreate -n data_20g_12 -L 20G oravg

lvcreate -n data_20g_13 -L 20G oravg

lvcreate -n data_20g_14 -L 20G oravg

lvcreate -n data_20g_15 -L 20G oravg

lvcreate -n data_20g_16 -L 20G oravg

lvcreate -n data_20g_17 -L 20G oravg

lvcreate -n data_20g_18 -L 20G oravg

lvcreate -n data_20g_19 -L 20G oravg

lvcreate -n data_20g_20 -L 20G oravg

lvcreate -n data_20g_21 -L 20G oravg

lvcreate -n data_20g_22 -L 20G oravg

lvcreate -n data_20g_23 -L 20G oravg

lvcreate -n data_20g_24 -L 20G oravg

lvcreate -n data_20g_25 -L 20G oravg

lvcreate -n data_20g_26 -L 20G oravg

lvcreate -n data_20g_27 -L 20G oravg

lvcreate -n data_20g_28 -L 20G oravg

lvcreate -n data_20g_29 -L 20G oravg

lvcreate -n data_20g_30 -L 20G oravg

lvcreate -n data_20g_31 -L 20G oravg

lvcreate -n data_20g_32 -L 20G oravg

lvcreate -n data_20g_33 -L 20G oravg

lvcreate -n data_20g_34 -L 20G oravg

lvcreate -n data_20g_35 -L 20G oravg

lvcreate -n data_20g_36 -L 20G oravg

lvcreate -n data_tmp01 -L 10G oravg

lvcreate -n data_tmp02 -L 10G oravg

lvcreate -n data_tmp03 -L 10G oravg

lvcreate -n data_tmp04 -L 10G oravg

创建完成后,执行lvscan,查看lv的状态

[root@oradb1 ~]# lvscan

  ACTIVE            '/dev/oravg/system' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/sysaux' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/undotbs1' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/undotbs2' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/users' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/temp01' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/temp02' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/control1' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/control2' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/control3' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/spfile' [100.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_1' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_2' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_3' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_4' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_1' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_2' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_3' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_4' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/data_10g_01' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_02' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_03' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_04' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_05' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_06' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_07' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_08' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_09' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_10' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_11' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_12' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_13' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_14' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_15' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_16' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_17' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_18' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_19' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_20' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_01' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_02' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_03' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_04' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_05' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_06' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_07' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_08' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_09' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_10' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_11' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_12' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_13' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_14' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_15' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_16' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_17' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_18' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_19' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_20' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_21' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_22' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_23' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_24' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_25' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_26' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_27' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_28' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_29' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_30' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp01' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp02' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp03' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp04' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_31' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_32' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_33' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_34' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_35' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_36' [20.00 GB] inherit

3.11.2 在节点2(oradb2)激活逻辑卷

以root身份在第二个节点上执行lvchange进行逻辑卷激活:

lvchange -a y /dev/oravg/system

lvchange -a y /dev/oravg/sysaux

lvchange -a y /dev/oravg/undotbs1

lvchange -a y /dev/oravg/undotbs2

lvchange -a y /dev/oravg/users

lvchange -a y /dev/oravg/temp01

lvchange -a y /dev/oravg/temp02

lvchange -a y /dev/oravg/control1

lvchange -a y /dev/oravg/control2

lvchange -a y /dev/oravg/control3

lvchange -a y /dev/oravg/spfile

lvchange -a y /dev/oravg/redo1_1

lvchange -a y /dev/oravg/redo1_2

lvchange -a y /dev/oravg/redo1_3

lvchange -a y /dev/oravg/redo1_4

lvchange -a y /dev/oravg/redo2_1

lvchange -a y /dev/oravg/redo2_2

lvchange -a y /dev/oravg/redo2_3

lvchange -a y /dev/oravg/redo2_4

lvchange -a y /dev/oravg/data_10g_01

lvchange -a y /dev/oravg/data_10g_02

lvchange -a y /dev/oravg/data_10g_03

lvchange -a y /dev/oravg/data_10g_04

lvchange -a y /dev/oravg/data_10g_05

lvchange -a y /dev/oravg/data_10g_06

lvchange -a y /dev/oravg/data_10g_07

lvchange -a y /dev/oravg/data_10g_08

lvchange -a y /dev/oravg/data_10g_09

lvchange -a y /dev/oravg/data_10g_10

lvchange -a y /dev/oravg/data_10g_11

lvchange -a y /dev/oravg/data_10g_12

lvchange -a y /dev/oravg/data_10g_13

lvchange -a y /dev/oravg/data_10g_14

lvchange -a y /dev/oravg/data_10g_15

lvchange -a y /dev/oravg/data_10g_16

lvchange -a y /dev/oravg/data_10g_17

lvchange -a y /dev/oravg/data_10g_18

lvchange -a y /dev/oravg/data_10g_19

lvchange -a y /dev/oravg/data_10g_20

lvchange -a y /dev/oravg/data_20g_01

lvchange -a y /dev/oravg/data_20g_02

lvchange -a y /dev/oravg/data_20g_03

lvchange -a y /dev/oravg/data_20g_04

lvchange -a y /dev/oravg/data_20g_05

lvchange -a y /dev/oravg/data_20g_06

lvchange -a y /dev/oravg/data_20g_07

lvchange -a y /dev/oravg/data_20g_08

lvchange -a y /dev/oravg/data_20g_09

lvchange -a y /dev/oravg/data_20g_10

lvchange -a y /dev/oravg/data_20g_11

lvchange -a y /dev/oravg/data_20g_12

lvchange -a y /dev/oravg/data_20g_13

lvchange -a y /dev/oravg/data_20g_14

lvchange -a y /dev/oravg/data_20g_15

lvchange -a y /dev/oravg/data_20g_16

lvchange -a y /dev/oravg/data_20g_17

lvchange -a y /dev/oravg/data_20g_18

lvchange -a y /dev/oravg/data_20g_19

lvchange -a y /dev/oravg/data_20g_20

lvchange -a y /dev/oravg/data_20g_21

lvchange -a y /dev/oravg/data_20g_22

lvchange -a y /dev/oravg/data_20g_23

lvchange -a y /dev/oravg/data_20g_24

lvchange -a y /dev/oravg/data_20g_25

lvchange -a y /dev/oravg/data_20g_26

lvchange -a y /dev/oravg/data_20g_27

lvchange -a y /dev/oravg/data_20g_28

lvchange -a y /dev/oravg/data_20g_29

lvchange -a y /dev/oravg/data_20g_30

lvchange -a y /dev/oravg/data_tmp01

lvchange -a y /dev/oravg/data_tmp02

lvchange -a y /dev/oravg/data_tmp03

lvchange -a y /dev/oravg/data_tmp04

lvchange -a y /dev/oravg/data_20g_31

lvchange -a y /dev/oravg/data_20g_32

lvchange -a y /dev/oravg/data_20g_33

lvchange -a y /dev/oravg/data_20g_34

lvchange -a y /dev/oravg/data_20g_35

lvchange -a y /dev/oravg/data_20g_36

激活完成后,执行lvscan的结果应该跟节点1一致:

[root@oradb2 ~]# lvscan

  ACTIVE            '/dev/oravg/system' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/sysaux' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/undotbs1' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/undotbs2' [5.00 GB] inherit

  ACTIVE            '/dev/oravg/users' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/temp01' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/temp02' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/control1' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/control2' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/control3' [2.00 GB] inherit

  ACTIVE            '/dev/oravg/spfile' [100.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_1' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_2' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_3' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo1_4' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_1' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_2' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_3' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/redo2_4' [200.00 MB] inherit

  ACTIVE            '/dev/oravg/data_10g_01' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_02' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_03' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_04' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_05' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_06' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_07' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_08' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_09' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_10' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_11' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_12' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_13' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_14' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_15' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_16' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_17' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_18' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_19' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_10g_20' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_01' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_02' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_03' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_04' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_05' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_06' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_07' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_08' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_09' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_10' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_11' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_12' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_13' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_14' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_15' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_16' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_17' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_18' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_19' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_20' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_21' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_22' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_23' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_24' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_25' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_26' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_27' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_28' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_29' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_30' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp01' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp02' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp03' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_tmp04' [10.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_31' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_32' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_33' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_34' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_35' [20.00 GB] inherit

  ACTIVE            '/dev/oravg/data_20g_36' [20.00 GB] inherit

3.12  为存储分区映射裸设备

以root身份分别在两个节点上将下行添加到/etc/sysconfig/rawdevice中:

/etc/sysconfig/rawdevice

/dev/raw/raw1   /dev/mapper/mpath1p1

/dev/raw/raw2   /dev/mapper/mpath1p2

######################################

/dev/raw/raw3   /dev/oravg/system

/dev/raw/raw4   /dev/oravg/sysaux

/dev/raw/raw5   /dev/oravg/undotbs1

/dev/raw/raw6   /dev/oravg/undotbs2

/dev/raw/raw7   /dev/oravg/users

/dev/raw/raw8   /dev/oravg/temp01

/dev/raw/raw9   /dev/oravg/temp02

/dev/raw/raw10  /dev/oravg/control1

/dev/raw/raw11  /dev/oravg/control2

/dev/raw/raw12  /dev/oravg/control3

/dev/raw/raw13  /dev/oravg/spfile

/dev/raw/raw14  /dev/oravg/redo1_1

/dev/raw/raw15  /dev/oravg/redo1_2

/dev/raw/raw16  /dev/oravg/redo1_3

/dev/raw/raw17  /dev/oravg/redo1_4

/dev/raw/raw18  /dev/oravg/redo2_1

/dev/raw/raw19  /dev/oravg/redo2_2

/dev/raw/raw20  /dev/oravg/redo2_3

/dev/raw/raw21  /dev/oravg/redo2_4

/dev/raw/raw22  /dev/oravg/data_10g_01

/dev/raw/raw23  /dev/oravg/data_10g_02

/dev/raw/raw24  /dev/oravg/data_10g_03

/dev/raw/raw25  /dev/oravg/data_10g_04

/dev/raw/raw26  /dev/oravg/data_10g_05

/dev/raw/raw27  /dev/oravg/data_10g_06

/dev/raw/raw28  /dev/oravg/data_10g_07

/dev/raw/raw29  /dev/oravg/data_10g_08

/dev/raw/raw30  /dev/oravg/data_10g_09

/dev/raw/raw31  /dev/oravg/data_10g_10

/dev/raw/raw32  /dev/oravg/data_10g_11

/dev/raw/raw33  /dev/oravg/data_10g_12

/dev/raw/raw34  /dev/oravg/data_10g_13

/dev/raw/raw35  /dev/oravg/data_10g_14

/dev/raw/raw36  /dev/oravg/data_10g_15

/dev/raw/raw37  /dev/oravg/data_10g_16

/dev/raw/raw38  /dev/oravg/data_10g_17

/dev/raw/raw39  /dev/oravg/data_10g_18

/dev/raw/raw40  /dev/oravg/data_10g_19

/dev/raw/raw41  /dev/oravg/data_10g_20

/dev/raw/raw42  /dev/oravg/data_20g_01

/dev/raw/raw43  /dev/oravg/data_20g_02

/dev/raw/raw44  /dev/oravg/data_20g_03

/dev/raw/raw45  /dev/oravg/data_20g_04

/dev/raw/raw46  /dev/oravg/data_20g_05

/dev/raw/raw47  /dev/oravg/data_20g_06

/dev/raw/raw48  /dev/oravg/data_20g_07

/dev/raw/raw49  /dev/oravg/data_20g_08

/dev/raw/raw50  /dev/oravg/data_20g_09

/dev/raw/raw51  /dev/oravg/data_20g_10

/dev/raw/raw52  /dev/oravg/data_20g_11

/dev/raw/raw53  /dev/oravg/data_20g_12

/dev/raw/raw54  /dev/oravg/data_20g_13

/dev/raw/raw55  /dev/oravg/data_20g_14

/dev/raw/raw56  /dev/oravg/data_20g_15

/dev/raw/raw57  /dev/oravg/data_20g_16

/dev/raw/raw58  /dev/oravg/data_20g_17

/dev/raw/raw59  /dev/oravg/data_20g_18

/dev/raw/raw60  /dev/oravg/data_20g_19

/dev/raw/raw61  /dev/oravg/data_20g_20

/dev/raw/raw62  /dev/oravg/data_20g_21

/dev/raw/raw63  /dev/oravg/data_20g_22

/dev/raw/raw64  /dev/oravg/data_20g_23

/dev/raw/raw65  /dev/oravg/data_20g_24

/dev/raw/raw66  /dev/oravg/data_20g_25

/dev/raw/raw67  /dev/oravg/data_20g_26

/dev/raw/raw68  /dev/oravg/data_20g_27

/dev/raw/raw69  /dev/oravg/data_20g_28

/dev/raw/raw70  /dev/oravg/data_20g_29

/dev/raw/raw71  /dev/oravg/data_20g_30

/dev/raw/raw72  /dev/oravg/data_tmp01

/dev/raw/raw73  /dev/oravg/data_tmp02

/dev/raw/raw74  /dev/oravg/data_tmp03

/dev/raw/raw75  /dev/oravg/data_tmp04

/dev/raw/raw76  /dev/oravg/data_20g_31

/dev/raw/raw77  /dev/oravg/data_20g_32

/dev/raw/raw78  /dev/oravg/data_20g_33

/dev/raw/raw79  /dev/oravg/data_20g_34

/dev/raw/raw80  /dev/oravg/data_20g_35

/dev/raw/raw81  /dev/oravg/data_20g_36

要使映射立即生效,请执行如下命令:

# /sbin/service rawdevices restart

修改裸设备权限
# chown oracle:dba /dev/raw/raw*
# chmod 660 /dev/raw/raw*
# ls -lat /dev/raw/raw*
crw-rw---- 1 oracle dba 162,  2 Jan 14 19:49 /dev/raw/raw2
crw-rw---- 1 oracle dba 162, 10 Jan 14 19:49 /dev/raw/raw10
crw-rw---- 1 oracle dba 162, 11 Jan 14 19:49 /dev/raw/raw11
crw-rw---- 1 oracle dba 162, 12 Jan 14 19:49 /dev/raw/raw12
crw-rw---- 1 oracle dba 162, 15 Jan 14 19:49 /dev/raw/raw15
crw-rw---- 1 oracle dba 162,  5 Jan 14 19:49 /dev/raw/raw5
crw-rw---- 1 oracle dba 162,  4 Jan 14 19:49 /dev/raw/raw4
crw-rw---- 1 oracle dba 162,  3 Jan 14 19:48 /dev/raw/raw3
crw-rw---- 1 oracle dba 162, 26 Jan 14 19:46 /dev/raw/raw26
crw-rw---- 1 oracle dba 162, 13 Jan 14 19:00 /dev/raw/raw13
crw-rw---- 1 oracle dba 162, 23 Jan 14 19:00 /dev/raw/raw23
crw-rw---- 1 oracle dba 162, 39 Jan 14 19:00 /dev/raw/raw39
crw-rw---- 1 oracle dba 162, 34 Jan 14 18:56 /dev/raw/raw34
crw-rw---- 1 oracle dba 162, 27 Jan 14 18:56 /dev/raw/raw27
crw-rw---- 1 oracle dba 162, 14 Jan 14 18:55 /dev/raw/raw14
crw-rw---- 1 oracle dba 162,  7 Jan 14 18:49 /dev/raw/raw7
crw-rw---- 1 oracle dba 162, 36 Jan 14 18:39 /dev/raw/raw36
crw-rw---- 1 oracle dba 162, 37 Jan 14 18:39 /dev/raw/raw37
crw-rw---- 1 oracle dba 162, 30 Jan 14 18:39 /dev/raw/raw30
crw-rw---- 1 oracle dba 162, 31 Jan 14 18:39 /dev/raw/raw31
crw-rw---- 1 oracle dba 162, 28 Jan 14 18:39 /dev/raw/raw28
crw-rw---- 1 oracle dba 162, 29 Jan 14 18:39 /dev/raw/raw29
crw-rw---- 1 oracle dba 162, 32 Jan 14 18:36 /dev/raw/raw32
crw-rw---- 1 oracle dba 162, 33 Jan 14 18:36 /dev/raw/raw33
crw-rw---- 1 oracle dba 162, 35 Jan 14 18:36 /dev/raw/raw35
crw-rw---- 1 oracle dba 162, 22 Jan 14 18:29 /dev/raw/raw22
crw-rw---- 1 oracle dba 162, 72 Jan 14 14:20 /dev/raw/raw72
crw-rw---- 1 oracle dba 162, 43 Jan 14 11:30 /dev/raw/raw43
crw-rw---- 1 oracle dba 162, 42 Jan 14 11:30 /dev/raw/raw42
crw-rw---- 1 oracle dba 162, 24 Jan 14 11:21 /dev/raw/raw24
crw-rw---- 1 oracle dba 162, 25 Jan 14 11:21 /dev/raw/raw25
crw-rw---- 1 oracle dba 162, 38 Jan 14 11:21 /dev/raw/raw38
crw-rw---- 1 oracle dba 162,  6 Jan 14 11:21 /dev/raw/raw6
crw-rw---- 1 oracle dba 162, 81 Jan 13 23:33 /dev/raw/raw81
crw-rw---- 1 oracle dba 162, 80 Jan 13 23:33 /dev/raw/raw80
crw-rw---- 1 oracle dba 162, 79 Jan 13 23:33 /dev/raw/raw79
crw-rw---- 1 oracle dba 162, 77 Jan 13 23:33 /dev/raw/raw77
crw-rw---- 1 oracle dba 162, 78 Jan 13 23:33 /dev/raw/raw78
crw-rw---- 1 oracle dba 162, 74 Jan 13 23:33 /dev/raw/raw74
crw-rw---- 1 oracle dba 162, 75 Jan 13 23:33 /dev/raw/raw75
crw-rw---- 1 oracle dba 162, 76 Jan 13 23:33 /dev/raw/raw76
crw-rw---- 1 oracle dba 162, 73 Jan 13 23:33 /dev/raw/raw73
crw-rw---- 1 oracle dba 162, 71 Jan 13 23:33 /dev/raw/raw71
crw-rw---- 1 oracle dba 162, 70 Jan 13 23:33 /dev/raw/raw70
crw-rw---- 1 oracle dba 162, 68 Jan 13 23:33 /dev/raw/raw68
crw-rw---- 1 oracle dba 162, 69 Jan 13 23:33 /dev/raw/raw69
crw-rw---- 1 oracle dba 162, 61 Jan 13 23:33 /dev/raw/raw61
crw-rw---- 1 oracle dba 162, 66 Jan 13 23:33 /dev/raw/raw66
crw-rw---- 1 oracle dba 162, 67 Jan 13 23:33 /dev/raw/raw67
crw-rw---- 1 oracle dba 162, 64 Jan 13 23:33 /dev/raw/raw64
crw-rw---- 1 oracle dba 162, 65 Jan 13 23:33 /dev/raw/raw65
crw-rw---- 1 oracle dba 162, 62 Jan 13 23:33 /dev/raw/raw62
crw-rw---- 1 oracle dba 162, 63 Jan 13 23:33 /dev/raw/raw63
crw-rw---- 1 oracle dba 162, 59 Jan 13 23:33 /dev/raw/raw59
crw-rw---- 1 oracle dba 162, 60 Jan 13 23:33 /dev/raw/raw60
crw-rw---- 1 oracle dba 162, 58 Jan 13 23:33 /dev/raw/raw58
crw-rw---- 1 oracle dba 162, 57 Jan 13 23:33 /dev/raw/raw57
crw-rw---- 1 oracle dba 162, 56 Jan 13 23:33 /dev/raw/raw56
crw-rw---- 1 oracle dba 162, 55 Jan 13 23:33 /dev/raw/raw55
crw-rw---- 1 oracle dba 162, 54 Jan 13 23:33 /dev/raw/raw54
crw-rw---- 1 oracle dba 162, 53 Jan 13 23:33 /dev/raw/raw53
crw-rw---- 1 oracle dba 162, 52 Jan 13 23:33 /dev/raw/raw52
crw-rw---- 1 oracle dba 162, 51 Jan 13 23:33 /dev/raw/raw51
crw-rw---- 1 oracle dba 162, 50 Jan 13 23:33 /dev/raw/raw50
crw-rw---- 1 oracle dba 162, 49 Jan 13 23:33 /dev/raw/raw49
crw-rw---- 1 oracle dba 162, 48 Jan 13 23:33 /dev/raw/raw48
crw-rw---- 1 oracle dba 162, 47 Jan 13 23:33 /dev/raw/raw47
crw-rw---- 1 oracle dba 162, 46 Jan 13 23:33 /dev/raw/raw46
crw-rw---- 1 oracle dba 162, 45 Jan 13 23:33 /dev/raw/raw45
crw-rw---- 1 oracle dba 162, 44 Jan 13 23:33 /dev/raw/raw44
crw-rw---- 1 oracle dba 162, 41 Jan 13 23:33 /dev/raw/raw41
crw-rw---- 1 oracle dba 162, 40 Jan 13 23:33 /dev/raw/raw40
crw-rw---- 1 oracle dba 162, 21 Jan 13 23:33 /dev/raw/raw21
crw-rw---- 1 oracle dba 162, 19 Jan 13 23:33 /dev/raw/raw19
crw-rw---- 1 oracle dba 162, 20 Jan 13 23:33 /dev/raw/raw20
crw-rw---- 1 oracle dba 162, 18 Jan 13 23:33 /dev/raw/raw18
crw-rw---- 1 oracle dba 162, 17 Jan 13 23:33 /dev/raw/raw17
crw-rw---- 1 oracle dba 162, 16 Jan 13 23:33 /dev/raw/raw16
crw-rw---- 1 oracle dba 162,  9 Jan 13 23:33 /dev/raw/raw9
crw-rw---- 1 oracle dba 162,  8 Jan 13 23:33 /dev/raw/raw8
crw-rw---- 1 oracle dba 162,  1 Jan 13 23:33 /dev/raw/raw1

修改 /etc/rc.local

chown oracle:oinstall /dev/raw/raw1

chmod 640 /dev/raw/raw1

chown oracle:dba /dev/raw/raw*

chmod 660 /dev/raw/raw*

3.13  使SSH等效

要建立用户等效性,请在两个节点上以 oracle 用户身份生成用户的公钥和私钥,在这两个节点上执行以下任务;

在ORADB1上执行

[oracle@oradb1 ~]$ mkdir ~/.ssh

[oracle@oradb1 ~]$ chmod 700 ~/.ssh

[oracle@oradb1 ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /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@oradb1

在ORADB2上执行

[oracle@oradb2 ~]$ mkdir ~/.ssh

[oracle@oradb2 ~]$ chmod 700 ~/.ssh

[oracle@oradb2 ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /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@oradb2

在ORADB1上执行

[oracle@oradb1 ~]$ touch ~/.ssh/authorized_keys
[oracle@oradb1 ~]$ ssh oradb1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 
[oracle@oradb1 ~]$ ssh oradb2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[oracle@oradb1 ~]$ scp ~/.ssh/authorized_keys oradb2:.ssh/authorized_keys
The authenticity of host 'oradb2 (10.1.3.10)' 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 'oradb2, 10.1.3.10' (RSA) to the list of known hosts.
oracle@oradb2's password:

authorized_keys                           100% 1716     1.7KB/s   00:00

在每个节点上测试连接。验证当您再次运行以下命令时,系统是否不提示您输入口令。

ssh oradb1 date

ssh oradb2 date

ssh oradb1-priv date

ssh oradb2-priv date

ssh oradb1 date

ssh oradb2 date

ssh oradb1-priv date

ssh oradb2-priv date

3.14  配置Oracle ASM

以Root身份在两个节点上配置ASMLib;

# /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  ]

3.15  创建Oracle集群目录

在 oradb1 上以root身份执行

# mkdir /oracle/oracrs
# chown -R oracle:dba /oracle/oracrs
# ln -s /oracle/oracrs/ocr.crs /dev/raw/raw1
# ln -s /oracle/oracrs/vote.crs /dev/raw/raw2

4  高可用数据库安装

4.1 安装Oracle集群件

解压clusterware组件到/code文件夹

【解压命令为zcat 10201_clusterware_linux_x86_64.cpio.gz | cpio -idmv】,在oradb1上以oracle用户身份执行:

[oracle@oradb1 ~]$ /code/clusterware/runInstaller

  1. 欢迎页面:单击 Next。

 

  1. 指定 Inventory 目录和证书:
  • 输入 inventory 目录的完整路径: /oracle/oraInventory。
  • 指定操作系统组名:oinstall。

 

  1. 指定 Home 详细内容:
    • 名称:OraCrs10g_home
    • /oracle/product/10.2.0/crs_1

 

 

 

  1. 特定于产品的必要条件检查:
    • 忽略有关物理内存要求的警告。

 

  1. 指定集群配置:单击 Add
    • 公共节点名称:oradb2
    • 专用节点名称:oradb2-priv
    • 虚拟主机名称:oradb2-vip

 

  1. 指定网络接口用法:
    • 接口名称:eth1
    • 子网: 10.1.3.0
    • 接口类型:Public
    • 接口名称:eth0
    • 子网: 192.168.1.0
    • 接口类型:Private

 

  1. 指定 Oracle 集群注册表 (OCR) 位置:选择 External Redundancy
    为了简单起见,这里将不镜像 OCR。在生产环境中,您可能会考虑复用 OCR 以实现更高的冗余。
    • 指定 OCR 位置:/oracle/oracrs/ocr.crs

 

  1. 指定表决磁盘位置:选择 External Redundancy
    同样,为了简单起见,我们选择不镜像表决磁盘。
    • 表决磁盘位置:/oracle/oracrs/vote.crs

 

  1. 摘要:单击 Install

 

 

  1. 当弹出Execute Configuration scripts界面时,先将p4679769_10201_LINUX补丁进行安装,方法为将p4679769_10201_LINUX.zip中的clsfmt.bin文件以oracle身份上传至/oracle/product/10.2.0/crs_1/bin文件夹下【oradb1、oradb2都要做】,覆盖原有的clsfmt.bin;
  2. 修改/oracle/product/10.2.0/crs_1/bin/vipca文件:

找到如下内容:

Remove this workaround when the bug 3937317 is fixed

arch=`uname -m`

if [ "$arch" = "i686" -o "$arch" = "ia64" ]

then

LD_ASSUME_KERNEL=2.4.19

export LD_ASSUME_KERNEL

fi

#End workaround

在fi后新添加一行:

unset LD_ASSUME_KERNEL

  1. 修改/oracle/product/10.2.0/crs_1/bin/srvctl文件:

找到如下内容:

LD_ASSUME_KERNEL=2.4.19

export LD_ASSUME_KERNEL

同样在其后新增加一行:

unset LD_ASSUME_KERNEL

  1. 执行配置脚本:以 root 用户身份按顺序执行以下脚本(一次执行一个)。在当前脚本完成后,再继续执行下一个脚本。

 

a)   在 oradb1 上执行 /oracle/oraInventory/orainstRoot.sh

b)   在 oradb2 上执行 /oracle/oraInventory/orainstRoot.sh

c)   在 oradb1 上执行 /oracle/product/10.2.0/crs_1/root.sh

d)   在 oradb2 上执行 /oracle/product/10.2.0/crs_1/root.sh

oradb2 上的 root.sh 脚本会自动调用 VIPCA,但会因为“The given interface(s), "eth0" is not public.Public interfaces should be used to configure virtual IPs.”错误而失败。如果您的公共接口使用不可路由的 IP 地址 (10.1.3.x),则 Oracle 集群验证实用程序 (CVU) 将无法找到合适的公共接口。一种解决方法是手动运行VIPCA。

  1. 以root身份在第二个节点上执行如下命令

[root@oradb2 ~]# cd /oracle/product/10.2.0/crs_1/bin

[root@oradb2 bin]# ./oifcfg iflist

eth0  192.168.1.0

virbr0  192.168.122.0

eth1  10.1.3.0

[root@oradb2 bin]# ./oifcfg setif-global eth1/10.1.3.0:public

[root@oradb2 bin]# ./oifcfg setif-global eth0/192.168.1.0:cluster_interconnect

[root@oradb2 bin]# ./oifcfg getif

eth0  255.255.255.0  global  cluster_interconnect

eth0  192.168.1.0  global  cluster_interconnect

eth1  255.255.255.192  global  public

eth1  10.1.3.0  global  public

  1. 以 root 用户身份在第二个节点上手动调用 VIPCA。

#/oracle/product/10.2.0/crs_1/bin/vipca

  1. 欢迎页面:单击 Next

 

  1. 网络接口:选择 eth0

 

  1. 集群节点的虚拟 IP:
    • 节点名称:oradb1
    • IP 别名:oradb1-vip
    • IP 地址: 10.1.3.9
    • 子网掩码: 255.255.255.0
    • 节点名称:oradb2
    • IP 别名:oradb2-vip
    • IP 地址: 10.1.3.11
    • 子网掩码: 255.255.255.0

 

    • 摘要:单击 Finish

 

  1. 配置助手进度对话框:配置完成后,单击 OK。

 

  1. 配置结果:单击 Exit。

 

  1. 返回到 oradb1 的执行配置脚本屏幕,然后单击 OK。

 

配置助手:验证所有检查均成功。OUI 在最后会执行集群件安装后检查。

 

安装结束:单击 Exit。

 

 

4.2 安装Oracle数据库10g

下载Oracle 10g database for linux版本后,以Oracle用户身份执行:

[oracle@oradb1 ~]$ /u01/staging/database/runInstaller

  1. 欢迎页面:单击 Next

 

  1. 选择安装类型:
    • 选择 Enterprise Edition

 

 

  1. 指定 Home 详细内容:
    • 名称:OraDb10g_home1
    • 路径:/u01/app/oracle/product/10.2.0/db_1

 

  1. 指定硬件集群安装模式:
    • 选择 Cluster Installation
    • 单击 Select All

 

  1. 特定于产品的必要条件检查:
    • 忽略有关物理内存要求的警告。

 

  1. 选择配置选项:
    • 仅安装数据库软件。

 

  1. 摘要:单击 Install

 

  1. 安装执行过程

 

  1. 以root用户身份在oradb1、oradb2上顺序执行脚本,完毕后点击OK

 

  1. 点击Exit退出安装

 

  1. 确认退出

 

4.3 安装10.2.0.5集群件补丁

  1. 以oracle身份登陆节点oradb1,在节点oradb1上用oracle用户停止集群进程。可以用crs_stop -all 停止所有服务。如下

[oracle@oradb1 ~]$ crs_stop -all

或者逐个停止也可以。

[oracle@oradb1 ~]$ /oracle/crs/10.2.0/bin/crs_stop -all

一定要确认服务已经停止,查看crs运行状态。

[oracle@oradb1 ~]#crs_stat -t

查看两个节点的所有服务stat都是offline

  1. 解压升级包

打开终端,切换到oracle用户下,切换目录到升级包目录,如下

[oracle@oradb1 ~]$ su – oracle

[oracle@oradb1 ~]$ cd /code/10205_patch

[oracle@oradb1 ~]$ unzip p6810189_10204_Linux-x86-64.zip    #解压操作

  1. 在oradb1上切换到升级包目录下,执行升级操作:

[oracle@oradb1 ~]$ cd /code/10205_patch

[oracle@oradb1 ~]$ ./runInstaller

注意:如果不能打开图形界面,确认已经用root用户执行过xhost +

 

  1. 系统弹出如下界面在界面选择:OraCrs10g_home,并确认CRS安装路径。

 

 

注意:在这里选择名称的下拉箭头,选择crs的安装名称。

  1. 单击下一步按钮。

 

  1. 默认继续下一步操作,系统进行升级前检查,检查结果必须都通过,否则不能进行下一步升级。

 

  1. 验证通过后继续下一步操作。

 

  1. 单击“安装”按钮,执行安装操作,系统开始正式安装补丁

 

  1. 补丁安装结束。

 

  1. 根据安装结束提示,使用root用户分别在两个节点上执行如下命令操作。
  2. 在节点1(oradb1)上执行操作:

[root@oradb1 ~]#/oracle/crs/10.2.0/bin/crsctl stop crs

[root@oradb1 ~]#/oracle/crs/10.2.0/install/root102.sh

 

  1. 节点1运行完成后上述操作后,在节点2(oradb2)上执行操作:

[root@oradb2 ~]#/oracle/crs/10.2.0/bin/crsctl stop crs

[root@oradb2 ~]#/oracle/crs/10.2.0/install/root102.sh

执行完成后,返回安装界面点击Exit,Yes确认退出安装

 

  1. 升级CRS完成!

4.4 安装10.2.0.5数据库软件补丁

  1. 登陆节点1,在节点1上(oradb1)用oracle用户停止进程。

执行[oracle@oradb1 ~]$ crs_stop –all

确认服务已经停止

[oracle@oradb1 ~]$ crs_stat -t

查看两个节点的所有服务stat都是offline

  1. 在oradb1的升级包目录下:

[oracle@oradb1 ~]$ cd /code/10205_patch

[oracle@oradb1 ~]$ ./runInstaller

 

  1. 系统弹出如下界面在界面选择:OraDb10g_home1,并确认Oracle安装路径。如图所示。在此选择默认即可。

 

  1. 取消选中“I wish to receive security updates via My Oracle Support”选项。点击Next

 

  1. 点击Yes,确认不需要Email地址

 

  1. 单击下一步按钮。

 

  1. 默认继续下一步操作,系统进行升级前检查,检查结果必须都通过,否则不能进行下一步升级。

 

  1. 验证通过后继续Install操作。

 

  1. 单击“安装”按钮,执行安装操作后,补丁开始正式安装

 

 

  1. 安装过程中会提示在两个节点上使用Root用户执行如下root.sh文件

 

注意:在两个节点上执行覆盖文件之前,建议把/usr/local/bin做一下备份,命令如下:

[root@oradb1 ~]# cd /usr/local/

[root@oradb1 ~]# cp –rf bin bin.old

[root@oradb2 ~]# cd /usr/local/

[root@oradb2 ~]# cp –rf bin bin.old

  1. 分别在两个节点上执行如下命令。提示如图所示。

在节点1上执行如下命令:

[root@oradb1 ~]#/oracle/product/10.2.0/db_1/root.sh

执行完成后在节点2上执行如下命令:

[root@oradb2 ~]#/oracle/product/10.2.0/db_1/root.sh

在执行过程需要输入必要信息:

1)     输入本地bin目录,选择默认,直接回车即可。

2)     提示要覆盖三个文件:先将两个节点上的三个文件都进行备份,然后输入Y直接覆盖。

     两个节点都执行完毕后,点击第十步里的“确定OK”。

  1. 安装完成,点击Exit并确认(Yes)退出。

 

 

4.5 创建数据库监听Listener

  1. 以oracle用户身份在oradb1节点执行netca命令,打开网络配置向导,选择Next:

 

  1. 点击“Select all nodes”:

 

  1. 选择Listener configuration

 

  1. 点击Add

 

  1. 保留默认名称Listener点击Next

 

  1. 保留默认值,点击Next

 

  1. 保留默认端口1521,点击Next

 

  1. 选择No,点击Next

 

  1. 点击Next

 

  1. 点击Finish

 

监听创建完成。

4.6 创建数据库oradb

由于本文是以裸设备安装数据库,则先创建裸设备与表空间的映射关系文件,步骤如下:

以oracle身份执行命令

touch ~/raw_map.txt

vi ~/raw_map.txt

输入内容:

###########################

system=/dev/raw/raw3

sysaux=/dev/raw/raw4

undotbs1=/dev/raw/raw5

undotbs2=/dev/raw/raw6

users=/dev/raw/raw7

temp=/dev/raw/raw8

control1=/dev/raw/raw10

control2=/dev/raw/raw11

control3=/dev/raw/raw12

spfile =/dev/raw/raw13

redo1_1=/dev/raw/raw14

redo1_2=/dev/raw/raw15

redo1_3=/dev/raw/raw16

redo1_4=/dev/raw/raw17

redo2_1=/dev/raw/raw18

redo2_2=/dev/raw/raw19

redo2_3=/dev/raw/raw20

redo2_4=/dev/raw/raw21

############################

输入:wq保存并退出

  1. 以oracle用户身份在oradb1节点执行dbca命令,打开数据库配置向导,选择默认的“Oracle Real Application Cluster database”选择Next:

 

  1. 选择创建数据库(create a database),点击Next

 

  1. 选择select all,点击Next

 

  1. 数据库模板:
    • 选择 General Purpose

 

 

  1. 数据库标识:
    • 全局数据库名称:oradb
    • SID 前缀:oradb

 

  1. 管理选项:
    • 选择 Configure the Database with Enterprise Manager

 

  1. 数据库证书:
    • 针对所有帐户使用相同的口令。

 

  1. 存储选项:
    • 选择 Raw Devices

 

  1. 选择Specify Raw Devices映射文件:
    • 选择 /home/oracle/raw_map.txt

 

  1. 去掉数据库闪回选项:
    • 去掉勾选Specify flash Recovery Area。

 

  1. 默认选项,下一步:

 

  1. 添加oradbsrv数据库服务名

 

  1. 对oradb1和oradb2选择Preferred,TAF Policy选择Basic,点击Next

 

  1. 修改内存占用比率为50%,切换到Sizing标签页:

 

  1. 修改Process值从150到800,点击Character Sets标签页:

 

  1. 选择字符集为ZHS16GBK-GBK 16-bit Simplified Chinese,点击Connection Mode标签页:

 

  1. 按默认选择的Dedicated Mode,点击Parameter File标签页:

 

  1. 选择Create Server parameter file (SPFILE),点击Next

 

  1. 确认数据库初始化参数(Controlfile、Datafiles、Redo Log Groups)

 

  1. 按默认选项,点击Finish

 

  1. 确认概要,点击OK

 

  1. 开始创建数据库

 

  1. 创建数据库完成

 

如不需修改password,点击Exit

 

等待在oradb1、oradb2启动instances后,则数据库创建完成

 

恭喜,您已经在 Enterprise Linux 上成功安装了 Oracle RAC 数据库 10g!

5  了解Oracle RAC数据库

5.1 检查数据库集群运行状况

在任意节点上运行crs_stat –t命令:

[oracle@oradb1 ~]$ crs_stat -t

Name           Type           Target    State     Host       

------------------------------------------------------------

ora.oradb.db  application    ONLINE    ONLINE    oradb2    

ora....b1.inst application    ONLINE    ONLINE    oradb1    

ora....b2.inst application    ONLINE    ONLINE    oradb2    

ora....bsrv.cs application    ONLINE    ONLINE    oradb2    

ora....db1.srv application    ONLINE    ONLINE    oradb1    

ora....db2.srv application    ONLINE    ONLINE    oradb2    

ora....B1.lsnr application    ONLINE    ONLINE    oradb1    

ora....db1.gsd application    ONLINE    ONLINE    oradb1    

ora....db1.ons application    ONLINE    ONLINE    oradb1    

ora....db1.vip application    ONLINE    ONLINE    oradb1    

ora....B2.lsnr application    ONLINE    ONLINE    oradb2    

ora....db2.gsd application    ONLINE    ONLINE    oradb2    

ora....db2.ons application    ONLINE    ONLINE    oradb2    

ora....db2.vip application    ONLINE    ONLINE    oradb2  

检查Target和State状态,如果全部为“ONLINE”说明正常,否则状态为“OFFLINE”。

5.2 数据库TNS

通过TNS连接数据库时,双机方式与单机方式TNS连接串有所不通,普通单机TNS如下,例如:

ORADB2 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2-vip)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = oradb)

      (INSTANCE_NAME = oradb2)

    )

  )

 

ORADB1 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = oradb1-vip)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = oradb)

      (INSTANCE_NAME = oradb1)

    )

  )

 

而双机方式连接串应为:

ORADBSRV =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = oradb1-vip)(PORT = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2-vip)(PORT = 1521))

    (LOAD_BALANCE = yes)

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = oradbsrv)

      (FAILOVER_MODE =

        (TYPE = SELECT)

        (METHOD = BASIC)

        (RETRIES = 180)

        (DELAY = 5)

      )

    )

  )

 

用户将以上连接串复制到$ORACLE_HOME/network/admin/tnsnames.ora文件中,即可通过TNS连接Oracle RAC。

5.3 检查Oracle集群件的状态

在节点1和节点2运行crsctl check crs命令:

[oracle@oradb1 ~]$ crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

 

[oracle@oradb2 ~]$ crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

5.4 列出Oracle 实例

使用sqlplus客户端连接Oracle RAC,执行以下SQL:

SQL> select instance_name,host_name,archiver,thread#,status from gv$instance;

 

INSTANCE_NAME    HOST_NAME      ARCHIVER    THREAD# STATUS

---------------- -------------- -------- ---------- -------

oradb2        oradb2           STOPPED           2 OPEN

oradb1        oradb1           STOPPED           1 OPEN

 

5.5 检查连接

验证能够连接到每个节点上的实例和服务

 

sqlplus system@oradb1

sqlplus system@oradb2

sqlplus system@oradb

 

5.6 检查数据库配置

SQL> show sga

 

Total System Global Area 1610612736 bytes

Fixed Size                  2096632 bytes

Variable Size             520094216 bytes

Database Buffers         1073741824 bytes

Redo Buffers               14680064 bytes

 

SQL> select file_name,round(bytes/1024/1024,0)||'MB' size_N from dba_data_files;                                                                  

FILE_NAME                 SIZE_N

------------------------- -----------

/dev/raw/raw7             656MB

/dev/raw/raw4             300MB

/dev/raw/raw5             150MB

/dev/raw/raw3             460MB

/dev/raw/raw6             66MB

/dev/raw/raw25            2048MB

/dev/raw/raw22            8192MB

/dev/raw/raw23            2048MB

/dev/raw/raw24            4096MB

/dev/raw/raw26            4096MB

/dev/raw/raw27            2048MB

/dev/raw/raw28            4096MB

/dev/raw/raw29            2048MB

/dev/raw/raw30            8129MB

/dev/raw/raw31            4096MB

/dev/raw/raw32            8192MB

/dev/raw/raw33            4096MB

/dev/raw/raw34            4096MB

/dev/raw/raw35            2048MB

/dev/raw/raw36            4096MB

/dev/raw/raw37            2048MB

/dev/raw/raw38            1024MB

/dev/raw/raw39            1024MB

/dev/raw/raw42            5000MB

/dev/raw/raw40            1024MB

 

SQL>select group#,type,member,is_recovery_dest_file from v$logfile order by group#;

 

    GROUP# TYPE    MEMBER                            IS_RECOVERY_DEST_FILE

---------- ------- --------------------------------- ---------------------

         1 ONLINE  /dev/raw/raw14                    NO

         2 ONLINE  /dev/raw/raw15                    NO

         3 ONLINE  /dev/raw/raw18                    NO

         4 ONLINE  /dev/raw/raw19                    NO

5.7 启动和停止应用程序资源

遵循以下步骤启动和停止单独的应用程序资源。

 

启动数据库实例

srvctl start nodeapps -n <node1 hostname>

srvctl start nodeapps -n <node2 hostname>

srvctl start asm -n <node1 hostname>

srvctl start asm -n <node2 hostname>

srvctl start database -d <database name>

srvctl start service -d <database name> -s <service name>

crs_stat -t

 

停止Oracle实例

srvctl stop service -d <database name> -s <service name>

srvctl stop database -d <database name>

srvctl stop asm -n <node1 hostname>

srvctl stop asm -n <node2 hostname>

srvctl stop nodeapps -n <node1 hostname>

srvctl stop nodeapps -n <node2 hostname>

crs_stat -t

 

用户也可通过crs_start –all或crs_stop –all启动和停止数据库。

[oracle@oradb1 ~]$crs_start –all

[oracle@oradb1 ~]$crs_stop –all

 

5.8 启动和停止数据库控制台

Oracle 企业管理器数据库控制台提供了一个非常好的集成式综合 GUI 界面,用于管理集群数据库环境。您可以在控制台内执行几乎所有的任务。

要访问数据库控制台,请打开 Web 浏览器并输入下面的 URL。

https://10.1.3.8:1158/em

以 system 用户身份登录,并输入您先前在数据库安装期间选择的口令。

 

 

 

 

²  停止控制台

[oracle@oradb1 ~]$ emctl stop dbconsole

TZ set to US/Eastern

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://oradb1:1158/em/console/aboutApplication

Stopping Oracle Enterprise Manager 10g Database Control ...

 ...  Stopped.

        

²  启动控制台

[oracle@oradb1 ~]$ emctl start dbconsole

TZ set to US/Eastern

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://oradb1:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 10g Database Control

................... started.

------------------------------------------------------------------

Logs are generated in directory

/oracle/product/10.2.0/db_1/oradb1_oradb1/sysman/log

 

²  验证控制台状态

[oracle@oradb1 ~]$ emctl status dbconsole

TZ set to PRC

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://oradb1:1158/em/console/aboutApplication

Oracle Enterprise Manager 10g is running.

------------------------------------------------------------------

Logs are generated in directory/oracle/product/10.2.0/db_1/oradb1_oradb1/sysman/log

 

[oracle@oradb1 ~]$ emctl status agent

TZ set to PRC

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

---------------------------------------------------------------

Agent Version     : 10.1.0.4.1

OMS Version       : 10.1.0.4.0

Protocol Version  : 10.1.0.2.0

Agent Home        :/oracle/product/10.2.0/db_1/oradb1_oradb1

Agent binaries    :/oracle/product/10.2.0/db_1

Agent Process ID  : 15597

Parent Process ID : 11690

Agent URL         : http://oradb1:3938/emd/main

Started at        : 2013-01-14 09:18:02

Started by user   : oracle

Last Reload       : 2013-01-14 09:18:02

Last successful upload                       : 2009-01-18 11:07:13

Total Megabytes of XML files uploaded so far :    38.15

Number of XML files pending upload           :        2

Size of XML files pending upload(MB)         :     0.01

Available disk space on upload filesystem    :    93.10%

---------------------------------------------------------------

Agent is Running and Ready

 

6  如何扩展表空间

1)   哪些裸设备已经被使用,可以用户sql脚本(select name from v$datafile)来查询得到;

2)   参考查看/etc/sysconfig/rawdevices文件内容,即可得到哪个lv映射到了哪个raw设备。如“/dev/raw/raw3   /dev/oravg/system”,表示oravg卷组中的system这个lv映射到了/dev/raw/raw3这个裸设备文件;分配表空间时,就参考这个文件中,哪些裸设备还未被使用,就可以将这些裸设备文件,分配给所需的表空间。

注:data开头的lv对应的裸设备可以被加入到表空间中,非data开头的lv不能使用,因为已经作为oracle安装时的默认初始文件已经使用了;lv名称中有tmp的是预留作为tmp表空间扩展使用的,其他都是作为主表空间扩展预留的;

3)   对已有的表空间,如果发现空间满时,可以通过新增数据文件方式扩展表空间,方法如下:

lvs用来查看目前系统有哪些lv逻辑卷,当lv的属性为“-wi-a-”时,则该lv所对应的裸设备未被使用,可以做为扩展表空间的数据文件使用:

 [root@oradb1 ~]# lvs

  LV          VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert

  LogVol00    VolGroup00 -wi-ao 245.41G                                     

  LogVol01    VolGroup00 -wi-ao  33.34G                                     

  control1    oravg      -wi-ao   2.00G                                     

  control2    oravg      -wi-ao   2.00G                                     

  control3    oravg      -wi-ao   2.00G                                     

  redo1_1     oravg      -wi-ao 200.00M                                      

  redo1_2     oravg      -wi-ao 200.00M                                     

  redo1_3     oravg      -wi-a- 200.00M                                     

  redo1_4     oravg      -wi-a- 200.00M                                     

  redo2_1     oravg      -wi-ao 200.00M                                     

  redo2_2     oravg      -wi-ao 200.00M                                     

  redo2_3     oravg      -wi-a- 200.00M                                     

  redo2_4     oravg      -wi-a- 200.00M                                     

  spfile      oravg      -wi-a- 100.00M                                     

  sysaux      oravg      -wi-ao   5.00G                                     

  system      oravg      -wi-ao   5.00G                                      

  temp01      oravg      -wi-ao   2.00G                                     

  temp02      oravg      -wi-a-   2.00G                                     

  undotbs1    oravg      -wi-ao   5.00G                                     

  undotbs2    oravg      -wi-ao   5.00G                                     

  users       oravg      -wi-ao   2.00G                                     

  data_10g_01 oravg      -wi-ao  10.00G                                     

  data_10g_02 oravg      -wi-ao  10.00G                                     

  data_10g_03 oravg      -wi-ao  10.00G                                     

  data_10g_04 oravg      -wi-ao  10.00G                                      

  data_10g_05 oravg      -wi-ao  10.00G                                     

  data_10g_06 oravg      -wi-ao  10.00G                                     

  data_10g_07 oravg      -wi-ao  10.00G                                      

  data_10g_08 oravg      -wi-ao  10.00G                                     

  data_10g_09 oravg      -wi-ao  10.00G                                     

  data_10g_10 oravg      -wi-ao  10.00G                                     

  data_10g_11 oravg      -wi-ao  10.00G                                     

  data_10g_12 oravg      -wi-ao  10.00G                                     

  data_10g_13 oravg      -wi-ao  10.00G                                     

  data_10g_14 oravg      -wi-ao  10.00G                                     

  data_10g_15 oravg      -wi-ao  10.00G                                     

  data_10g_16 oravg      -wi-ao  10.00G                                     

  data_10g_17 oravg      -wi-ao  10.00G                                      

  data_10g_18 oravg      -wi-ao  10.00G                                     

  data_10g_19 oravg      -wi-ao  10.00G                                     

  data_10g_20 oravg      -wi-a-  10.00G                                      

  data_20g_01 oravg      -wi-ao  20.00G                                     

  data_20g_02 oravg      -wi-a-  20.00G                                     

  data_20g_03 oravg      -wi-a-  20.00G                                     

  data_20g_04 oravg      -wi-a-  20.00G                                     

  data_20g_05 oravg      -wi-a-  20.00G                                     

  data_20g_06 oravg      -wi-a-  20.00G                                     

  data_20g_07 oravg      -wi-a-  20.00G                                      

  data_20g_08 oravg      -wi-a-  20.00G                                     

  data_20g_09 oravg      -wi-a-  20.00G                                     

  data_20g_10 oravg      -wi-a-  20.00G                                      

  data_20g_11 oravg      -wi-a-  20.00G                                     

  data_20g_12 oravg      -wi-a-  20.00G                                     

  data_20g_13 oravg      -wi-a-  20.00G                                     

  data_20g_14 oravg      -wi-a-  20.00G                                     

  data_20g_15 oravg      -wi-a-  20.00G                                     

  data_20g_16 oravg      -wi-a-  20.00G                                     

  data_20g_17 oravg      -wi-a-  20.00G                                     

  data_20g_18 oravg      -wi-a-  20.00G                                     

  data_20g_19 oravg      -wi-a-  20.00G                                     

  data_20g_20 oravg      -wi-a-  20.00G                                      

  data_20g_21 oravg      -wi-a-  20.00G                                     

  data_20g_22 oravg      -wi-a-  20.00G                                     

  data_20g_23 oravg      -wi-a-  20.00G                                      

  data_20g_24 oravg      -wi-a-  20.00G                                     

  data_20g_25 oravg      -wi-a-  20.00G                                     

  data_20g_26 oravg      -wi-a-  20.00G                                     

  data_20g_27 oravg      -wi-a-  20.00G                                     

  data_20g_28 oravg      -wi-a-  20.00G                                     

  data_20g_29 oravg      -wi-a-  20.00G                                     

  data_20g_30 oravg      -wi-a-  20.00G                                      

  data_20g_31 oravg      -wi-a-  20.00G                                     

  data_20g_32 oravg      -wi-a-  20.00G                                     

  data_20g_33 oravg      -wi-a-  20.00G                                      

  data_20g_34 oravg      -wi-a-  20.00G                                     

  data_20g_35 oravg      -wi-a-  20.00G                                     

  data_20g_36 oravg      -wi-a-  20.00G                                     

  data_tmp01  oravg      -wi-ao  10.00G                                     

  data_tmp02  oravg      -wi-a-  10.00G                                     

  data_tmp03  oravg      -wi-a-  10.00G                                     

  data_tmp04  oravg      -wi-a-  10.00G                                    

7  如何新增表空间

创建表空间示例sql:

CREATE TABLESPACE tbs_02

   DATAFILE 'diskb:tbs_f5.dat' SIZE 500K REUSE

   AUTOEXTEND ON NEXT 500K MAXSIZE 100M;

这里tbs_02是表空间名称,“diskb:tbs_f5.dat”是数据文件路径,初始大小500k,自增长500k,最大100M,按需调整即可。注意的是,这里的“diskb:tbs_f5.dat”换成第6章节中确定的不在占用的“-wi-a-”状态的裸设备文件/dev/raw/raw[x]即可。

8  如何使用扩充存储

如果因为存储空间不够,新增加了新的存储设备,则需经过如下几步,进行扩容,这里假设新增的存储路径为/dev/mapper/mpath9:

1)   为存储分配pv,标记为LVM,命令为pvcreate,格式例如:

# pvcreate /dev/mapper/mpath9

2)   将新存储增加到已有的vg中,命令为vgextend,格式如下:

# vgextend oravg /dev/mapper/mpath9

3)   在oravg中,创建新的或扩展已有的lv,命令为:

①  创建新的:

# lvcreate -L 5G -n new_lv oravg

②  扩展已有的:

# lvextend –L +20M /dev/oravg/old_lv  (扩充逻辑卷old_lv的大小)

记得在B机上,要激活刚新创建的lv,如果是扩展就不需要了。

# lvchange -a y /dev/oravg/new_lv

注:如果是新增的lv,继续新增裸设备映射

4)   修改/etc/sysconfig/rawdevices文件,增加内容:

/dev/raw/raw99  /dev/datavg/new_lv

5)   变更裸设备主属:

chown oracle:dba /dev/raw/raw99

6)   变更裸设备权限:

chmod 660 /dev/raw/raw99

7)   接下来这个裸设备就可以作为数据文件,加入到表空间中了,方法参考第6章节。

9  Oracle RAC常见问题

9.1 无法通过JDBC URL以负载均衡方式连接数据库

采用jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.9)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.11)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = oradbsrv)(FAILOVER_MODE =(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))连接串连接数据库时通常无法连接数据库。

解决方法:

以管理员账户连接数据库执行以下命令:

sql> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.9) (PORT = 1521))' sid='oradb1';

sql> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.11) (PORT = 1521))' sid=' oradb2';

posted @ 2013-01-19 09:08  田超  阅读(1240)  评论(0编辑  收藏  举报