ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 裸设备+ASM数据库

裸设备+ASM数据库

原创 Linux操作系统 作者:mycisco 时间:2011-04-13 11:36:44 0 删除 编辑
裸设备+ASM数据库
2010-04-08 10:53
裸设备+ASM数据库
最近业务人员反映数据库较慢,经过一番折腾(优化再优化)性能有了很大提升,基本可以满足当前业务需要了,可俺觉得已经到了山穷水尽的地步了(优化),呵呵,还是事先准备一下,先彻底搞搞oracle主推的ASM技术吧,据说裸设备IO性能真的很快哦,以后有机会把我们线上的系统也升级到裸设备+ASM 吧,呵呵。


一 映射原始磁盘为裸设备
1.添加硬件磁盘并分区,结果如下:
[root@rac1 ~]# fdisk -l

Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id System
/dev/sda1   *           1        1827    14675346   83 Linux
/dev/sda2            1828        1958     1052257+ 82 Linux swap

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id System
/dev/sdb1               1         652     5237158+ 83 Linux

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id System
/dev/sdc1               1         652     5237158+ 83 Linux

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id System
/dev/sdd1               1         391     3140676   83 Linux

其中 /dev/sdb、/dev/sdc、/dev/sdd 做数据磁盘。

二 创建裸设备 
1. 将以下条目添加到 /etc/sysconfig/rawdevices
   /dev/raw/raw1 /dev/sdb1
   /dev/raw/raw2 /dev/sdc1
   /dev/raw/raw3 /dev/sdd1

执行/sbin/service rawdevices restart 将更改立刻生效。
           Assigning devices: 
           /dev/raw/raw1 -->   /dev/sdb1
           /dev/raw/raw1: bound to major 8, minor 17
           /dev/raw/raw2 -->   /dev/sdc1
           /dev/raw/raw2: bound to major 8, minor 33
           /dev/raw/raw3 -->   /dev/sdd1
           /dev/raw/raw3: bound to major 8, minor 49
           done
2.更改权限
    [root@rac1 ~]# chown oracle:dba /dev/raw/raw[1-3]
    [root@rac1 ~]# chmod 660 /dev/raw/raw[1-3]
     
    [root@rac1 ~]# ll -lat /dev/raw/raw[1-3]
               crw-rw---- 1 oracle dba 162, 3 Oct 27 13:34 /dev/raw/raw3
               crw-rw---- 1 oracle dba 162, 2 Oct 27 13:34 /dev/raw/raw2
               crw-rw---- 1 oracle dba 162, 1 Oct 27 13:34 /dev/raw/raw1

3.创建软链接
     [root@rac1 ~]# mkdir -p /u01/oradata/devdb/
     [root@rac1 ~]# chown -R oracle:dba /u01 
     [root@rac1 ~]# ln -sf /dev/raw/raw1 /u01/oradata/devdb/asmdisk1
     [root@rac1 ~]# ln -sf /dev/raw/raw2 /u01/oradata/devdb/asmdisk2
     [root@rac1 ~]# ln -sf /dev/raw/raw3 /u01/oradata/devdb/asmdisk3

4.修改 /etc/udev/permissions.d/50-udev.permissions。
    原始设备在引导时会重新映射。默认情况下,在引导时原始设备的拥有者将 更改为 root 用户。
    如果拥有者不是 oracle 用户,则 ASM 在访问分区时会出现问题。
    在 /etc/udev/permissions.d/50-udev.permissions 中为原始行“raw/*:root:disk:0660”添加注释,
    然后添加一个新行“raw/*:oracle:dba:0660”。


三 配置ASM
   
1.自启动程序
    [root@rac1 /]# rpm -ivh oracleasmlib-2.0.2-1.i386.rpm 
Preparing...                                                            ########################################### [100%]
   1:oracleasmlib                                                       ########################################### [100%]
[root@rac1 /]# rpm -qa | grep asm
oracleasmlib-2.0.2-1
oracleasm-2.6.9-67.0.0.0.1.ELsmp-2.0.3-2
oracleasm-support-2.0.3-2
[root@rac1 /]# /etc/init.d/oracleasm 
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[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 []: 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]: 
Writing Oracle ASM library driver configuration:           [ OK ]
Loading module "oracleasm":                                [ OK ]
Mounting ASMlib driver filesystem:                         [ OK ]
Scanning system for ASM disks:                             [ OK ]
[root@rac1 /]# 
[root@rac1 /]# 
[root@rac1 /]# /etc/init.d/oracleasm status
Checking if ASM is loaded:                                 [ OK ]
Checking if /dev/oracleasm is mounted:                     [ OK ]

三 创建ASM磁盘
[root@rac1 /]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk:                   [ OK ]
[root@rac1 /]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk:                   [ OK ]
[root@rac1 /]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk:                   [ OK ]
[root@rac1 /]# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks:                             [ OK ]
[root@rac1 /]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3


四 安装数据库
通过gui程序安装数据库软件,然后在dbca创建数据库,数据文件放在asm磁盘上即可。

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

请登录后发表评论 登录
全部评论

注册时间:2011-03-29

  • 博文量
    7
  • 访问量
    12092