oracle11g
在 oracle11g 中,配置 asm 实例会用到 raw (裸设备)或者 asmlib 或者直接使用磁盘分区(这个特性也是 11g 的特性)。由于 oracle11g 中,已经将 asm 和数据库完全脱离,这句话的意思就是以前在 10g 的时候, asm 实例是在安装 oracle 软件之后,才配置实
在oracle11g中,配置asm实例会用到raw(裸设备)或者asmlib或者直接使用磁盘分区(这个特性也是11g的特性)。由于oracle11g中,已经将asm和数据库完全脱离,这句话的意思就是以前在10g的时候,asm实例是在安装oracle软件之后,才配置实例(借助dbca),而在oracle11g中,asm实例已经由grid单独安装来配置了,也是11g中的第一大特性。
Linux 5下的操作:
1) 使用raw设备
在创建3个分区 sda8,sda9,sda10之后,start_udev (具体如何在linux5下创建raw,在此不介绍),从而有了3个raw,即 /dev/raw/raw1 /dev/raw/raw2 /dev/raw/raw3
2) 使用asmlib
在创建了3个分区之后,可以使用如下命令,创建3个asmdisk:
#/etc/init.d/oracleasm createdisk asmdisk01 /dev/sda8
#/etc/init.d/oracleasm createdisk asmdisk02 /dev/sda9
#/etc/init.d/oracleasm createdisk asmdisk03 /dev/sda10
查看asmdisk:
#/etc/init.d/oracleasm listdisks
ASMDISK01
ASMDISK02
ASMDISK03
3) 直接使用磁盘分区,由于这个比较简单,只需要安装grid时,测试一下即可。
如上,现在已经建好了两种方式下的asm可用disk,现在安装grid的过程中,可能由于磁盘组的问题,最终导致没有安装成功,但crs已经没有问题了,如下:
[grid@yanfa2 dbs]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE yanfa2
ora.cssd ora.cssd.type 0/5 0/5 ONLINE ONLINE yanfa2
ora.diskmon ora....on.type 0/10 0/5 ONLINE ONLINE yanfa2
但asm实例确不能启动,错误信息如下:
SQL> startup
ORA-00099: warning: no parameter file specified for ASM instance
ASM instance started
Total System Global Area 283930624 bytes
Fixed Size 2212656 bytes
Variable Size 256552144 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
此时有两个问题,第一个就是没有asm实例启动需要的参数文件,目前使用的默认值,还有第二个问题就是没有diskgroup,用asmcmd也可以查看到,目前实例是没有diskgroup的。
解决办法就是用创建diskgroup,可以用asmca,打开页面之后,能看到6块disk,其中3块是/dev/raw/raw* 格式的,另3块是 ORCL:ASMDISK0* 格式的,如果此时选择ORCL:这样的disk,那么此diskgroup是不会创建成功的,换成用/dev/raw/raw* 的,create asm时就可以成功了。然后在实例起来之后,也可以用命令创建另一个diskgroup,如下:
CREATE DISKGROUP fra EXTERNAL REDUNDANCY DISK 'ORCL:ASMDISK03';
CREATE DISKGROUP fra EXTERNAL REDUNDANCY DISK 'ORCL:ASMDISK03'
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15072: command requires at least 1 failure groups, discovered only 0
此时,再查看以下信息:
SQL> create diskgroup fra external redundancy disk '/dev/raw/raw3';
Diskgroup created.
SQL> select PATH, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE from V$ASM_DISK;
PATH
--------------------------------------------------------------------------------
MOUNT_S HEADER_STATU MODE_ST STATE
------- ------------ ------- --------
ORCL:ASMDISK03
CLOSED UNKNOWN ONLINE NORMAL
ORCL:ASMDISK01
CLOSED UNKNOWN ONLINE NORMAL
ORCL:ASMDISK02
CLOSED UNKNOWN ONLINE NORMAL
PATH
--------------------------------------------------------------------------------
MOUNT_S HEADER_STATU MODE_ST STATE
------- ------------ ------- --------
/dev/raw/raw2
CACHED MEMBER ONLINE NORMAL
/dev/raw/raw1
CACHED MEMBER ONLINE NORMAL
/dev/raw/raw3
CACHED MEMBER ONLINE NORMAL
6 rows selected.
可以看出,一旦使用/dev/raw/raw* 的disk是可以创建成功的,再来看下ORCL:ASMDISK0* 的header_status的状态为 UNKNOWN。根据metalink上的一篇文章【ID 396015.1】,如下:
Applies to:
Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 10.2.0.4 - Release: to 10.2
Information in this document applies to any platform.
Symptoms
When a diskgroup with external redundancy needs to be created on a NetApps with iSCSI following errors might occur:
CREATE DISKGROUP KNVB EXTERNAL
REDUNDANCY DISK 'ORCL:DISK1';
CREATE DISKGROUP KNVB EXTERNAL REDUNDANCY DISK 'ORCL:DISK1'
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15072: command requires at least 1 failure groups, discovered only 0
Error message from bdump alert log file
=======================================
...
Wed Oct 18 15:45:46 2006
ORA-15186: ASMLIB error function = [asm_open], error = [1], mesg = [Operation not permitted]
Wed Oct 18 15:45:46 2006
ORA-15186: ASMLIB error function = [asm_open], error = [1], mesg = [Operation not permitted]
The disk HEADER_STATUS from V$ASM_DISK is UNKNOWN instead of CANDIDATE or PROVISIONED
Cause
Oracleasm is able to create and stamp the ASM disk, because the soft link from the mapper,
but the ASM instance cannot see the disks (HEADER_STATUS is UKNOWN instead of PROVISONED) as the soft links were mounted in /etc/fstab as /data/...
If NetApp is used, then the /etc/fstab file should be checked.
The disks stammped by oracleasm should not be present in this file.
If EMC based storage but use the normal Linux multipath driver is used, then the following map settings should be set in /etc/sysconfig/oracleasm
# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER="multipath sd"
# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan ORACLEASM_SCANEXCLUDE="sd"
Solution
1. If the customer is using NetApp check the /etc/fstab file for any mount points including the NetApp disks
E.g: umount /data/....
Connect to the ASM instance
conn / as sysdba
select PATH, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE from V$ASM_DISK;
You should see the HEADER_STATUS as PROVISIONED instead of UNKNOWN.
Now you can create the diskgroup with external redundancy
Eg:CREATE DISKGROUP KNVB EXTERNAL REDUNDANCY DISK 'ORCL:DISK1';
2. If EMC based storage but use the normal Linux multipath driver is used, then please make the following changes in the /etc/sysconfig/oracleasm file.
# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER="multipath sd"
# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan ORACLEASM_SCANEXCLUDE="sd"
Note that the asm_diskstring should be set to "ORCL:*"
以上信息为文章内容,根据提示,可以将 /etc/sysconfig/oracleasm修改下,并且我在asm的$ORACLE_HOME/dbs 下创建了一个参数文件 init+ASM.ora ,内容只有
*.asm_diskgroups = ‘DATA’
*.asm_diskstring = ‘ORCL:*’
经过如上修改,在restart oracleasm之后,asm终于正常了。
SQL> ALTER DISkgroup fra mount;
Diskgroup altered.
SQL> select PATH, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE from V$ASM_DISK;
PATH
--------------------------------------------------------------------------------
MOUNT_S HEADER_STATU MODE_ST STATE
------- ------------ ------- --------
ORCL:ASMDISK01
CACHED MEMBER ONLINE NORMAL
ORCL:ASMDISK02
CACHED MEMBER ONLINE NORMAL
ORCL:ASMDISK03
CACHED MEMBER ONLINE NORMAL