分类: Oracle
2008-05-12 17:23:16
由于ASM实例是工作在 instance上面,因此创建ASM的instance就是我们工作的第一步。
共分六步骤
1.create initial parameter files
2.create orapwd files
3.create the directory structure
4.startup the instance
5.create the spfile and restart the database
6.create the diskgroup
第一步:
创建pfile文件init_asm.ora
*.asm_diskstring='ORCL:MYVOL*'
*.user_dump_dest='/opt/oracle/admin/ASM/udump'
*.background_dump_dest='/opt/oracle/admin/ASM/bdump'
*.core_dump_dest='/opt/oracle/admin/ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
第二步:
创建密码文件:
[oracle@orahost01 dbs]$ orapwd file=orapwdASM password=passsw0rd entries=15
第三步:
创建目录
[oracle@orahost01 dbs]$ mkdir -p /opt/oracle/admin/ASM/udump
[oracle@orahost01 dbs]$ mkdir -p /opt/oracle/admin/ASM/bdump
[oracle@orahost01 dbs]$ mkdir -p /opt/oracle/admin/ASM/cdump
第四步:
启动实例
[oracle@orahost01 10g]$ export ORACLE_SID=ASM
[oracle@orahost01 10g]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 31 18:56:24 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected to an idle instance.
SQL> startup nomount
ORA-29701: unable to connect to Cluster Manager
******************
如果遇到这样的问题
******************
编辑vi /etc/inittab文件
添加或取消注释这一样
hi:35:respawn:/etc/init.d/init.cssd run > /dev/null 2>&1 < /dev/null
同时我们要保证有css服务的存在,如果没有的话,需要自己添加:
[oracle@orahost01 10g]$ cd $ORACLE_HOME
[oracle@orahost01 10g]$ cd bin
[oracle@orahost01 bin]$ ./localconfig add
You must be logged in as root to run ./localconfig.
Log in as root and restart ./localconfig execution.
[oracle@orahost01 bin]$ exit
[root@orahost01 bin]# pwd
/opt/oracle/product/10g/bin
[root@orahost01 bin]#./localconfig add
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.
orahost01
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
然后重新启动,我们再来:
[oracle@orahost01 ~]$ export ORACLE_SID=ASM
[oracle@orahost01 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 31 19:15:58 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected to an idle instance.
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
SQL> select name,state from v$asm_diskgroup;
no rows selected
SQL> quit
第五步:创建spfile
SQL> create spfile from pfile;
File created.
SQL> startup force
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
第六步:创建磁盘组
[oracle@orahost01 ~]$ export ORACLE_SID=ASM
[oracle@orahost01 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 31 19:29:21 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected to an idle instance.
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
SQL>create diskgroup dgroup1 normal redundancy
2 failgroup fgroup1 disk 'ORCL:MYVOL1','ORCL:MYVOL2'
3 failgroup fgroup2 disk 'ORCL:MYVOL3','ORCL:MYVOL4';
Diskgroup created.
SQL>select disk_number,total_mb,free_mb from v$asm_disk;
DISK_NUMBER TOTAL_MB FREE_MB
----------- ---------- ----------
0 392 362
1 392 369
2 392 364
3 392 367
SQL>select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DGROUP1 MOUNTED
当然也可以通过手动方式来mount
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@orahost01 dbs]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 31 19:31:46 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected.
SQL> shutdown abort
ASM instance shutdown
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
SQL> alter diskgroup dgroup1 mount;
Diskgroup altered.
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DGROUP1 MOUNTED
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
ASM
SQL> show parameter instance_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string ASM
之后我们就可以创建ASM数据库了。
那么创建完毕后如何启动ASM数据库,则按照如下步骤进行就可以了:
1.启动ASM实例
2.启动ASM数据库的实例
下面是自己另外做的一个小,很简单,备忘吧
[oracle@orahost01 dbs]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 31 20:10:01 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected to an idle instance.
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
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /opt/oracle/product/10g/dbs/sp
fileASM.ora
SQL> show parameter asm_
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string ORCL:MYDISK*
asm_power_limit integer 1
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
ALANGROUP DISMOUNTED
SQL> alter diskgroup alangroup mount;
Diskgroup altered.
SQL> show parameter asm_
NAME TYPE VALUE