一、环境
OS:
[root@yitai ~]# lsb_release --all
LSB Version: :core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: RedHatEnterpriseAS
Description: Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
Release: 4
Codename: NahantUpdate7
[root@yitai ~]# uname -a
Linux yitai.com 2.6.9-78.EL #1 SMP Wed Jul 9 15:39:47 EDT 2008 i686 i686 i386 GNU/Linux
DATABASE:
[oracle@yitai ~]$ sqlplus -version
SQL*Plus: Release 10.2.0.1.0 - Production
二、准备软件(asm)
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel4-092650.html
[root@yitai src]# ls -l
total 240
-rw-r--r-- 1 root root 134679 Aug 27 2012 oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 13105 Aug 27 2012 oracleasmlib-2.0.4-1.el4.i386.rpm
-rw-r--r-- 1 root root 83636 Aug 27 2012 oracleasm-support-2.1.7-1.el4.i386.rpm
注意: oracleasm软件包的版本必须要与uname -r 内核参数一致。如红色所示
三、 安装和配置asm
安装
[root@yitai src]# ls -l
total 240
-rw-r--r-- 1 root root 134679 Aug 27 2012 oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 13105 Aug 27 2012 oracleasmlib-2.0.4-1.el4.i386.rpm
-rw-r--r-- 1 root root 83636 Aug 27 2012 oracleasm-support-2.1.7-1.el4.i386.rpm
[root@yitai src]# rpm -ivh .
配置ASMLib:
# /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 ]
以上操作将加载oracleasm.o驱动,并且mount上ASM文件系统,通过以下命令来手工加载ASMLib
# /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 ]
重新启动系统,确认ASMLib已经可以自动加载
#dmesg | grep oracleasm
ASM: oracleasmfs mounted with options:
格式化磁盘
root@orahost01 dev]#fdisk 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): m
Command action
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
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
这个时候系统中会出现一个sdb1这个设备文件
之后我们继续对sdc,sdd,sde以上面同样的方法来进行分区。
创建ASM磁盘
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd" as an ASM disk [ OK ]
#/etc/init.d/oracleasm createdisk VOL4 /dev/sde1
Marking disk "/dev/sde" as an ASM disk [ OK ]
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
需要注意的是如果是在RAC环境中呢,如果在一个节点添加了ASM磁盘,在其他节点上要用过scandisks命令来获得这种变化。
如:
[root@orahost01 dev]#/etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
就此ASM环境的物理基础就已经搭建成功.
配置ASMLib:
# /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 ]
以上操作将加载oracleasm.o驱动,并且mount上ASM文件系统,通过以下命令来手工加载ASMLib
# /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 ]
重新启动系统,确认ASMLib已经可以自动加载
#dmesg | grep oracleasm
ASM: oracleasmfs mounted with options:
格式化磁盘
root@orahost01 dev]#fdisk 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): m
Command action
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
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
这个时候系统中会出现一个sdb1这个设备文件
之后我们继续对sdc,sdd,sde以上面同样的方法来进行分区。
创建ASM磁盘
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL4 /dev/sde1
Marking disk "/dev/sdd" as an ASM disk [ OK ]
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
【
需要注意的是如果是在RAC环境中呢,如果在一个节点添加了ASM磁盘,在其他节点上要用过scandisks命令来获得这种变化。
如:
[root@orahost01 dev]#/etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
就此ASM环境的物理基础就已经搭建成功.
】
四、dbca建库
用dbca创建数据库,一直到选择数据类型的画面以前都跟创建普通数据库没有区别。
dbca创建数据库的第6步,普通的数据库我们通常选择File System,而ASM类型的数据库我们则要选择“Automatic Storage Management”。
下一步,oracle将自动检查出已经加载的Diskgroup,在这个界面我们可以通过Create New按钮创建新的Diskgroup,也可以通过Add Disks按钮向当前的磁盘组中添加额外的磁盘,当然这些磁盘必须是先用oracleasm createdisk过的。
在数据文件的位置管理设定界面,通常应该使用OMF,由oracle自己管理数据文件的命名,这样才算是进一步解放了DBA对于物理存储方面的繁琐工作。
继续往下的步骤,跟创建普通数据库已经没有什么区别了。不再赘述。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27042095/viewspace-741970/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27042095/viewspace-741970/