Oracle+11g+RAC+PSU_EAM(1)

 概述和说明

1.1 概述

本文档用于记录在redhat 6.5 X86_64位系统上安装配置Oracle 11gR2(11.2.0.4.0) EBSRAC+PSU

的详细步骤。安装配置两台redhat6.5 X86_64Linux系统的机器,然后在这两台Linux机器

上配置Oracle 11gR2 EBSRAC系统。其中,操作系统选择Oracle公司的redhat 6.5 X86_64Linux

系统,数据库软件采用目前Oracle 11gR2最新版本的11.2.0.4.0

1.2 软件获取

操作系统:  Redhat  Enterprise Linux 6

Oracle软件:Oracle 11g Release 2 (11.2) Software (64 bit)

PSU : p22646198_112040_Linux-x86-64

其中,Oracle软件可以通过上述连接直接获取版本为11.2.0.1.0的安装介质,或者通过MetaLink官方网站获取最新版本的11.2.0.4.0安装介质,其中patch编号为13390677

2 安装前准备工作

2.1 资源规划

IP地址均选择手动配置,而不是DHCP动态分配,且要求指定的IP在网络里是唯一的。主机名也分别要求指定为唯一,避免冲突。主机名、IP地址在前期规划要慎重,一经指定,最好不要轻易改变,避免一些不必要的麻烦。这里列出两台机器前期规划的主机名、IP地址信息:

更改主机名:hostnamectl set-hostname ebsrac1

Hostname

Short Hostname

Type   

IP Address

Interface

ebsrac1

ebsrac1

Public IP

192.168.1.33

eno16777736

ebsrac1-vip

ebsrac1-vip

Virtual IP

192.168.1.133

eno16777736:1

ebsrac1-priv

ebsrac1-priv

Private IP

192.168.86.13

ens34

ebsrac2

ebsrac2

Public IP

192.168.1.44

eth0

ebsrac2-vip

ebsrac2-vip

Virtual IP

192.168.1.144

eth0:1

ebsrac2-priv

ebsrac2-priv

Private IP

192.168.86.44

eth1

scan-cluster

scan-cluster

SCAN IP

192.168.1.55

eth0

192.168.1.56

192.168.1.157  

(2.1网络配置信息表)

其中,EBSRAC每台机器至少需要配置3IP地址,在安装操作系统的过程中,我们需要配置公网IP和私有IP即可,虚拟IP在安装集群件时分配。Public IPVirtual IPSCAN IP必须配置在同一网段。SCAN IPOracle 11g新推出的,在配置11g EBSRAC时需要指定。由于现场条件的限制,我们的SCAN IP通过/etc/hosts来解析来实现。

2.2 配置 /etc/hosts文件

参照Figure 2.1网络配置信息表,修改节点1/etc/hosts配置文件。

2.4 建用户、改口令、修改用户配置文件

配置12CR1 ORCLE RAC需要安装Oracle Grid Infrastructure软件、Oracle数据库软件,其中Grid软件等同于Oracle 10gClusterware集群件。Oracle建议以不同的用户分别安装Grid Infrastructure软件、Oracle数据库软件,我们这里以grid用户安装Grid Infrastructureoracle用户安装Oracle数据库软件。并且gridoracle用户需要属于不同的用户组。在配置RAC时,还要求这两个用户在RAC的不同节点上uidgid要一致。用户、组的对应信息见下表:

Group Name

Group ID

Group Info

Oracle User(1100)

Grid User(1101)

oinstall

1000

Inventory Group

Y

Y

dba

1300

OSDBA Group

Y

oper

1301

OSOPER Group

Y

asmadmin

1200

OSASM 

Y

asmoper

1202

OSOPER for ASM

Y

asmdba

1201

OSDBA for ASM

Y

Y

(Figure 2.4用户、组配置信息表)

我们可以通过执行下述shell脚本的1_preusers.sh来完成用户、组的创建,脚本的具体内容可见本文档附录

[root@ebsrac1 scripts]# ./1_perusers.sh

Now create 4 groups named 'oinstall','dba','asmadmin','asmdba'

Plus 2 users named 'oracle','grid',Also setting the Environment

Creating mailbox file: File exists

Changing password for user grid.

passwd: all authentication tokens updated successfully.

Creating mailbox file: File exists

Changing password for user oracle.

passwd: all authentication tokens updated successfully.

The Groups and users has been created

The Environment for grid,oracle also has been set successfully

[root@ebsrac1 scripts]# su - oracle

ebsrac1-> id

uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba)

ebsrac1-> exit

logout

[root@ebsrac1 scripts]# su - grid

ebsrac1-> id

uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba)

说明:在节点ebsrac2上执行该脚本时,需要将grid用户环境变量ORACLE_SID修改为+ASM2oracle用户环境变量ORACLE_SID修改为ebsracdb2

2.5 建路径、改权限

关于gridoracle用户的环境变量配置信息,见下述表格。

Environment Variable

Grid User

Oracle User

ORACLE_BASE

/u01/app/grid

/u01/app/oracle/product

ORACLE_HOME

/u01/app/11.2.0/grid

/u01/app/oebsracl/product/11.2.0

ORACLE_SID [ebsrac1]

+ASM1

ebsracdb1

ORACLE_SID [ebsrac2]

+ASM2

ebsracdb2

(Figure 2.5环境变量配置信息表)

通过执行脚本2_predir.sh来完成相关路径、权限的配置。脚本的具体内容可见本文档附录。

[root@ebsrac1 scripts]# ./2_predir.sh

Now create the necessary directory for oracle,grid users and change the authention to oracle,grid users...

The necessary directory for oracle,grid users and change the authention to oracle,grid users has been finished

[root@ebsrac1 scripts]# cd /u01

[root@ebsrac1 u01]# ls -l

total 12

drwxrwxr-x. 4 root root 4096 Dec 29 04:30 app

drwxrwxr-x  2 root root 4096 Dec 29 04:30 scripts

drwxrwxr-x. 4 root root 4096 Dec 17 22:31 soft

[root@ebsrac1 u01]# cd app

[root@ebsrac1 app]# ls -l

total 8

drwxrwxr-x 3 grid   oinstall 4096 Dec 29 04:30 grid

drwxrwxr-x 3 oracle oinstall 4096 Dec 29 04:30 oracle

2.6 修改/etc/security/limits.conf,配置oracle、grid用户的shell限制

  通过执行脚本3_prelimits.sh完成。脚本的具体内容可见本文档附录。

[root@ebsrac1 scripts]# ./3_prelimit.sh

Now modify the /etc/security/limits.conf,but backup it named /etc/security/limits.conf.bak before

Modifing the /etc/security/limits.conf has been succeed.

[root@ebsrac1 scripts]#

2.7 修改/etc/pam.d/login配置文件

   通过执行脚本4_prelogin.sh完成。脚本的具体内容可见本文档附录。

[root@ebsrac1 scripts]# ./4_perlogin.sh

Now modify the /etc/pam.d/login,but with a backup named /etc/pam.d/login.bak

Modifing the /etc/pam.d/login has been succeed.

[root@ebsrac1 scripts]#

2.8 修改/etc/profile文件

   通过执行脚本5_preprofile.sh完成。脚本的具体内容可见本文档附录。

[root@ebsrac1 scripts]# ./5_preprofile.sh

Now modify the  /etc/profile,but with a backup named  /etc/profile.bak

Modifing the /etc/profile has been succeed.

[root@ebsrac1 scripts]#

2.9修改内核配置文件

   通过执行脚本6_presysctl.sh完成。脚本的具体内容可见本文档附录。

[root@ebsrac1 scripts]# modprobe bridge

[root@ebsrac1 scripts]# ./6_persysctl.sh

Now modify the /etc/sysctl.conf,but with a backup named /etc/sysctl.bak

Modifing the /etc/sysctl.conf has been succeed.

Now make the changes take effect.....

net.ipv4.ip_forward = 0

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

net.bridge.bridge-nf-call-ip6tables = 0

net.bridge.bridge-nf-call-iptables = 0

net.bridge.bridge-nf-call-arptables = 0

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

fs.aio-max-nr = 1048576

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65000

net.core.rmem_default = 1048576

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 2147483648

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 = 1048586

net.ipv4.tcp_wmem = 262144 262144 262144

net.ipv4.tcp_rmem = 4194304 4194304 4194304

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 2147483648

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 = 1048586

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 2147483648

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 = 1048586

net.ipv4.tcp_wmem = 262144 262144 262144

net.ipv4.tcp_rmem = 4194304 4194304 4194304

2.10 检查软件包的安装情况

[root@dns-server tmp]# ./7_precheck.sh

Now check install rpm package

libaio-devel sysstat unixODBC unixODBC-devel

[root@dns-server tmp]#

2.11 停止ntp服务,11gR2新增的检查项(如果使用NTP,请按照下面步骤配置)

[root@ebsrac1 ~]# service ntpd status

ntpd is stopped

[root@ebsrac1 ~]# chkconfig ntpd off

[root@ebsrac1 ~]# cat /etc/ntp

ntp/      ntp.conf  

[root@ebsrac1 ~]# cp /etc/ntp.conf /etc/ntp.conf.bak

[root@ebsrac1 ~]# rm -rf /etc/ntp.conf

[root@ebsrac1 ~]

2.12 节点2准备工作

    我们已经在ebsrac1完成基本准备配置工作,在ebsrac2上重复上述2.22.10节中准备工作,以完成节点2的准备工作。

    说明:2.4节中需要修改对应的环境变量。

2.13 配置oracle,grid 用户SSH对等性

   虽然在安装软件的过程中,oracle会自动配置SSH对等性,建议在安装软件之前手工配置。(这一步骤可以不操作)

配置oracle用户对等性:注意$HOME/.ssh目录 或 $HOME目录的权限 最好是700, 注意authorized_keys的权限 chmod 644 authorized_keys 这个也是要注意的 。不然配置后登录还是输入密码。

   ebsrac1:

[root@ebsrac1 ~]# su - oracle

ebsrac1-> env | grep ORA

ORACLE_UNQNAME=ebsracdb

ORACLE_SID=ebsracdb1

ORACLE_BASE=/u01/app/oracle

ORACLE_HOSTNAME=ebsrac1

ORACLE_TERM=xterm

ORACLE_HOME=/u01/app/oracle/product/11.2.0

ebsrac1-> pwd

/home/oracle

ebsrac1-> mkdir ~/.ssh

ebsrac1-> chmod 700 ~/.ssh

ebsrac1-> ls -al

total 44

drwx—— 4 oracle oinstall 4096 Apr 24 10:47 .

drwxr-xr-x 4 root   root     4096 Apr 24 09:41 ..

-rw——- 1 oracle oinstall    5 Apr 24 10:43 .bash_history

-rw-r–r– 1 oracle oinstall   33 Apr 24 09:41 .bash_logout

-rw-r–r– 1 oracle oinstall  823 Apr 24 09:41 .bash_profile

-rw-r–r– 1 oracle oinstall  124 Apr 24 09:41 .bashrc

-rw-r–r– 1 oracle oinstall  515 Apr 24 09:41 .emacs

drwxr-xr-x 4 oracle oinstall 4096 Apr 24 09:41 .mozilla

drwx—— 2 oracle oinstall 4096 Apr 24 10:47 .ssh

-rw-r–r– 1 oracle oinstall  658 Apr 24 09:41 .zshrc

ebsrac1-> 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:

4a:bd:22:4c:cc:6a:33:ae:5a:de:7d:7c:8b:77:9e:81 oracle@ebsrac1

ebsrac1-> ssh-keygen -t dsa 

Generating public/private dsa key pair.

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

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

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

Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

8b:50:73:41:03:ad:1c:59:25:aa:40:1c:c9:5e:03:99 oracle@ebsrac1

ebsrac1-> 

 

ebsrac2:

[root@ebsrac2 ~]# su - oracle

ebsrac2-> env|grep ORA

ORACLE_UNQNAME=ebsracdb

ORACLE_SID=ebsracdb2

ORACLE_BASE=/u01/app/oracle

ORACLE_HOSTNAME=ebsrac2

ORACLE_TERM=xterm

ORACLE_HOME=/u01/app/oracle/product/11.2.0

ebsrac2-> pwd

/home/oracle

ebsrac2-> ls -al

total 40

drwx—— 3 oracle oinstall 4096 Apr 24 10:45 .

drwxr-xr-x 4 root   root     4096 Apr 24 10:44 ..

-rw——- 1 oracle oinstall   10 Apr 24 10:49 .bash_history

-rw-r–r– 1 oracle oinstall   33 Apr 24 10:44 .bash_logout

-rw-r–r– 1 oracle oinstall  823 Apr 24 10:44 .bash_profile

-rw-r–r– 1 oracle oinstall  124 Apr 24 10:44 .bashrc

-rw-r–r– 1 oracle oinstall  515 Apr 24 10:44 .emacs

drwxr-xr-x 4 oracle oinstall 4096 Apr 24 10:44 .mozilla

-rw-r–r– 1 oracle oinstall  658 Apr 24 10:44 .zshrc

ebsrac2-> mkdir ~/.ssh

ebsrac2-> chmod 700 ~/.ssh/

ebsrac2-> ls -al

total 44

drwx—— 4 oracle oinstall 4096 Apr 24 10:49 .

drwxr-xr-x 4 root   root     4096 Apr 24 10:44 ..

-rw——- 1 oracle oinstall   10 Apr 24 10:49 .bash_history

-rw-r–r– 1 oracle oinstall   33 Apr 24 10:44 .bash_logout

-rw-r–r– 1 oracle oinstall  823 Apr 24 10:44 .bash_profile

-rw-r–r– 1 oracle oinstall  124 Apr 24 10:44 .bashrc

-rw-r–r– 1 oracle oinstall  515 Apr 24 10:44 .emacs

drwxr-xr-x 4 oracle oinstall 4096 Apr 24 10:44 .mozilla

drwxrwx— 2 oracle oinstall 4096 Apr 24 10:49 .ssh

-rw-r–r– 1 oracle oinstall  658 Apr 24 10:44 .zshrc

ebsrac2-> 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:

a0:64:81:a6:12:b2:18:4e:01:c3:bd:9d:f6:bb:55:b0 oracle@ebsrac2

ebsrac2-> ssh-keygen -t dsa

Generating public/private dsa key pair.

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

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

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

Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

85:56:69:73:74:a3:ef:5b:88:d7:6d:ef:90:03:b6:72 oracle@ebsrac2

ebsrac2-> 

返回节点1

ebsrac1-> id

uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)

ebsrac1-> pwd

/home/oracle

ebsrac1-> cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys

ebsrac1-> cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys 

ebsrac1-> ssh ebsrac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys 

The authenticity of host 'ebsrac2 (192.168.1.192)' can't be established.

RSA key fingerprint is a7:6b:2c:2d:fb:c3:ff:33:af:92:cd:7b:99:3b:cf:3a.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac2,192.168.1.192' (RSA) to the list of known hosts.

oracle@ebsrac2's password: 

ebsrac1-> ssh ebsrac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys 

oracle@ebsrac2's password: 

ebsrac1-> scp ~/.ssh/authorized_keys ebsrac2:~/.ssh/authorized_keys 

oracle@ebsrac2's password: 

authorized_keys       

100% 2040     2.0KB/s   00:00  

ebsrac1-> 

验证oracle SSH对等性:

ebsrac1ebsrac2两个节点上分别执行下述命令,第一次执行时需要口令验证:

ebsrac1-> id

uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)

ebsrac1-> ssh ebsrac1 date

The authenticity of host 'ebsrac1 (192.168.1.191)' can't be established.

RSA key fingerprint is 16:c2:67:cd:73:dd:b7:8b:f4:07:ef:e0:fb:36:34:3e.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac1,192.168.1.191' (RSA) to the list of known hosts.

Tue Apr 24 11:28:15 CST 2012

ebsrac1-> ssh ebsrac2 date

Tue Apr 24 11:28:18 CST 2012

ebsrac1-> ssh ebsrac1-priv date

The authenticity of host 'ebsrac1-priv (192.168.94.11)' can't be established.

RSA key fingerprint is 16:c2:67:cd:73:dd:b7:8b:f4:07:ef:e0:fb:36:34:3e.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac1-priv,192.168.94.11' (RSA) to the list of known hosts.

Tue Apr 24 11:28:25 CST 2012

ebsrac1-> ssh ebsrac2-priv date

The authenticity of host 'ebsrac2-priv (192.168.94.12)' can't be established.

RSA key fingerprint is a7:6b:2c:2d:fb:c3:ff:33:af:92:cd:7b:99:3b:cf:3a.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac2-priv,192.168.94.12' (RSA) to the list of known hosts.

Tue Apr 24 11:28:30 CST 2012

ebsrac1-> ssh ebsrac1 date

The authenticity of host 'ebsrac1 (192.168.1.191)' can't be established.

RSA key fingerprint is 16:c2:67:cd:73:dd:b7:8b:f4:07:ef:e0:fb:36:34:3e.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac1' (RSA) to the list of known hosts.

Tue Apr 24 11:28:39 CST 2012

ebsrac1-> ssh ebsrac2 date

The authenticity of host 'ebsrac2 (192.168.1.192)' can't be established.

RSA key fingerprint is a7:6b:2c:2d:fb:c3:ff:33:af:92:cd:7b:99:3b:cf:3a.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac2' (RSA) to the list of known hosts.

Tue Apr 24 11:28:46 CST 2012

ebsrac1-> ssh ebsrac2-priv date

The authenticity of host 'ebsrac2-priv (192.168.94.12)' can't be established.

RSA key fingerprint is a7:6b:2c:2d:fb:c3:ff:33:af:92:cd:7b:99:3b:cf:3a.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac2-priv' (RSA) to the list of known hosts.

Tue Apr 24 11:28:52 CST 2012

ebsrac1-> ssh ebsrac1-priv date

The authenticity of host 'ebsrac1-priv (192.168.94.11)' can't be established.

RSA key fingerprint is 16:c2:67:cd:73:dd:b7:8b:f4:07:ef:e0:fb:36:34:3e.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ebsrac1-priv' (RSA) to the list of known hosts.

Tue Apr 24 11:28:59 CST 2012

第二次执行时不再提示输入口令,并且可以成功执行命令,则表示oracle用户SSH对等性配置成功

ebsrac1

ebsrac1-> ssh ebsrac1 date

Tue Apr 24 11:29:02 CST 2012

ebsrac1-> ssh ebsrac2 date

Tue Apr 24 11:29:07 CST 2012

ebsrac1-> ssh ebsrac1-priv date

Tue Apr 24 11:29:13 CST 2012

ebsrac1-> ssh ebsrac2-priv date

Tue Apr 24 11:29:18 CST 2012

ebsrac1-> ssh ebsrac2-priv date

Tue Apr 24 11:29:27 CST 2012

ebsrac1-> ssh ebsrac1-priv date

Tue Apr 24 11:29:33 CST 2012

ebsrac1-> 

ebsrac2

ebsrac2-> id

uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)

ebsrac2-> pwd

/home/oracle

ebsrac2-> ssh ebsrac1 date

Tue Apr 24 11:32:06 CST 2012

ebsrac2-> ssh ebsrac2 date

Tue Apr 24 11:32:09 CST 2012

ebsrac2-> ssh ebsrac1-priv date

Tue Apr 24 11:32:14 CST 2012

ebsrac2-> ssh ebsrac2-priv date

Tue Apr 24 11:32:17 CST 2012

ebsrac2-> ssh ebsrac1 date

Tue Apr 24 11:32:26 CST 2012

ebsrac2-> ssh ebsrac2 date

Tue Apr 24 11:32:29 CST 2012

ebsrac2-> ssh ebsrac1-priv date

Tue Apr 24 11:32:39 CST 2012

ebsrac2-> ssh ebsrac2-priv date

Tue Apr 24 11:32:43 CST 2012

ebsrac2->

至此,Oracle用户SSH对等性配置完成!重复上述步骤,以grid用户配置其对等性。

2.14 配置ASM磁盘

我们已经对EBSRAC双节点挂载配置好了共享磁盘,接下来需要将这些共享磁盘格式化、然后用udev将其配置为ASM磁盘,用于将来存放OCRVoting Disk和数据库用。

注意:只需在其中1个节点上格式化就可以,接下来我们选择在ebsrac1节点上格式化。

2.14.1 格式化共享磁盘

① 以root用户分别在两个节点上执行fdisk命令,查看现有硬盘分区信息:

ebsrac1

[root@ebsrac1 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/tebsrack, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00010adc

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26        3534    28179456   83  Linux

/dev/sda3            3534        3917     3072000   82  Linux swap / Solaris

Disk /dev/sdb: 524 MB, 524288000 bytes

64 heads, 32 sectors/tebsrack, 500 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sdc: 524 MB, 524288000 bytes

64 heads, 32 sectors/tebsrack, 500 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sdd: 21.0 GB, 20971520000 bytes

255 heads, 63 sectors/tebsrack, 2549 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sde: 10.5 GB, 10485760000 bytes

255 heads, 63 sectors/tebsrack, 1274 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sdf: 10.5 GB, 10485760000 bytes

255 heads, 63 sectors/tebsrack, 1274 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

ebsrac2

[root@ebsrac2 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/tebsrack, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00010adc

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26        3534    28179456   83  Linux

/dev/sda3            3534        3917     3072000   82  Linux swap / Solaris

Disk /dev/sdb: 524 MB, 524288000 bytes

64 heads, 32 sectors/tebsrack, 500 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sdc: 524 MB, 524288000 bytes

64 heads, 32 sectors/tebsrack, 500 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sdd: 21.0 GB, 20971520000 bytes

255 heads, 63 sectors/tebsrack, 2549 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sde: 10.5 GB, 10485760000 bytes

255 heads, 63 sectors/tebsrack, 1274 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/sdf: 10.5 GB, 10485760000 bytes

255 heads, 63 sectors/tebsrack, 1274 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

从上,我们可以看到目前两个节点上的分区信息一致:其中/dev/sda是用于存放操作系统的,/dev/sdb/dev/sdc/dev/sdd/dev/sde /dev/sdf5块盘都没有分区信息,这是我们在上一步2.13节中配置的5块共享磁盘。

② root用户在ebsrac1上格式化/dev/sdb/dev/sdc/dev/sdd/dev/sde/dev/sdf5块盘

[root@ebsrac1 ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x294eefca.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

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): 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)

p

Partition number (1-4): 1

First cylinder (1-500, default 1): 1

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

Using default value 500

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

说明:fdisk /dev/sdb表示要对/dev/sdb磁盘进行格式化,其中,输入的命令分别表示:

n表示新建1个分区;

p表示分区类型选择为primary partition 主分区;

1表示分区编号从1开始;

起始、终止柱面选择默认值,即1500

w表示将新建的分区信息写入硬盘分区表。

 

③ 重复上述步骤②,以root用户在ebsrac1上分别格式化其余4块磁盘:

④ 格式化完毕之后,在ebsrac1ebsrac2节点上分别看到下述信息:

ebsrac1

[root@ebsrac1 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/tebsrack, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00010adc

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26        3534    28179456   83  Linux

/dev/sda3            3534        3917     3072000   82  Linux swap / Solaris

Disk /dev/sdb: 524 MB, 524288000 bytes

64 heads, 32 sectors/tebsrack, 500 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x294eefca

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         500      511984   83  Linux

Disk /dev/sdc: 524 MB, 524288000 bytes

64 heads, 32 sectors/tebsrack, 500 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xd9574d1a

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1         500      511984   83  Linux

Disk /dev/sdd: 21.0 GB, 20971520000 bytes

255 heads, 63 sectors/tebsrack, 2549 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xf0e8dafa

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1        2549    20474811   83  Linux

Disk /dev/sde: 10.5 GB, 10485760000 bytes

255 heads, 63 sectors/tebsrack, 1274 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xc0c606da

   Device Boot      Start         End      Blocks   Id  System

/dev/sde1               1        1274    10233373+  83  Linux

Disk /dev/sdf: 10.5 GB, 10485760000 bytes

255 heads, 63 sectors/tebsrack, 1274 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xdba80b60

   Device Boot      Start         End      Blocks   Id  System

/dev/sdf1               1        1274    10233373+  83  Linux

至此,格式化共享磁盘完毕。

    

使用udev来创建ASM磁盘过程

通过脚本create_asmdisk.sh绑定磁盘信息。脚本信息见附件。两个节点都执行

[root@ebsrac1 ]# ./create_asmdisk.sh

[root@ebsrac1 ]# more 99-oracle-asmdevices.rules

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36d0d04b100637

7e32b6324b300000000", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36d0d04b100637

7e32b63344800000002", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36d0d04b100637

7e32b63486b00000003", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36d0d04b100637

7e32b63495400000004", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36d0d04b100637

7e32b6349c500000005", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36d0d04b100637

启动udev

[root@ebsracdb1 rman]#start_udev

查看asm情况

[root@ebsracdb1 rman]# ls -l /dev/asm*

brw-rw---- 1 grid asmadmin 8,  16 May  6 16:50 /dev/asm-diskb

brw-rw---- 1 grid asmadmin 8,  32 May  6 16:50 /dev/asm-diskc

brw-rw---- 1 grid asmadmin 8,  48 May  6 16:30 /dev/asm-diskd

brw-rw---- 1 grid asmadmin 8,  64 May  6 16:47 /dev/asm-diske

brw-rw---- 1 grid asmadmin 8,  80 May  6 16:50 /dev/asm-diskf

你可能感兴趣的:(oracle,数据库,linux)