五、添加磁盘
[root@sigleNodeasm]# /etc/init.d/Oracleasm createdisk VOL1 /dev/ hda1
Marking disk "VOL1" as an ASM disk: [ OK ]
[root@sigleNodeasm]# /etc/init.d/oracleasm createdisk VOL2 /dev/ hdb1
Marking disk "VOL2" as an ASM disk: [ OK ]
可以通过以下命令查询已经添加的ASM磁盘
[root@sigleNode ~]# /etc/init.d/oracleasm listdisks;
VOL1
VOL2
(二)创建ASM实例
oracle10g中创建ASM实例和数据库都可以采用DBCA,这在一定程度上隐藏了相关细节,下面采用手工创建ASM实例,其实和手工创建数据库大体类似创建参数文件,密码文件,dump路径
1、创建参数文件
[oracle@singleNode db_1]$ vi $ORACLE_HOME/dbs/init+ASM.ora
*.asm_diskstring='ORCL:VOL*'
*.background_dump_dest='/opt/ora10g/admin/+ASM/bdump'
*.core_dump_dest='/opt/ora10g/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=24M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/opt/ora10g/admin/+ASM/udump'
保存修改
2、创建dump目录
[oracle@ singleNode ~]$ mkdir -p $ORACLE_BASE/admin/+ASM/udump
[oracle@ singleNode ~]$ mkdir -p $ORACLE_BASE /admin/+ASM/bdump
[oracle@ singleNode ~]$ mkdir -p $ORACLE_BASE g/admin/+ASM/cdump
3、创建密码文件
[oracle@localhost ~]$ orapwd file=orapw+ASM password=asm
4、启动ASM实例
[oracle@sigleNode ~]$ export ORACLE_SID=+ASM
[oracle@sigleNode ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 18 06:38:08 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-29701: unable to connect to Cluster Manager
由于单实例环境下默认不启动CSS,所以启动失败
需要添加CSS配置之后启动ASM实例
[oracle@sigleNode ~]$ localconfig add
You must be logged in as root to run /u01/app/oracle/product/10.2.0.1/bin/localconfig.
Log in as root and restart /u01/app/oracle/product/10.2.0.1/bin/localconfig execution.
系统提示必须以root用户执行localconfig命令
[oracle@sigleNode ~]$ su -
Password:
[root@sigleNode ~]# /u01/app/oracle/product/10.2.0.1/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.
siglenode
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
CSS配置完毕,再次启动ASM实例
[oracle@sigleNode ~]$ su -
Password:
[root@sigleNode ~]# su - oracle
[oracle@sigleNode ~]$ export ORACLE_SID=+ASM
[oracle@sigleNode ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 18 06:42:03 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 96468992 bytes
Fixed Size 1217908 bytes
Variable Size 70085260 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
提示没有磁盘组需要加载
首先我们创建一下磁盘组
SQL> create diskgroup oradg1 external redundancy disk ‘ORCL:VOL1’;
SQL>diskGroup created
可以向现有磁盘组中增加磁盘
SQL> alter diskgroup oradg1 add disk ‘ORCL:VOL2’;
SQL>diskGroup altered
设置磁盘组oradg1为ASM实例默认加载的磁盘组
我们一开始没有创建spfile,所以需要创建一下
SQL>create spfile from pfile;
SQL> alter system set asm_diskgroups=oradg1 scope=spfile;
System altered.
SQL> shutdown
关闭ASM实例之后重新启动
SQL> startup
ASM instance started
Total System Global Area 96468992 bytes
Fixed Size 1217908 bytes
Variable Size 70085260 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
发现磁盘组已经加载成功,ASM实例成功创建并启动成功
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
