標籤:
Oracle版本:Oracle 11g
1、確定自己的Linux版本:
[[email protected] ~]#uname -r
2.6.32-431.el6.x86_64
2.6.32-431.el6.x86_64,即Linux 6
2、安裝Oracleasm Kernel:
[[email protected] ~]# yum install kmod-oracleasm
3、下載兩個安裝包:oracleasmlib和oracleasm-support
[[email protected] ~]#wget http://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
[[email protected] ~]#wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
4、安裝這兩個包:
[[email protected] ~]#rpm -ivh oracleasm*
5、配置:
[[email protected] ~]#su oracle
[[email protected] ~]#/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]: 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 ]
如果想關閉這個ASM磁碟,可以這樣配置:
[[email protected] /]# /etc/init.d/oracleasm disable
Writing Oracle ASM library driver configuration [ OK ]
Unmounting ASMlib driver filesystem [ OK ]
Unloading module "oracleasm" [ OK ]
[[email protected] /]# /etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration [ OK ]
Loading module "oracleasm" [ OK ]
Mounting ASMlib driver filesystem [ OK ]
Scanning system for ASM disks [ OK ]
6、為ASM準備一塊硬碟空間:
首先可以使用fdisk -l命令查看分區,
我這裡為ASM準備了一塊還沒有分區的硬碟,
使用fdisk -l命令看到這塊硬碟叫sdc,然後我們開始給這塊硬碟分區:
[[email protected] ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3c1761b2.
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
switchoff the mode (command ‘c‘) and change display units to
sectors(command ‘u‘).
Command(m for help): m
Commandaction
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition(建立新分區)
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition‘s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command(m for help): n
Commandaction
e extended
p primary partition (1-4)
因為ASM要求必須是主要磁碟分割或邏輯分區所以只能選p:
Command (m for help): p
Partitionnumber (1-4): 2
Firstcylinder (1-121601, default 1):
Usingdefault value 1
Lastcylinder, +cylinders or +size{K,M,G} (1-121601, default 121601):
Usingdefault value 121601
再次執行fdisk -l命令查看分區:
Disk/dev/sdc: 1000.2 GB, 1000204886016 bytes
255heads, 63 sectors/track, 121601 cylinders
Units= cylinders of 16065 * 512 = 8225280 bytes
Sectorsize (logical/physical): 512 bytes / 512 bytes
I/Osize (minimum/optimal): 512 bytes / 512 bytes
Diskidentifier: 0x881f3ea8
DeviceBoot Start End Blocks Id System
/dev/sdc2 1 121601 976760001 83 Linux
7、將硬碟空間分配給ASM:
查看磁碟組:
[[email protected] /]# /etc/init.d/oracleasm listdisks
VOL1
建立一個磁碟組VOL2並分配給ASM:
[[email protected] /]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc2
Creating Oracle ASM disk "VOL2" [ OK ]
Linux CentOS6.5下安裝Oracle ASM