一、準備oracleasm包node
[root@localhost oracle]# uname -r 2.6.18-164.el5
[oracle@localhost ~]$ ls -l total 264 -rw-r--r-- 1 oracle oinstall 136910 Jun 23 00:16 oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm -rw-r--r-- 1 oracle oinstall 14176 Jun 23 00:16 oracleasmlib-2.0.4-1.el5.x86_64.rpm -rw-r--r-- 1 oracle oinstall 90225 Jun 23 00:16 oracleasm-support-2.1.8-1.el5.x86_64.rpm
在下載的時候,須要注意與linux操做系統的內核版本一致,不然可能會出現錯誤linux
[root@localhost oracle]# rpm -ivh oracleasm* warning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing... ########################################### [100%] 1:oracleasm-support ########################################### [ 33%] 2:oracleasm-2.6.18-164.el########################################### [ 67%] 3:oracleasmlib ########################################### [100%]
[root@localhost oracle]# /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 <ENTER> 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 []: oinstall --輸入所屬組
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 Initializing the Oracle ASMLib driver: [ OK ] Scanning the system for Oracle ASMLib disks: [ OK ]
四、 檢查配置是否成功sql
確認ASMlib驅動被加載數據庫
[root@localhost oracle]# lsmod |grep asm oracleasm 84136 1
[root@localhost oracle]# cat /proc/filesystems |grep oracleasm nodev oracleasmfs
[root@localhost oracle]# df -ha |grep oracleasm oracleasmfs 0 0 0 - /dev/oracleasm
[root@localhost ~]# fdisk -l Disk /dev/sda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 6 48163+ 83 Linux /dev/sda2 7 515 4088542+ 83 Linux /dev/sda3 516 772 2064352+ 82 Linux swap / Solaris /dev/sda4 773 1044 2184840 5 Extended /dev/sda5 773 1044 2184808+ 83 Linux Disk /dev/sdb: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table Disk /dev/sdc: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table
[root@localhost ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. 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) Command (m for help): n --添加一塊磁盤 Command action e extended p primary partition (1-4) p --主磁盤 Partition number (1-4): 1 --第一分區 First cylinder (1-261, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-261, default 261): Using default value 261 Command (m for help): w --寫入 The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
[root@localhost ~]# fdisk -l Disk /dev/sda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 6 48163+ 83 Linux /dev/sda2 7 515 4088542+ 83 Linux /dev/sda3 516 772 2064352+ 82 Linux swap / Solaris /dev/sda4 773 1044 2184840 5 Extended /dev/sda5 773 1044 2184808+ 83 Linux Disk /dev/sdb: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 261 2096451 83 Linux Disk /dev/sdc: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdc1 1 261 2096451 83 Linux
[root@localhost ~]# /etc/init.d/oracleasm createdisk KEL1 /dev/sdb1 Marking disk "KEL1" as an ASM disk: [ OK ] [root@localhost ~]# /etc/init.d/oracleasm createdisk KEL2 /dev/sdc1 Marking disk "KEL2" as an ASM disk: [ OK ]查看建立好的磁盤:
[root@localhost disks]# pwd /dev/oracleasm/disks --建立好的磁盤在此目錄中 [root@localhost disks]# ls -l total 0 brw-rw---- 1 oracle oinstall 8, 17 Jun 23 00:32 KEL1 brw-rw---- 1 oracle oinstall 8, 33 Jun 23 00:32 KEL2
[root@localhost ~]# /etc/init.d/oracleasm listdisks KEL1 KEL2
[root@localhost ~]# /etc/init.d/oracleasm scandisks Scanning the system for Oracle ASMLib disks: [ OK ]
[root@localhost ~]# /etc/init.d/oracleasm listdisks KEL1 KEL2
七、 啓動CSS進程oracle
在啓動的時候,務必已經安裝了oracle數據庫,不然的話是不存在localconfig這個命令的ide
[root@kel ~]# /home/oracle/product/10.2.0/db_1/bin/localconfig add Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'root'.. Operation successful. Configuration for local CSS has been initialized Adding to inittab Startup will be queued to init within 90 seconds. Checking the status of new Oracle init process... Expecting the CRS daemons to be up within 600 seconds. CSS is active on these nodes. kel CSS is active on all nodes. Oracle CSS service is installed and running under init(1M)
[oracle@kel asm]$ vi initasm.ora
INSTANCE_TYPE = ASM ASM_POWER_LIMIT = 3 ASM_DISKSTRING = 'ORCL:KEL1','ORCL,KEL2' DB_UNIQUE_NAME = '+ASM'
[oracle@kel asm]$ export ORACLE_SID=+ASM --默認的ASM實例名稱 [oracle@kel asm]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 23 01:38:46 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup pfile='/home/oracle/asm/initasm.ora'; ASM instance started Total System Global Area 125829120 bytes Fixed Size 2019000 bytes Variable Size 98644296 bytes ASM Cache 25165824 bytes ORA-15110: no diskgroups mounted錯誤表示,暫時沒有磁盤組建立,從而也不會自動的掛在磁盤
十、建立spfileui
SQL> create spfile from pfile; File created.使用spfile的好處是,之後建立了磁盤組以後,會自動的修改參數asm_diskgroups,從而在每次啓動的時候能夠自動的掛載磁盤組。
十一、建立磁盤組spa
SQL> create diskgroup KEL external redundancy disk 'ORCL:KEL1','ORCL:KEL2';
SQL> alter system register; System altered.
在建立表空間的時候,數據庫必須打開,而後在數據庫的sqlplus中建立表空間便可操作系統
SQL> create tablespace kel datafile '+ASM/kel.dbf' size 50M; Tablespace created.
刪除CSS配置:code
[root@kel ~]# /home/oracle/product/10.2.0/db_1/bin/localconfig delete Stopping CSSD. Shutting down CSS daemon. Shutdown request successfully issued. Shutdown has begun. The daemons should exit soon.