由于后文会相关的演示操作会用到ASM实例,因此在文章的开始就先创建一个简单的ASM实例,后面再开始详细的介绍ASM。

cuug每周五晚8点都有免费网络课程,详情可点击http://www.51CTO提醒您,请勿滥发广告!.cn

下面是创建一个ASM Instance的具体操作过程:


创建ASM实例的相关目录


[Oracle@gtser1~]$ mkdir -p $ORACLE_BASE/admin/+ASM/bdump


[oracle@gtser1~]$ mkdir -p $ORACLE_BASE/admin/+ASM/cdump


[oracle@gtser1~]$ mkdir -p $ORACLE_BASE/admin/+ASM/hdump


[oracle@gtser1~]$ mkdir -p $ORACLE_BASE/admin/+ASM/pfile


[oracle@gtser1~]$ mkdir -p $ORACLE_BASE/admin/+ASM/udump


准备pfile的初始化参数


[oracle@gtser1~]$ vi /tmp/init+ASM.ora


INSTANCE_TYPE=ASM


"/tmp/init+ASM.ora"6L, 225C 已写入                                                                                                                                       


[oracle@gtser1~]$ cat /tmp/init+ASM.ora


INSTANCE_TYPE=ASM


*.instance_name='+ASM'


*.asm_diskstring='/dev/raw/raw*'


background_dump_dest=/u01/oracle/10g/admin/+ASM/bdump


core_dump_dest=/u01/oracle/10g/admin/+ASM/cdump


user_dump_dest=/u01/oracle/10g/admin/+ASM/udump


启动ASM实例


[oracle@gtser1~]$ export ORACLE_SID=+ASM


[oracle@gtser1~]$ sqlplus "/as sysdba"


 


SQL*Plus:Release 10.2.0.5.0 - Production on Sat Feb 23 15:20:17 2013


 


Copyright(c) 1982, 2010, Oracle.  All RightsReserved.


 


Connectedto an idle instance.


 


SQL>startup pfile='/tmp/init+ASM.ora'


ASMinstance started


 


TotalSystem Global Area  125829120 bytes


FixedSize                  2094512 bytes


VariableSize              98568784 bytes


ASMCache                  25165824 bytes


ORA-15110:no diskgroups mounted


 


创建spfile


SQL>create spfile from pfile;


createspfile from pfile


*


ERROR atline 1:


ORA-01078:failure in processing system parameters


LRM-00109:could not open parameter file


'/u01/oracle/10g/product/10.2.0/db_1/dbs/init+ASM.ora'


 


 


SQL>create spfile from pfile='/tmp/init+ASM.ora';


 


Filecreated.


查看实例信息


SQL>select instance_name,host_name,version,database_status from v$instance;


 


INSTAHOST_NAM VERSION    DATABASE


------------- ---------- --------


+ASM  gtser1  10.2.0.5.0 ACTIVE


查看磁盘信息


GROUP_NUMBERDISK_NUMBER NAME  HEADER_STATUS            FAILGROUP CREATE_DATE    PATH


----------------------- ----- ------------------------ --------- ----------------------------


          0          0      CANDIDATE                                        /dev/raw/raw4


          0          1      CANDIDATE                                        /dev/raw/raw2


          0          2      CANDIDATE                                        /dev/raw/raw3


          0          0      CANDIDATE                                        /dev/raw/raw1


查看磁盘组信息


SQL>select group_number,name,state,type,total_mb,free_mb from v$asm_diskgroup orderby 1,2;


 


no rowsselected


 


SQL>exit


Disconnectedfrom Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bitProduction


With thePartitioning, OLAP, Data Mining and Real Application Testing options