Create an ASM disk group

Source: Internet
Author: User

An ASM disk is an ASM disk pool managed as a logical unit. Like any other LVM, ASM manages a large number of physical volumes and submits them to Oracle as one or more logical volumes. A physical volume can be an actual disk or disk partition, or a volume belonging to the volume manager of the operating system. Either way, you cannot use any file system format. It must be a bare device.

On Linux, ASM can reference a diskBare Device, Or by usingASMLibSoftware.

  • Direct use of bare devices:

1. Before RHEL6, you can directly useRawdevicesAfter the system is installed, the/etc/init. d/rawdevices and/etc/sysconfig/rawdevices files already exist by default.

# Cat/etc/redhat-releaseRed Hat Enterprise Linux Server release 5.8 (Tikanga) # rpm-qf/etc/init. d/rawdevices/etc/sysconfig/rawdevicesinitscripts-8.45.42-1.el5initscripts-8.45.42-1.el5 # cat/etc/init. d/rawdevices #! /Bin/bash # rawdevices This shell script assignes rawdevices to block devices # chkconfig: 345 56 44 # description: this scripts assignes raw devices to block devices \ # (such as hard drive partitions ). this is for the use \ # of applications such as Oracle. you can set up the \ # raw device to block device mapping by editing \ # the file/etc/sysconfig/rawdevices. # config:/etc/sysconfig/rawdevices [- F/bin/raw] | exit 0 [-f/etc/sysconfig/rawdevices] | exit 0 # Exit if the file just has the default comments. LC_ALL = C/bin/egrep-q-v "^ * #"/etc/sysconfig/rawdevices 2>/dev/null | exit 0. /etc/init. d/functionsfunction assign_raw () {LC_ALL = C egrep-v '^ * #'/etc/sysconfig/rawdevices | while read raw block; do if [-n "$ RAW"-a-n "$ BLOCK"]; then rawdirname =$ {RAW %/*} if ["$ rawdirname" = "/d Ev "-a-d/dev/raw]; then echo $" Please correct your/etc/sysconfig/rawdevices: "echo $" rawdevices are now located in the directory/dev/raw/"echo $" If the command 'Raw' still refers to/dev/raw as a file. "echo $" you'll have to upgrade your util-linux package "exit 0 fi if [" $ rawdirname "="/dev/raw "-a-f/dev/raw ]; then echo $ "Please correct your/etc/sysconfig/rawdevices:" echo $ "ra Wdevices are now located in the directory/dev/raw/"echo $" If the command 'Raw' still refers to/dev/raw as a file. "echo $" you'll have to upgrade your util-linux package "exit 0 fi echo" $ RAW --> $ BLOCK "; raw $ RAW $ BLOCK fi done} # See how we were called. case "$1" in start) # Assign devices echo $ "Assigning devices:" assign_raw # Add the following two rows (which does not exist by default ), that is, the raw device generated by default is owned by the root user. # Therefore, you must modify the owner. Otherwise, oracle users cannot use the raw device sl. Eep 5 chown-R oracle: oinstall/dev/raw/echo $ "done"; stop) # No action to be taken here; status) ID = 'id-U' if [$ id-eq 0]; then raw-qa else echo $ "You need to be root to use this command! "Fi; restart | reload) $0 start; *) echo $" Usage: $0 {start | stop | status | restart} "exit 1 esacexit 0


# Vi/etc/sysconfig/rawdevices // ing the raw device/dev/raw/raw10/dev/sda10/dev/raw/raw11/dev/sda11/dev/raw /raw12/dev/sda12/dev/raw/raw13/dev/sda13/dev/raw/raw14/dev/sda14 # chkconfig rawdevices on # service rawdevices startAssigning devices: /dev/raw/raw10 -->/dev/sda10/dev/raw/raw10: bound to major 8, minor 10/dev/raw/raw11 -->/dev/sda11/dev/raw/raw11: bound to major 8, minor 11/dev/raw/raw12 -->/dev/sda12/dev/raw/raw12: bound to major 8, minor 12/dev/raw/raw13 -->/dev/sda13/dev/raw/raw13: bound to major 8, minor 13/dev/raw/raw14 -->/dev/sda14/dev/raw/raw14: bound to major 8, minor 14 done # ls-l/dev/raw/total 0crw-rw ----. 1 oracle oinstall 162, 10 May 27 raw10crw-rw ----. 1 oracle oinstall 162, 11 May 27 raw11crw-rw ----. 1 oracle oinstall 162, 12 May 27 raw12crw-rw ----. 1 oracle oinstall 162, 13 May 27 raw13crw-rw ----. 1 oracle oinstall 162, 14 May 27 raw14crw-rw ----. 1 oracle oinstall 162, 0 May 27 rawctl # raw-qa/dev/raw/raw10: bound to major 8, minor 10/dev/raw/raw11: bound to major 8, minor 11/dev/raw/raw12: bound to major 8, minor 12/dev/raw/raw13: bound to major 8, minor 13/dev/raw/raw14: bound to major 8, minor 14


2. in RHEL6, although the system does not have/etc/sysconfig/rawdevices and/etc/init. d/rawdevices file, but still supports rawdevices. You can manage raw files by using the following method.

  1. Manually create the/etc/sysconfig/rawdevices and/etc/init. d/rawdevices files.

  2. PassUdevYou can also use udev to fix the device name of the disk.

The following describes how to use udev:

# fdisk -l /dev/sdbDisk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes   Device Boot      Start         End      Blocks   Id  System/dev/sdb1               1         261     2096451    5  Extended/dev/sdb5               1          25      200749+  83  Linux/dev/sdb6              26          50      200781   83  Linux/dev/sdb7              51          75      200781   83  Linux/dev/sdb8              76         100      200781   83  Linux/dev/sdb9             101         125      200781   83  Linux# vi /etc/udev/rules.d/60-raw.rulesACTION=="add",KERNEL=="sdb5",RUN+="/bin/raw /dev/raw/raw5 %N",OWNER="oracle", GROUP="oinstall", MODE="660"ACTION=="add",KERNEL=="sdb6",RUN+="/bin/raw /dev/raw/raw6 %N",OWNER="oracle", GROUP="oinstall", MODE="660"ACTION=="add",KERNEL=="sdb7",RUN+="/bin/raw /dev/raw/raw7 %N",OWNER="oracle", GROUP="oinstall", MODE="660"ACTION=="add",KERNEL=="sdb8",RUN+="/bin/raw /dev/raw/raw8 %N",OWNER="oracle", GROUP="oinstall", MODE="660"ACTION=="add",KERNEL=="sdb9",RUN+="/bin/raw /dev/raw/raw9 %N",OWNER="oracle", GROUP="oinstall", MODE="660"# raw -qa# start_udevStarting udev: [  OK  ]# raw -qa/dev/raw/raw5:  bound to major 8, minor 21/dev/raw/raw6:  bound to major 8, minor 22/dev/raw/raw7:  bound to major 8, minor 23/dev/raw/raw8:  bound to major 8, minor 24/dev/raw/raw9:  bound to major 8, minor 25# ls -l /dev/rawtotal 0crw-rw---- 1 oracle oinstall 162,  5 Jun  9 17:15 raw5crw-rw---- 1 oracle oinstall 162,  6 Jun  9 17:15 raw6crw-rw---- 1 oracle oinstall 162,  7 Jun  9 17:15 raw7crw-rw---- 1 oracle oinstall 162,  8 Jun  9 17:15 raw8crw-rw---- 1 oracle oinstall 162,  9 Jun  9 17:15 raw9


  • ASMLib: (non-Linux systems can only use bare devices)

ASMLib is an optional set of kernel driver tools between ASM and hardware. It also serves as an application library to access the ASM disk through Oracle database software.

It is a single-instance database of Oracle 10g and 11g, and the ASM feature support database of RAC. ASM and database instances can use ASMLib as an alternative disk access interface.

ASMLib has the following three components:

Kernel Driver: the kernel driver that supports oracle ASMLib in oracleasm Linux needs to be downloaded according to the kernel version)

Supported tools: oracleasm-support provides a utility for configuring and starting the ASM driver.

Application Library: oracleasmlib provides the actual ASM Library

# Uname-r2.6.18-308. el5 # ls oracleasm * oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpmoracleasm-support-2.1.8-1.el5.x86_64.rpmoracleasmlib-2.0.4-1.el5.x86_64.rpm # rpm-ivh oracleasmlib * warning: oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159Preparing... ######################################## ### [100%] 1: oracleasm-support ##################################### ###### [100%] 2: oracleasm-2.6.18-308.el ####################################### #### [100%] 3: oracleasmlib ####################################### #### [100%] #/etc/init. d/oracleasm configureConfiguring the Oracle ASM library driver. this will configure the on-boot properties of the Oracle ASM librarydriver. the following questions will determine whether the driver isloaded on boot and what permissions it will have. the current valueswill be shown in brackets ('[]'). hitting <ENTER> without typing anananswer will keep that current value. ctrl-C will abort. default user to own the driver interface []: oracleDefault group to own the driver interface []: oinstallStart Oracle ASM library driver on boot (y/n) [n]: yScan for Oracle ASM disks on boot (y/n) [y]: Writing Oracle ASM library driver configuration: doneInitializing the Oracle ASMLib driver: [OK] Scanning the system for Oracle ASMLib disks: [OK] #/etc/init. d/oracleasm enableWriting Oracle ASM library driver configuration: [OK] Loading module "oracleasm": [OK] Mounting ASMlib driver filesystem: [OK] Scanning system for ASM disks: [OK] #/etc/init. d/oracleasm createdisk VOL1/dev/sda5Marking disk "VOL2" as an ASM disk: [OK] #/etc/init. d/oracleasm createdisk VOL2/dev/sda6Marking disk "VOL2" as an ASM disk: [OK] #/etc/init. d/oracleasm createdisk VOL3/dev/sda7Marking disk "VOL3" as an ASM disk: [OK] #/etc/init. d/oracleasm createdisk VOL4/dev/sda8Marking disk "VOL4" as an ASM disk: [OK] #/etc/init. d/oracleasm createdisk VOL5/dev/sda9Marking disk "VOL5" as an ASM disk: [OK] #/etc/init. d/oracleasm scandisksScanning system for ASM disks: [OK] #/etc/init. d/oracleasm listdisksVOL1VOL2VOL3VOL4VOL5 # ll/dev/oracleasm/disks/total 0brw-rw ---- 1 oracle oinstall 8, 5 Jun 3 09:53 VOL1brw-rw ---- 1 oracle oinstall 8, 6 Jun 3 VOL2brw-rw ---- 1 oracle oinstall 8, 7 Jun 3 VOL3brw-rw ---- 1 oracle oinstall 8, 8 Jun 3 VOL4brw-rw ---- 1 oracle oinstall 8, 9 Jun 3 VOL5 // The ASM work is completed here. The disk here can be used by Oracle, and oracleasm-discover is used to detect the ASM Hard Disk: # oracleasm-discoverUsing ASMLib from/opt/oracle/extapi/64/asm/orcl/1/libasm. so [ASM Library-Generic Linux, version 2.0.4 (KABI_V2)] Discovered disk: ORCL: VOL1 [4899762 blocks (2508678144 bytes), maxio 512] Discovered disk: ORCL: VOL2 [4899762 blocks (2508678144 bytes), maxio 512] Discovered disk: ORCL: VOL3 [4899762 blocks (2508678144 bytes), maxio 512] Discovered disk: ORCL: VOL4 [4899762 blocks (2508678144 bytes), maxio 512] Discovered disk: ORCL: VOL5 [7373772 blocks (3775371264 bytes), maxio 512]




This article from the "ghost fireworks smile" blog, please be sure to keep this source http://vnimos.blog.51cto.com/2014866/1220666

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.