1.检查css服务是否启动,如果没有,将其启动
root@single
~]# 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
/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.
single
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
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.
single
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
检查css状态:
[root@single ~]# crsctl check cssd
CSS appears healthy
[root@single ~]# crsctl check cssd
CSS appears healthy
2.编辑初始化参数文件init+ASM.ora,对于一个asm实例,至少需要一个INSTANCE_TYPE的参数,该参数必须设置为ASM。
[ora10g@single dbs]$ vi init+ASM.ora
INSTANCE_TYPE = ASM
3。启动asm实例
[ora10g@single dbs]$ export ORACLE_SID=+ASM
[ora10g@single dbs]$ sqlplus / as sysdba
[ora10g@single dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Dec 11 20:38:36 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
idle>startup nomount;
ASM instance started
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
4.用dd命令创建4个磁盘文件
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY1_DISK1
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 2.37185 seconds, 113 MB/s
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY1_DISK2
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 5.56051 seconds, 48.3 MB/s
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY2_DISK1
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 4.18125 seconds, 64.2 MB/s
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY2_DISK2
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 2.88836 seconds, 92.9 MB/s
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 2.37185 seconds, 113 MB/s
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY1_DISK2
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 5.56051 seconds, 48.3 MB/s
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY2_DISK1
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 4.18125 seconds, 64.2 MB/s
[ora10g@single +ASM]$ dd if=/dev/zero bs=1048576 count=256 f=ARRAY2_DISK2
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 2.88836 seconds, 92.9 MB/s
[ora10g@single +ASM]$ ll
total 1049616
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:47 ARRAY1_DISK1
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:48 ARRAY1_DISK2
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:48 ARRAY2_DISK1
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:48 ARRAY2_DISK2
total 1049616
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:47 ARRAY1_DISK1
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:48 ARRAY1_DISK2
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:48 ARRAY2_DISK1
-rw-r--r-- 1 ora10g dba 268435456 Dec 11 20:48 ARRAY2_DISK2
5.为磁盘文件创建loop device
[ora10g@single ~]$ su -
Password:
Password:
[root@single +ASM]# losetup /dev/loop1 ARRAY1_DISK1
[root@single +ASM]# losetup /dev/loop2 ARRAY1_DISK2
[root@single +ASM]# losetup /dev/loop3 ARRAY2_DISK1
[root@single +ASM]# losetup /dev/loop4 ARRAY2_DISK2
[root@single +ASM]# losetup /dev/loop2 ARRAY1_DISK2
[root@single +ASM]# losetup /dev/loop3 ARRAY2_DISK1
[root@single +ASM]# losetup /dev/loop4 ARRAY2_DISK2
注:编辑/etc/rc.local,将上面创建loop devices的脚本放在rc.local中,这样每次系统reboot后,就自动加载loop devices了,否则还需要每次手工通过losetup重建.
删除loop device命令:losetup –d /dev/loopX
6.绑定loop device到raw上。
[root@single +ASM]# raw /dev/raw/raw1 /dev/loop1
/dev/raw/raw1: bound to major 7, minor 1
[root@single +ASM]# raw /dev/raw/raw2 /dev/loop2
/dev/raw/raw2: bound to major 7, minor 2
[root@single +ASM]# raw /dev/raw/raw3 /dev/loop3
/dev/raw/raw3: bound to major 7, minor 3
[root@single +ASM]# raw /dev/raw/raw4 /dev/loop4
/dev/raw/raw4: bound to major 7, minor 4
/dev/raw/raw1: bound to major 7, minor 1
[root@single +ASM]# raw /dev/raw/raw2 /dev/loop2
/dev/raw/raw2: bound to major 7, minor 2
[root@single +ASM]# raw /dev/raw/raw3 /dev/loop3
/dev/raw/raw3: bound to major 7, minor 3
[root@single +ASM]# raw /dev/raw/raw4 /dev/loop4
/dev/raw/raw4: bound to major 7, minor 4
检查绑定的raw:
[root@single +ASM]# raw -qa
/dev/raw/raw1: bound to major 7, minor 1
/dev/raw/raw2: bound to major 7, minor 2
/dev/raw/raw3: bound to major 7, minor 3
/dev/raw/raw4: bound to major 7, minor 4
/dev/raw/raw1: bound to major 7, minor 1
/dev/raw/raw2: bound to major 7, minor 2
/dev/raw/raw3: bound to major 7, minor 3
/dev/raw/raw4: bound to major 7, minor 4
为了在重启后有效,redhat 5版本的linux需要用root用户编辑/etc/sysconfig/rawdevices文件,增加如下内容
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add",KERNEL=="loop1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="loop2",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="loop3",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="loop4",RUN+="/bin/raw /dev/raw/raw4 %N"
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add",KERNEL=="loop1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="loop2",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="loop3",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="loop4",RUN+="/bin/raw /dev/raw/raw4 %N"
7.修改权限
[root@single +ASM]# chmod 660 /dev/raw/raw[1-4]
[root@single +ASM]# chown ora10g:dba /dev/raw/raw[1-4]
[root@single +ASM]# chown ora10g:dba /dev/raw/raw[1-4]
为了保证系统重启后有效,需要加入到/etc/rc.local中:
[root@single +ASM]# echo "chmod 660 /dev/raw/raw[1-4]" >>/etc/rc.local
[root@single +ASM]# echo "chown ora10g:dba /dev/raw/raw[1-4]" >>/etc/rc.local
[root@single +ASM]# echo "chown ora10g:dba /dev/raw/raw[1-4]" >>/etc/rc.local
8.修改asm_diskstring参数,并discover磁盘
idle>show parameter asm_diskstring
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string /home/db/oracle/oradata/+ASM
idle>show parameter spfile;
------------------------------------ ----------- ------------------------------
asm_diskstring string /home/db/oracle/oradata/+ASM
idle>show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /home/db/oracle/product/10.2.0
/dbs/spfile+ASM.ora
idle>alter system set asm_diskstring='/dev/raw/raw*' scope=both;
------------------------------------ ----------- ------------------------------
spfile string /home/db/oracle/product/10.2.0
/dbs/spfile+ASM.ora
idle>alter system set asm_diskstring='/dev/raw/raw*' scope=both;
System altered.
idle>col path for a30
idle>col library for a20
idle>SELECT path, header_status, library, total_mb, free_mb FROM v$asm_disk;
idle>col library for a20
idle>SELECT path, header_status, library, total_mb, free_mb FROM v$asm_disk;
PATH HEADER_STATU LIBRARY TOTAL_MB FREE_MB
------------------------------ ------------ -------------------- ---------- ----------
/dev/raw/raw4 CANDIDATE System 256 0
/dev/raw/raw1 CANDIDATE System 256 0
/dev/raw/raw2 CANDIDATE System 256 0
/dev/raw/raw3 CANDIDATE System 256 0
------------------------------ ------------ -------------------- ---------- ----------
/dev/raw/raw4 CANDIDATE System 256 0
/dev/raw/raw1 CANDIDATE System 256 0
/dev/raw/raw2 CANDIDATE System 256 0
/dev/raw/raw3 CANDIDATE System 256 0
9.创建磁盘组
idle>CREATE DISKGROUP TEST_ASM_DG NORMAL REDUNDANCY
2 FAILGROUP array1
3 DISK
4 '/dev/raw/raw1' NAME array1_disk1,
5 '/dev/raw/raw2' NAME array1_disk2
6 FAILGROUP array2
7 DISK
8 '/dev/raw/raw3' NAME array2_disk1,
9 '/dev/raw/raw4' NAME array2_disk2;
2 FAILGROUP array1
3 DISK
4 '/dev/raw/raw1' NAME array1_disk1,
5 '/dev/raw/raw2' NAME array1_disk2
6 FAILGROUP array2
7 DISK
8 '/dev/raw/raw3' NAME array2_disk1,
9 '/dev/raw/raw4' NAME array2_disk2;
Diskgroup created.
idle>col name for a30
idle>SELECT name, block_size, allocation_unit_size, state,
2 type, total_mb, usable_file_mb
3 FROM v$asm_diskgroup;
idle>SELECT name, block_size, allocation_unit_size, state,
2 type, total_mb, usable_file_mb
3 FROM v$asm_diskgroup;
NAME BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB USABLE_FILE_MB
------------------------------ ---------- -------------------- ----------- ------ ---------- --------------
TEST_ASM_DG 4096 1048576 MOUNTED NORMAL 1024 331
------------------------------ ---------- -------------------- ----------- ------ ---------- --------------
TEST_ASM_DG 4096 1048576 MOUNTED NORMAL 1024 331
idle>SELECT path, header_status, library, total_mb, free_mb FROM v$asm_disk;
PATH HEADER_STATU LIBRARY TOTAL_MB FREE_MB
------------------------------ ------------ -------------------- ---------- ----------
/dev/raw/raw4 MEMBER System 256 231
/dev/raw/raw3 MEMBER System 256 228
/dev/raw/raw2 MEMBER System 256 233
/dev/raw/raw1 MEMBER System 256 226
------------------------------ ------------ -------------------- ---------- ----------
/dev/raw/raw4 MEMBER System 256 231
/dev/raw/raw3 MEMBER System 256 228
/dev/raw/raw2 MEMBER System 256 233
/dev/raw/raw1 MEMBER System 256 226
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10972173/viewspace-684231/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10972173/viewspace-684231/
915

被折叠的 条评论
为什么被折叠?



