Oracle RAC安装前的磁盘分区及裸设备配置

Oracle RAC安装中,前期配置是安装是否成功的关键。看过了不少文档,但是几乎都忽略了前期分区和裸设备的配置过程,因此简单的做了总结性记录。

安装环境为Oracle 10g for Linux x86

对独立存储(即,磁盘阵列),当存储工程师创建完raid group ,并在此group上分几个Lun,最终通过多路径封包后,轮到DBA上场动手了。Lun实际上从Linux OSfdisk -l命令查看时,相当于一个磁盘。

1、对磁盘做分区

在这里使用fdisk命令,但是在对磁盘进行分区的时候需要注意,根据ORACLE的官方文档要求,需要从磁盘头开始1MB的偏移量使用磁盘,ORACLE官方文档里的说明如下:

[@more@]

Once the LUNs have been presented from the SAN to ALL servers in the cluster, partition the LUNs from one node only, run fdisk to create a single whole-disk partition with exactly 1 MB offset on each LUN to be used as ASM Disk.

Tip: From the fdisk prompt, type "u" to switch the display unit from cylinder to sector. Then create a single

primary partition starting on sector 2048 (1MB offset assuming sectors of 512 bytes per unit). See below

example for /dev/sda:

fdisk /dev/sda

Command (m for help): u

Changing display/entry units to sectors

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First sector (61-1048575, default 61): 2048

Last sector or +size or +sizeM or +sizeK (2048-1048575, default 1048575):

Using default value 1048575

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

假设通过以上步骤对/dev/sdb进行分区后最终结果如下:

[root@ dbserver 1 ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 2035.7 GB, 146727239680 bytes

255 heads, 63 sectors/track, 17838 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 25 200781 83 Linux

/dev/sdb2 26 50 200812+ 83 Linux

/dev/sdb3 51 17838 142882110 5 Extended

/dev/sdb5 51 63 104391 83 Linux

/dev/sdb6 64 76 104391 83 Linux

/dev/sdb7 77 89 104391 83 Linux

/dev/sdb8 90 5561 43953808+ 83 Linux

/dev/sdb9 5562 11033 43953808+ 83 Linux

/dev/sdb10 11034 17838 54661131 83 Linux

[root@ dbserver 1 ~]#

分区命令只在一个节点上执行,另外一个节点上执行分区同步命令

#partprobe

2、将分区绑定到RAW设备

Oracle 10g由于我们把oracle的OCR(oracle集群注册表)、 表决磁盘(voting disk)安装在裸设备上,对于裸设备要使用它,需要编/etc/sysconfig/rawdevices文件,将裸设备添加到系统中,然后再为裸设备设定属组信息以及权限信息。

Oracle 11g OCR放到ASM上,也不必为表决磁盘分区空间。

把下面的内容添加到/etc/sysconfig/rawdevices文件中

#Vi /etc/sysconfig/rawdevices

#OCR

/dev/raw/raw1 /dev/sdb1

/dev/raw/raw2 /dev/sdb2

#Voting Disk

/dev/raw/raw5 /dev/sdb5

/dev/raw/raw6 /dev/sdb6

/dev/raw/raw7 /dev/sdb7

注意:在2.6内核的Red Hat Linux上,当系统重启后,裸设备的属组信息将被还原为系统默认值(root:disk)。为了使得裸设备属组信息可以被保留,你要在/etc/rc.d/rc.local中强制更新裸设备的属组信息,即在文件中加入下述内容:

#vi /etc/rc.d/rc.local

chown root:dba /dev/raw/raw1

chown root:dba /dev/raw/raw2

chmod 660 /dev/raw/raw1

chmod 660 /dev/raw/raw2

chown oracle:dba /dev/raw/raw5

chown oracle:dba /dev/raw/raw6

chown oracle:dba /dev/raw/raw7

chmod 644 /dev/raw/raw5

chmod 644 /dev/raw/raw6

chmod 644 /dev/raw/raw7

以上配置完毕后,部分资料要求务必重新启动两台服务器,在官方文档上对此也有如下的操作说明,是否不必重启,这个具体没有尝试过。

# /sbin/service rawdevices restart

3、 ASMlib安装与配置

每个节点上进行ASMlib的配置使用 ASMLib 之前,必须运行配置脚本来准备驱动程序。 在每个集群主机上运行以下命令并回应提示,如下例所示。

配置ASMlib

# /etc/init.d/oracleasm configure

这将配置 Oracle ASM 库驱动程序的启动时属性。以下问题将确定在启动时是否加载驱动程序以及它将拥有的权限。当前值将显示在方括号(“[]”)中。按 而不键入回应将保留该当前值。按 Ctrl-C 将终止。

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 ]

Creating /dev/oracleasm mount point [ OK ]

Loading module "oracleasm" [ OK ]

Mounting ASMlib driver filesystem [ OK ]

Scanning system for ASM disks [ OK ]

启用 ASMLib 驱动程序。

# /etc/init.d/oracleasm enable

Writing Oracle ASM library driver configuration [ OK ]

Scanning system for ASM disks [ OK ]

以上需要在所有节点上进行配置

下面我们来创建ASM磁盘(以下部分在一个节点上创建在另一个节点上扫描发现就可以了。

/etc/init.d/oracleasm createdisk DISK_NAME device_name

提示: 以大写字母输入 DISK_NAME。当前版本中有一个错误,即如果使用小写字母,ASM 实例将无法识别磁盘。

# /etc/init.d/oracleasm createdisk VOL1 /dev/sd8

Marking disk "/dev/sdb8" as an ASM disk [ OK ]

# /etc/init.d/oracleasm createdisk VOL2 /dev/sd9

Marking disk "/dev/sdb9" as an ASM disk [ OK ]

.

以下示例演示了如何列出标记为由 ASMLib 使用的所有磁盘。

# /etc/init.d/oracleasm listdisks

VOL1

VOL2.

注意在所有集群其他节点主机上,运行下列命令进行扫描所配置的 ASMLib 磁盘:

#/etc/init.d/oracleasm scandisks

以上操作步骤后的下一步就是Clusterwar的安装,后续步骤一般的文档写的也比较全面,也有图例,在此不作介绍。

最后作为备忘,将官方的相关内容也要粘贴过来了,认真阅读肯定会有收获。

对此Oracle官方文档的说明如下:

3.4.5 Binding Partitions to Raw Devices for Oracle Clusterware Files

Red Hat

  1. To determine what raw devices are already bound to other devices, enter the following command on every node:
    # /usr/bin/raw -qa

    Raw devices have device names in the form /dev/raw/rawn, where n is a number that identifies the raw device.
    For each device that you want to use, identify a raw device name that is unused on all nodes.
  1. Open the /etc/sysconfig/rawdevices file in any text editor and add a line similar to the following for each partition that you created:
    /dev/raw/raw1 /dev/sdb1

    Specify an unused raw device for each partition.
  1. For the raw device that you created for the Oracle Cluster Registry (OCR), enter commands similar to the following to set the owner, group, and permissions on the device file:
    # chown root:oinstall /dev/raw/rawn
    # chmod 640 /dev/raw/rawn

    By making the oinstall group the owner of the OCR, this permits the OCR to be read by multiple Oracle homes, including those with different OSDBA groups.
  2. To bind the partitions to the raw devices, enter the following command:
    # /sbin/service rawdevices restart

    The system automatically binds the devices listed in the rawdevices file when it restarts.
  1. Repeat step 2 through step 4 on each node in the cluster.

4.12 Raw Devices on Oracle Enterprise Linux and Red Hat Enterprise Linux

Verify that an appropriate raw devices utility (util-linux) rpm is installed for the update of the operating systems. For example, on Oracle Enterprise Linux 4 and Red Hat Enterprise Linux 4 (update 5), util-linux-2.12a-16.EL4.23.x86_64 or later rpm should be installed. On Oracle Enterprise Linux 5 and Red Hat Enterprise Linux 5, util-linux-2.13-0.44.EL5.x86_64 or later rpm should be installed.

When you restart an Oracle Enterprise Linux 4, Oracle Enterprise Linux 5, Red Hat Enterprise Linux 4, or Red Hat Enterprise Linux 5 system, raw devices revert to their original owners and permissions by default. If you are using raw devices with this operating system for your Oracle files, for example, for ASM storage or Oracle Clusterware files, you must override this default behavior. To do this, add an entry to the /etc/rc.d/rc.local file for each raw device containing the chmod and chown commands required to reset them to the required values.

As an example, here are sample entries in a /etc/rc.d/rc.local file that control the restart behavior of raw devices for two ASM disk files (/dev/raw/raw6 and /dev/raw/raw7), two Oracle Cluster Registry files (/dev/raw/raw1 and /dev/raw/raw2), and three Oracle Clusterware voting disks (/dev/raw/raw3, /dev/raw/raw4, and /dev/raw/raw5):

# ASM
chown oracle:dba /dev/raw/raw6
chown oracle:dba /dev/raw/raw7
chmod 660 /dev/raw/raw6
chmod 660 /dev/raw/raw7
# OCR
chown root:oinstall /dev/raw/raw1
chown root:oinstall /dev/raw/raw2
chmod 660 /dev/raw/raw1
chmod 660 /dev/raw/raw2
# Voting Disks
chown oracle:oinstall /dev/raw/raw3
chown oracle:oinstall /dev/raw/raw4
chown oracle:oinstall /dev/raw/raw5
chmod 644 /dev/raw/raw3
chmod 644 /dev/raw/raw4
chmod 644 /dev/raw/raw5

对于硬盘数据存储结构如下说明有助于以上文档的理解:

Sector:扇区(sector)是盘片的最小的可寻址单元,一个扇区可容纳512字节,也叫做磁盘块(disk block)。扇区会被集合成簇(cluster),簇也叫数据块,操作系统通常以数据块为单位对硬盘进行读写。

Track:磁道,多个扇区端对端地连成一个圆圈构成一个磁道,容量随半径的增加而增大。

Cylinder:磁柱,也叫柱面。构成硬盘的每个碟片都被划分为数目相等的磁道,并从外缘的“0”开始编号,具有相同编号的磁道形成一个圆柱,称之为磁盘的柱面。因此硬盘的柱面数和一个碟片上的磁道数是相同的。处在外面的磁道比处在里面的磁道拥有更多的扇区,能容纳更多的数据。

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

转载于:http://blog.itpub.net/18841027/viewspace-1059847/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值