URL:http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel4-092650.html
1.增加硬盘
增加4块硬盘,每块硬盘1G,命名为physical1.vmk,physical2.vmk,physical3.vmk,physical4.vmk
2.安装ASMjar包
uname -a --查看内核,根据系统内核下载oracleasm文件安装,本环境为CentOS4 32位
Linux asm 2.6.9-89.ELsmp #1 SMP Mon Jun 22 12:32:43 EDT 2009 i686 i686 i386 GNU/Linux
rpm -Uvh oracleasm-2.6.9-89.EL-2.0.5-1.el4.i686.rpm, oracleasmlib-2.0.4-1.el4.i386.rpm,oracleasm-support-2.1.7-1.el4.i386.rpm oracleasm-2.6.9-89.ELsmp-2.0.5-1.el4.i686.rpm
3.配置ASM
创建用户名和组
groupadd oinstall
groupadd dba
cd /
mkdir -p /u01/oracle
useradd -g oinstall -G dba -d /u01/oracle oracle
/etc/init.d/oracleasm configure
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
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 ]
4.卸载和加载ASMLIB
/etc/init.d/oracleasm disable ----卸载
/etc/init.d/oracleasm enable -----加载
5.对磁盘进行分区
fdisk sdb
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
如上分区sdc,sdd,sde
6.创建ASM磁盘
/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
/etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
/etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
/etc/init.d/oracleasm createdisk VOL4 /dev/sde1
/etc/init.d/oracleasm listdisks ----查看磁盘
/etc/init.d/oracleasm listdisks ----------RAC中添加某一个磁盘时,执行此命令。
7.配置oracle用户的环境变量
[oracle@localhost ~]$ more .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export EDITOR=vi
export ADR_BASE=/u01/app/oracle
export ORACLE_SID=ORCL
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
stty erase ^h
alias sqlplus='rlwrap sqlplus'
8.创建ASM实例
初始化配置
cd /u01/app/oracle/product/11.2.0/db_1/dbs
vi init+ASM.ora
*.asm_diskstring='ORCL:VOL*'
*.background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'
*.core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/u01/app/oracle/admin/+ASM/udump'
9.创建密码文件
orapwd file=orapwd+ASM password=dba
10.创建目录
mkdir -p $ORACLE_BASE/admin/+ASM/udump
mkdir -p $ORACLE_BASE/admin/+ASM/bdump
mkdir -p $ORACLE_BASE/admin/+ASM/cdump
11.启动ASM实例
export ORACLE_SID=+ASM
sqllplus /nolog
conn / as sysdba
SQL> startup
ORA-29701: unable to connect to Cluster Manager
解决办法:
以root用户
cd $ORACLE_HOME/bin
执行:./localconfig add
etc/oracle does not exist. Creating it now.
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.
asm
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
回到oracle用户下,再次SQL> startup
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
12.创建spfile
create spfile from pfile
13.关闭+ASM
SQL> shutdown immediate
ORA-15100: invalid or missing diskgroup name
ASM instance shutdown
14.重新启动
startup
15.创建磁盘组
SQL> create diskgroup dgroup1 normal redundancy
2 failgroup fgroup1 disk 'ORCL:VOL1','ORCL:VOL2'
3 failgroup fgroup2 disk 'ORCL:VOL3','ORCL:VOL4';
查看:
SQL> select name,state from v$asm_diskgroup;
如果没有mount上
则手工alter diskgroup dgroup1 mount;
SQL> show parameter asm_diskgroups;
16.创建数据库实例
第六步:选择asm
第七步:如果磁盘组不是mount状态,则点击下面按钮,使之处于mount状态
17.启动ASM数据库
export ORACLE_SID=+ASM
sqlplus /nolog
conn / as sysdba
SQL> startup
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
18.关闭ASM数据库
先关闭实例,再关闭ASM实例
SQL>shutdown immediate
ORA-15097: cannot SHUTDOWN ASM instance with connected RDBMS instance
原因:1.可能先于实例关闭。
2.没有注册到Listener中,执行:alter system register;