Oracle 11gR2 rac for linux安装实施

更新时间:2023-03-08 06:24:26 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Oracle 11gR2 rac for linux安装实施

环境:

系统:redhat linux 5.8

内核:Linux RAC1 2.6.32-300.3.1.el6uek.x86_64

(命令:[root@RAC1 oracle11R201]# uname -a) 软件:oracle database 软件 和 oracle grid 软件 软件编号如下:

linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip linux.x64_11gR2_grid.zip 网络配置 节点名称 RAC1 RAC2 公共ip 虚拟ip 专用ip Scan ip 10.163.145.170 Scan名称 scan-cluster 10.163.145.173 10.163.145.171 192.168.123.1 10.163.145.174 10.163.145.172 192.168.123.2 存储组件划分:

Block Device ASMlib Name ASM磁盘名称 Size(GB) Comments /dev/sdb5 OCR_VOTE01 3 ASM Diskgroup for OCR and Voting Disks /dev/sdb6 OCR_VOTE02 3 ASM Diskgroup for OCR and Voting Disks +OCR /dev/sdb7 OCR_VOTE03 3 ASM Diskgroup for OCR and Voting Disks /dev/sdb8 ASM_DATA01 80 ASM Data Diskgroup /dev/sdb9 ASM_DATA02 80 ASM Data Diskgroup +DATA /dev/sdb10 ASM_DATA03 80 ASM Data Diskgroup /dev/sdb11 ASM_DATA04 80 ASM Data Diskgroup /dev/sdb12 ASM_FRA01 60 ASM Flash Recovery Area Diskgroup /dev/sdb13 ASM_FRA02 60 ASM Flash Recovery Area Diskgroup +FRA /dev/sdb14 ASM_FRA03 51 ASM Flash Recovery Area Diskgroup

磁盘管理 删除磁盘分区: [root@RAC1 oracle11R201]# fdisk /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').

Command (m for help): d Partition number (1-11): 11

Command (m for help): d Partition number (1-10): 10

Command (m for help): d Partition number (1-9): 9

Command (m for help): d Partition number (1-8): 8

Command (m for help): d Partition number (1-7): 7

Command (m for help): d Partition number (1-6): 6

Command (m for help): d Partition number (1-5): 5

Command (m for help): d Selected partition 1

Command (m for help): 1 1: unknown command Command action

a toggle a bootable flag b edit bsd disklabel

c toggle the dos compatibility flag d delete a partition

l list known partition types m print this menu n add a new partition

o create a new empty DOS partition table p print the partition table q quit without saving changes

s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit

x extra functionality (experts only)

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table. Syncing disks.

[root@RAC1 oracle11R201]#

重新划分磁盘:(主分区) [root@RAC1 /]# fdisk /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').

Command (m for help): d No partition is defined yet!

Command (m for help): m Command action

a toggle a bootable flag b edit bsd disklabel

c toggle the dos compatibility flag d delete a partition

l list known partition types m print this menu n add a new partition

o create a new empty DOS partition table p print the partition table q quit without saving changes

s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit

x extra functionality (experts only)

Command (m for help): n Command action e extended

p primary partition (1-4) e

Partition number (1-4): 1

First cylinder (1-65270, default 1): Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270):

Command (m for help): n Command action l extended

p primary partition (1-4) l

Partition number (1-4): 2

First cylinder (1307-65270, default 1307): Using default value 1307

Last cylinder, +cylinders or +size{K,M,G} (1307-65270, default 65270): +3G

Command (m for help): n Command action l extended

p primary partition (1-4) l

Partition number (1-4): 3

First cylinder (20889-65270, default 20889): Using default value 20889

Last cylinder, +cylinders or +size{K,M,G} (20889-65270, default 65270): +3G

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +3G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +80G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +80G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +80G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +80G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +60G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): +60G Using default value 65270

Command (m for help): n Command action l extended

p primary partition (1-4) l

Selected partition 4

First cylinder (40471-65270, default 40471): Using default value 40471

Last cylinder, +cylinders or +size{K,M,G} (40471-65270, default 65270): Using default value 65270

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table. Syncing disks.

[root@RAC2 ~]# fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sda1 * 1 25 200781 83 Linux

/dev/sda2 26 2065 16386300 82 Linux swap / Solaris /dev/sda3 2066 7832 46323427+ 83 Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 536.8 GB, 536870912000 bytes 255 heads, 63 sectors/track, 65270 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 65270 524281243+ 5 Extended /dev/sdb5 1 487 3911764+ 83 Linux /dev/sdb6 488 974 3911796 83 Linux /dev/sdb7 975 1461 3911796 83 Linux /dev/sdb8 1462 11188 78132096 83 Linux /dev/sdb9 11189 20915 78132096 83 Linux /dev/sdb10 20916 30642 78132096 83 Linux /dev/sdb11 30643 40369 78132096 83 Linux /dev/sdb12 40370 47665 58605088+ 83 Linux /dev/sdb13 47666 54961 58605088+ 83 Linux /dev/sdb14 54962 65270 82807011 83 Linux

1. 安装必需包:

a) 安装软件包:# rpm -ivh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm

# rpm -ivh libaio-devel-0.3.105-10.el6.x86_64.rpm

binutils-2.15.92.0.2

compat-libstdc++-33-3.2.3

compat-libstdc++-33-3.2.3 (32 bit) elfutils-libelf-0.97

elfutils-libelf-devel-0.97 expat-1.95.7 gcc-3.4.6 gcc-c++-3.4.6 glibc-2.3.4-2.41

glibc-2.3.4-2.41 (32 bit) glibc-common-2.3.4 glibc-devel-2.3.4 glibc-headers-2.3.4 libaio-0.3.105

libaio-0.3.105 (32 bit) libaio-devel-0.3.105

libaio-devel-0.3.105 (32 bit) libgcc-3.4.6

libgcc-3.4.6 (32-bit) libstdc++-3.4.6

libstdc++-3.4.6 (32 bit) libstdc++-devel 3.4.6 make-3.80 pdksh-5.2.14 sysstat-5.0.5 unixODBC-2.2.11

unixODBC-2.2.11 (32 bit) unixODBC-devel-2.2.11

unixODBC-devel-2.2.11 (32 bit)

修改配置文件:

2. 配置hosts 文件 (两台主机都需要修改)

修改主机的hosts 文件 vi /etc/hosts 在最后添加如下内容 #公共pub

10.163.145.173 RAC1 10.163.145.174 RAC2 #虚拟vip

10.163.145.171 RAC1-vip 10.163.145.172 RAC2-vip #私有pri

192.168.123.1 RAC1-pri 192.168.123.2 RAC2-pri #scan

10.163.145.170 scan-cluster

3. 修改 /etc/security/limits.conf 文件,加入如下内容:(两台主机都需要修改)

#for oracle

grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 4. 修改 /etc/pam.d/login 文件,添加如下内容:(两台主机都需要修改)

# for oracle

session required pam_limits.so 5. 修改 /etc/sysctl.conf 文件,添加如下内容:(两台主机都需要修改)

# for oracle

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 fs.file-max = 6815744

添加完成后输入如下命令使内核文件生效: [root@RAC1 /]# /sbin/sysctl -p

6. 修改 /etc/profile 文件,添加如下内容:(两台主机都需要修改)

# for oracle

if [ $USER = \if [ $SHELL = %ulimit -p 16384 ulimit -n 65536 else

ulimit -u 16384 -n 65536 fi

umask 022 fi

7. 修改 /etc/csh.login 文件,添加如下内容:(两台主机都需要修改)

# for oracle

if ( $USER = \limit maxproc 16384 limit descriptors 65536 endif

8. 添加用户组和用户:(两台主机都需要修改)

/usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 503 oper

/usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 506 asmdba /usr/sbin/groupadd -g 507 asmoper

/usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba,oper oracle

9. 添加用户密码:(manager)(两台主机都需要修改)

[root@RAC1 /]# passwd grid 更改用户 grid 的密码 。 新的 密码:

无效的密码: 它基于字典单词 无效的密码: 过于简单

重新输入新的 密码:

passwd: 所有的身份验证令牌已经成功更新。 [root@RAC1 /]#

[root@RAC1 /]# passwd oracle

更改用户 oracle 的密码 。 新的 密码:

无效的密码: 它基于字典单词 无效的密码: 过于简单 重新输入新的 密码:

passwd: 所有的身份验证令牌已经成功更新。

10. 配置环境变量:

在 grid 用户中配置如下: su – grid

vi .bash_profile

在 grid 用户下 修改 .bash_profile 文件,在最后添加如下内容:

export ORACLE_SID=+ASM1

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid export PATH=$ORACLE_HOME/bin:.:$PATH

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK export ORACLE_UNQNAME=orcl export ORACLE_HOSTNAME=rac1

在 oracle 用户中配置如下: su – oracle vi .bash_profile

在 oracle 用户下 修改 .bash_profile 文件,在最后添加如下内容:

export ORACLE_SID=orcl1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 export PATH=$ORACLE_HOME/bin:.:$PATH

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK export ORACLE_UNQNAME=orcl export ORACLE_HOSTNAME=rac1

11. 创建 oracle 安装目录: (两台主机都需要修改) mkdir -p /u01/app chmod -R 777 /u01/app chown -R grid:oinstall /u01/app mkdir -p /u01/app/oracle chmod -R 777 /u01/app/oracle chown -R oracle:oinstall /u01/app/oracle

12. 同步时间:(两台主机都需要修改)

[root@RAC1 etc]# date -s \2012年 06月 07日 星期四 11:59:00 CST [root@rac1 ~]# service ntpd stop

关闭 ntpd:[失败]

修改时间同步配置文件

mv /etc/ntp.conf /etc/ntp.conf.bak

修改dns配置文件

mv /etc/resolv.conf /etc/resolv.conf.bak

13. 配置asm自动存储:(两台主机都需要修改)

安装包:oracleasm-support-2.1.4-1.el5.x86_64.rpm 安装asm:

[root@RAC2 sharesoft]# rpm -ivh oracleasm-support-2.1.4-1.el5.x86_64.rpm 14. 配置asm :(两台主机都需要修改)

# /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 []: grid

Default group to own the driver interface []: asmadmin Last login: Thu Jun 7 12:04:42 2012 from 192.168.1.2 [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 []: grid

Default group to own the driver interface []: asmadmin 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 ]

15. 创建asm磁盘:(单机做)

/usr/sbin/oracleasm createdisk OCR_VOTE01 /dev/sdb5 /usr/sbin/oracleasm createdisk OCR_VOTE02 /dev/sdb6 /usr/sbin/oracleasm createdisk OCR_VOTE03 /dev/sdb7 /usr/sbin/oracleasm createdisk ASM_DATA01 /dev/sdb8 /usr/sbin/oracleasm createdisk ASM_DATA02 /dev/sdb9 /usr/sbin/oracleasm createdisk ASM_DATA03 /dev/sdb10 /usr/sbin/oracleasm createdisk ASM_DATA04 /dev/sdb11 /usr/sbin/oracleasm createdisk ASM_FRA01 /dev/sdb12 /usr/sbin/oracleasm createdisk ASM_FRA02 /dev/sdb13 /usr/sbin/oracleasm createdisk ASM_FRA03 /dev/sdb14

16. 查看asm磁盘:

# /usr/sbin/oracleasm listdisks ASM_DATA01 ASM_DATA02 ASM_DATA03 ASM_DATA04 ASM_FRA01 ASM_FRA02 ASM_FRA03 OCR_VOTE01 OCR_VOTE02 OCR_VOTE03 17. 创建好asm磁盘组以后在另一台机子上执行下面命令:

# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \Instantiating disk \

# /usr/sbin/oracleasm listdisks

ASM_DATA01 ASM_DATA02 ASM_DATA03 ASM_DATA04 ASM_FRA01 ASM_FRA02 ASM_FRA03 OCR_VOTE01 OCR_VOTE02 OCR_VOTE03

可以看到创建的磁盘了,说明asm创建成功! 18. 在服务器上解压oracle软件的zip 包

# unzip p10404530_112030_Linux-x86-64_1of7.zip # unzip p10404530_112030_Linux-x86-64_2of7.zip # unzip p10404530_112030_Linux-x86-64_3of7.zip

19. 配置信任关系:

配置SSH

1).在主节点RAC1上以grid用户身份生成用户的公匙和私匙 # ping RAC2 # ping RAC2-pri # su – grid $ mkdir ~/.ssh $ ssh-keygen -t rsa $ ssh-keygen -t dsa

2).在副节点RAC2上执行相同的操作,确保通信无阻 # ping RAC1 # ping RAC1-pri # su – grid $ mkdir ~/.ssh $ ssh-keygen -t rsa $ ssh-keygen -t dsa

3).在主节点RAC1上grid用户执行以下操作 $ cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys $ cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys

$ ssh RAC2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys $ ssh RAC2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys $ scp ~/.ssh/authorized_keys RAC2:~/.ssh/authorized_keys

4).主节点RAC1上执行检验操作 $ ssh RAC1 date $ ssh RAC2 date

$ ssh RAC1-pri date $ ssh RAC2-pri date

5).在副节点RAC2上执行检验操作

$ ssh RAC1 date $ ssh RAC2 date

$ ssh RAC1-pri date $ ssh RAC2-pri date

20. 使用grid 用户检查配置

su – grid

[grid@RAC1 grid]$./runcluvfy.sh stage -pre crsinst -n RAC1,RAC2 -fixup –verbose 或者:

[grid@RAC1 grid]$ ./runcluvfy.sh stage -pre crsinst -n RAC1,RAC2

执行 集群服务设置 的预检查

正在检查节点的可访问性...

节点 \的节点可访问性检查已通过

正在检查等同用户...

用户 \的等同用户检查已通过

正在检查节点连接性...

正在检查主机配置文件...

主机配置文件的验证成功

含有节点 RAC2,RAC1 的子网 \的节点连接性检查已通过 子网 \的 TCP 连接性检查通过

含有节点 RAC2,RAC1 的子网 \的节点连接性检查已通过 子网 \的 TCP 连接性检查通过

在子网 \上找到的很可能是用于专用互连的候选接口的接口为:

使用grid用户做完以后改换使用oracle用户同样做以上操作。

RAC2 eth6:192.168.123.2 RAC1 eth1:192.168.123.1

WARNING:

找不到用于 VIP 的合适接口集

注:由于ip 没有在公共网段。

WARNING:

找不到适合于专用互连的同名接口集 正在检查子网掩码一致性...

子网 \的子网掩码一致性检查已通过。 子网 \的子网掩码一致性检查已通过。 子网掩码一致性检查已通过。

节点连接性检查已通过

正在检查多点传送通信...

正在检查子网 \是否能够与多点传送组 \进行多点传送通信...

子网 \是否能够与多点传送组 \进行多点传送通信的检查已通过。

正在检查子网 \是否能够与多点传送组 \进行多点传送通信...

子网 \是否能够与多点传送组 \进行多点传送通信的检查已通过。

多点传送通信检查已通过。

检查 ASMLib 配置。 ASMLib 配置检查通过。 内存总量 检查已通过 可用内存 检查已通过 交换空间 检查已通过

\的 空闲磁盘空间 检查已通过 \的 空闲磁盘空间 检查已通过

对 UID 值为 501 的多个用户进行的检查已通过 \的 用户存在性 检查已通过 \的 组存在性 检查已通过 \的 组存在性 检查已通过

组 \中用户 \的成员资格检查 [作为 主] 已通过 组 \中用户 \的成员资格检查已通过

本文来源:https://www.bwwdw.com/article/rx4.html

Top