1.ASMLib管理磁盘
1)ASMLib下载
/>
[root@ocp ~]# uname -r
2.6.9-78.EL
下载对应的内核版本进行安装
[root@ocp asm]# ll
total 652
-rw-r--r-- 1 root root 132372 Jul 12 12:58 oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 2537 Jul 12 12:58 oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 127733 Jul 12 12:58 oracleasm-2.6.9-78.ELhugemem-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 134679 Jul 12 12:58 oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 137437 Jul 12 12:58 oracleasm-2.6.9-78.ELxenU-2.0.5-1.el4.i686.rpm
-rw-r--r-- 1 root root 13105 Jul 12 12:58 oracleasmlib-2.0.4-1.el4.i386.rpm
-rw-r--r-- 1 root root 83636 Jul 12 12:58 oracleasm-support-2.1.7-1.el4.i386.rpm
[root@ocp asm]# rpm -ivh oracleasm-support-2.1.7-1.el4.i386.rpm
warning: oracleasm-support-2.1.7-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@ocp asm]# rpm -ivh oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm
warning: oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing... ########################################### [100%]
1:oracleasm-2.6.9-78.EL-d########################################### [100%]
[root@ocp asm]# rpm -ivh oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm
warning: oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing... ########################################### [100%]
1:oracleasm-2.6.9-78.EL ########################################### [100%]
[root@ocp asm]# rpm -ivh oracleasmlib-2.0.4-1.el4.i386.rpm
warning: oracleasmlib-2.0.4-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
2配置ASMLib
[root@ocp dev]# /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) [y]: 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]
3创建ASM磁盘
[root@ocp ~]# oracleasm createdisk vol1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@ocp ~]# oracleasm createdisk vol2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
查看创建的磁盘
[root@ocp disks]# oracleasm listdisks
VOL1
VOL2
[root@ocp disks]# oracleasm-discover
Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
Discovered disk: ORCL:VOL1 [2088387 blocks (1069254144 bytes), maxio 256]
Discovered disk: ORCL:VOL2 [2088387 blocks (1069254144 bytes), maxio 256]
到这里,所创建的磁盘可以被oracle所使用了.
接下来可以创建ASM实例,可以识别并使用这些磁盘,创建磁盘组.
创建ASM实例可以通过图形界面,也可以使用手工方式来创建ASM实例。
4手工创建ASM实例
1)创建参数文件
[oracle@ocp udump]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@ocp 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'
2)创建密码文件
[oracle@ocp dbs]$ orapwd file=orapw+ASM password=oracle
3)创建相应目录
[oracle@ocp dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/udump
[oracle@ocp dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/bdump
[oracle@ocp dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/cdump
4)切换到ASM实例,启动实例
[oracle@ocp dbs]$ export ORACLE_SID=+ASM
[oracle@ocp dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 28 07:57:35 2015
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服务
5)添加CSS服务
使用root用户添加
[root@ocp disks]# /u01/app/oracle/product/10.2.0/db_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.
ocp
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
6)重新启动ASM
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
7)查看磁盘创建磁盘组
SQL> select total_mb,free_mb,name,group_number,disk_number from v$asm_disk;
TOTAL_MB FREE_MB NAME GROUP_NUMBER DISK_NUMBER
---------- ---------- ------------------------------ ------------ -----------
1019 0 0 1
1019 0 0 0
SQL> create diskgroup dg1 external redundancy disk 'ORCL:VOL1';
Diskgroup created.
SQL> select group_number,disk_number,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER PATH
------------ ----------- ------------------------------
0 0 ORCL:VOL2
2 0 ORCL:VOL1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26937943/viewspace-1790216/,如需转载,请注明出处,否则将追究法律责任。