半夏微凉

半夏微凉

RAC+DG(5、配置ASM磁盘)

1.VM创建共享磁盘
创建两个3G,两个5G共4个共享磁盘。
其中两个3G分别使用SCSI 1:0 和SCSI 1:1端口
另外两个5G分别使用SCSI 2:0 和SCSI 2:1端口

举例3G共享磁盘创建如下:

RAC+DG(5、配置ASM磁盘) 数据库 第1张


RAC+DG(5、配置ASM磁盘) 数据库 第2张


RAC+DG(5、配置ASM磁盘) 数据库 第3张


RAC+DG(5、配置ASM磁盘) 数据库 第4张


RAC+DG(5、配置ASM磁盘) 数据库 第5张


RAC+DG(5、配置ASM磁盘) 数据库 第6张


vmx配置文件最后加入:
scsi1.sharedBus = "virtual"
disk.locking = "FALSE" 
diskLib.dataCacheMaxSize = "0" 

scsi2.sharedBus = "virtual"


RAC+DG(5、配置ASM磁盘) 数据库 第7张RAC+DG(5、配置ASM磁盘) 数据库 第8张

RAC2处同样上述操作,不过创建磁盘时,选择已有磁盘,选择RAC1中创建出来的4个磁盘,分配的SCSI端口号与RAC1保持一致。


2、格式化共享磁盘
#只需要在其中一个节点上格式化即可。这里在RAC1节点格式化硬盘。两个节点分别查看磁盘列表,观察是否两个节点都存在了4个共享磁盘
fdisk -l
[root@rac1 ~]# fdisk -l
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x0005ee9a
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         511     4096000   82  linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2   *         511        7833    58817536   83  Linux
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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/sdd: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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/sdb,请依次输入下面命令
fdisk /dev/sdb
n
p
1
回车
回车
w
----------------------------------------
过程:
[root@rac1 ~]# 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 0x10d1134c.
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): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-391, default 391):
Using default value 391
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表示分区类型选择为primarypartition 主分区;
1表示分区编号从1开始;
起始、终止柱面选择默认值,即1 和500;
w 表示将新建的分区信息写入硬盘分区表。
③ 重复上述步骤②,以root 用户在rac1上分别格式化其余3 块磁盘:
④ 格式化完毕之后,在rac1, rac2 节点上分别看到下述信息:
rac1:
[root@rac1 ~]# fdisk -l
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x0005ee9a
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         511     4096000   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2   *         511        7833    58817536   83  Linux
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0xe1ffc5e7
  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         391     3140676   83  Linux
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0x10d1134c
  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         391     3140676   83  Linux
Disk /dev/sdd: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x54a2587e
  Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         652     5237158+  83  Linux
Disk /dev/sde: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x532e1b5a
  Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1         652     5237158+  83  Linux
[root@rac1 ~]#
rac2:
[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
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005ee9a
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         511     4096000   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2   *         511        7833    58817536   83  Linux
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0xe1ffc5e7
  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         391     3140676   83  Linux
Disk /dev/sdd: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x54a2587e
  Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         652     5237158+  83  Linux
Disk /dev/sde: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x532e1b5a
  Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1         652     5237158+  83  Linux
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0x10d1134c
  Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         391     3140676   83  Linux


3.可以通过ASMLIB或UDEV配置ASM磁盘
ASMLIB方式:
使用ASMLib需要3个包:kmod-oracleasm、oracleasmlib、oracleasm-support,后两个包都可以直接在网站上下载到(获取方式:http://www.oracle.com/technetwork/topics/linux/asmlib/),关键是第一个ASMLib内核驱动包需要到RHN上更新,且应该匹配操作系统的内核版本。如果使用的是Oracle Linux的uek内核,oracleasm已经被编译到了内核中,如果使用的是和Red Hat兼容的内核,那么需要手动安装kmod-oracleasm包。
oracleasm-support-version.arch.rpm
oracleasm-kernel-version.arch.rpm
oracleasmlib- version .arch.rpm
RAC+DG(5、配置ASM磁盘) 数据库 第9张
RAC+DG(5、配置ASM磁盘) 数据库 第10张
(1)依据kmod、oracleasmlib和oracleasm-support的顺序安装驱动程序。
[root@node2 ASMlib For redhat6.5]# rpm -ivh kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:kmod-oracleasm ########################################### [100%]
[root@node2 ASMlib For Redhat6.5]# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
[root@node2 ASMlib For Redhat6.5]# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
(2)双节点配置ASM driver 服务
/usr/sbin/oracleasm status
/usr/sbin/oracleasm configure -i
grid
asmadmin
y
y
/usr/sbin/oracleasm init
/usr/sbin/oracleasm status
[root@node1 ~]# /usr/sbin/oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[root@node1 ~]# /usr/sbin/oracleasm configure -i
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 <ENTER> 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
[root@node1 ~]# /usr/sbin/oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@node1 ~]# /usr/sbin/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
(3)配置ASM磁盘(只需要一个节点上执行即可)
[root@node1~]#
/usr/sbin/oracleasm createdisk VOL1 /dev/sdb1
/usr/sbin/oracleasm createdisk VOL2 /dev/sdc1
/usr/sbin/oracleasm createdisk VOL3 /dev/sdd1
/usr/sbin/oracleasm listdisks
节点二:
/usr/sbin/oracleasm listdisks
/usr/sbin/oracleasm scandisks

/usr/sbin/oracleasm listdisks


/usr/sbin/oracleasm querydisk /dev/sd*  ---定ASM 磁盘同物理磁盘之间的对应关系
UDEV方式:



评论回复


·