Oracle DataBase单实例使用ASM案例(3)--Oracle 10g应用
系统环境:
操作系统:RedHat EL5(64)
Oracle 软件:Oracle 10gR2
在Oracle 10g单实例环境下使用ASM比较容易实现:
1、建立磁盘分区
[root@rh65 ~]# fdisk -l
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 487 3911796 83 Linux
/dev/sdb2 488 974 3911827+ 83 Linux
/dev/sdb3 975 2610 13141170 5 Extended
/dev/sdb5 975 1461 3911796 83 Linux
/dev/sdb6 1462 1948 3911796 83 Linux
/dev/sdb7 1949 2192 1959898+ 83 Linux
/dev/sdb8 2193 2436 1959898+ 83 Linux
/dev/sdb9 2437 2610 1397623+ 83 Linux
2、安装ASM LIB软件
系统内核版本:
[root@rh65 rh6_xen_asm]# uname -a
Linux rh65 2.6.18-194.el5xen #1 SMP Tue Mar 16 22:08:06 EDT 2010 i686 i686 i386 GNU/Linux
安装ASM软件包:
[root@rh65 rh6_xen_asm]# ls -l
total 236
-rwxr--r-- 1 oracle oinstall 128392 May 27 12:15 oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.i686.rpm
-rwxr--r-- 1 oracle oinstall 13929 May 27 12:14 oracleasmlib-2.0.4-1.el5.i386.rpm
-rwxr--r-- 1 oracle oinstall 85303 May 27 12:14 oracleasm-support-2.1.8-1.el5.i386.rpm
[root@rh65 rh6_xen_asm]# rpm -ivh *
warning: oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: failed to stat /media/RHEL_5.5 i386 DVD: No such file or directory
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [ 33%]
2:oracleasm-2.6.18-194.el########################################### [ 67%]
3:oracleasmlib ########################################### [100%]
3、配置ASM并建立ASM磁盘
[root@rh65 rh6_xen_asm]# service 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 <ENTER> 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) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@rh65 rh6_xen_asm]#
建立ASM磁盘:
[root@rh65 rh6_xen_asm]# service oracleasm createdisk ASM_DSK1 /dev/sdb1
Marking disk "ASM_DSK1" as an ASM disk: [ OK ]
[root@rh65 rh6_xen_asm]# service oracleasm createdisk ASM_DSK2 /dev/sdb2
Marking disk "ASM_DSK2" as an ASM disk: [ OK ]
[root@rh65 rh6_xen_asm]# service oracleasm createdisk ASM_DSK3 /dev/sdb5
Marking disk "ASM_DSK3" as an ASM disk: [ OK ]
[root@rh65 rh6_xen_asm]# service oracleasm createdisk ASM_DSK4 /dev/sdb6
Marking disk "ASM_DSK4" as an ASM disk: [ OK ]
查看ASM磁盘信息:
[root@rh65 ~]# service oracleasm listdisks;
ASM_DSK1
ASM_DSK2
ASM_DSK3
ASM_DSK4
4、配置ASM实例
[oracle@rh65 dbs]$ cat init+ASM.ora
instance_type='asm'
asm_diskstring='ORCL:ASM_*'
large_pool_size=12m
asm_diskgroups='DG1','RCY1'
background_dump_dest=/u01/app/oracle/admin/+ASM/bdump
core_dump_dest=/u01/app/oracle/admin/+ASM/cdump
user_dump_dest=/u01/app/oracle/admin/+ASM/udump
建立相应目录:
[oracle@rh65 dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/bdump
[oracle@rh65 dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/cdump
[oracle@rh65 dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/udump
建立口令文件:
[oracle@rh65 dbs]$ orapwd file='orapw+ASM' password=oracle entries=3
启动CSS服务:
[root@rh65 ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin
[root@rh65 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.
rh65
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
5、启动ASM Instance
[oracle@rh65 ~]$ export ORACLE_SID=+ASM
[oracle@rh65 ~]$ sqlplus '/as sysdba'
12:44:31 SYS@ +ASM>startup force nomount;
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
12:44:46 SYS@ +ASM>show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string
db_unique_name string +ASM
global_names boolean FALSE
instance_name string +ASM
lock_name_space string
log_file_name_convert string
service_names string +ASM
12:45:10 SYS@ +ASM>
6、手工建立ASM diskgroup
12:50:33 SYS@ +ASM>create diskgroup dg1
12:53:57 2 normal redundancy
12:54:01 3 failgroup fg1 disk 'ORCL:ASM_DSK1'
12:54:06 4 failgroup fg2 disk 'ORCL:ASM_DSK2';
Diskgroup created.
Elapsed: 00:00:12.22
12:54:23 SYS@ +ASM>create diskgroup rcy1
12:54:37 2 normal redundancy
12:54:40 3 failgroup fg1 disk 'ORCL:ASM_DSK3'
12:54:50 4 failgroup fg2 disk 'ORCL:ASM_DSK4';
Diskgroup created.
7、查看ASM磁盘组和磁盘信息
12:55:09 SYS@ +ASM>select name ,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DG1 MOUNTED
RCY1 MOUNTED
Elapsed: 00:00:00.18
12:56:02 SYS@ +ASM>
12:57:09 SYS@ +ASM>select GROUP_NUMBER ,DISK_NUMBER,STATE,NAME,PATH from v$asm_disk;
GROUP_NUMBER DISK_NUMBER STATE NAME PATH
------------ ----------- -------- ------------------------------ ----------------------------------------
1 0 NORMAL ASM_DSK1 ORCL:ASM_DSK1
1 1 NORMAL ASM_DSK2 ORCL:ASM_DSK2
2 0 NORMAL ASM_DSK3 ORCL:ASM_DSK3
2 1 NORMAL ASM_DSK4 ORCL:ASM_DSK4
Elapsed: 00:00:00.03
8、通过DBCA管理ASM
@至此,Oracle 10g在单实例下ASM磁盘亦可以使用了