解决ASM无法启动问题
启动报错如下所示
rac2-> sqlplus /as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sun May 11 20:32:57 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DG1/devdb/spfiledevdb.ora'
ORA-17503: ksfdopn:2 Failed to open file +DG1/devdb/spfiledevdb.ora
ORA-15077: could not locate ASM instance serving a required diskgroup
SQL> exit
Disconnected
--检查ASM实例运行情况
rac2-> srvctl status asm -n rac1
ASM 实例 +ASM1 正在节点 rac1 上运行。
rac2-> srvctl status asm -n rac2
ASM 实例 +ASM2 不在节点 rac2 上运行。
--可以看出,在节点2(也就是出问题的节点)上ASM实例并没有启动
--接着检查ASM磁盘组
[root@rac2 ~]# /etc/init.d/oracleasm listdisks
没有结果输出表示ASM磁盘组没有加载,之前配置ASM的时候已经配置了自动加载ASM,可能是因为其他原因没有加载成功.下面手工加载:
[root@rac2 ~]# /etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
root@rac2 ~]#service oracleasm enable
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: done
Scanning the system for Oracle ASMLib disks:
root@rac2 ~]#/etc/init.d # oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
--再查看ASM磁盘组信息:
[root@rac2 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
--可以看出,ASM磁盘组加载好了.
--下面要做的是启动ASM实例
rac2-> export ORACLE_SID=+ASM2
rac2-> sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sun May 11 20:36:18 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 92274688 bytes
Fixed Size 1217884 bytes
Variable Size 65890980 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters and Data Mining options
--启动数据库
rac2-> export ORACLE_SID=devdb2
rac2-> sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sun May 11 20:39:57 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 188743680 bytes
Fixed Size 1218436 bytes
Variable Size 83888252 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
至此,实例启动完毕.
首先创建磁盘(如果是虚拟机,通过添加hard disk 文件加磁盘)
[需要停虚拟机,将盘添加到第二个节点]
[root@node1 ~]#fdisk /dev/sdf
输入以下:n/p/1/enter/enter
node1上初始化ASM盘
[root@node1 ~]#/etc/init.d/oracleasm createdisk NOVA3 /dev/sdf1
node2 上扫描并列盘
[root@node2 ~]#/etc/init.d/oracleasm scandisks
[root@node2 ~]# /etc/init.d/oracleasm listdisks
NOVA1
NOVA2
NOVA3
登录node1添加磁盘
[root@node1 ~]#su – oracle
[root@node1 ~]#ORACLE_SID=+ASM1
[root@node1 ~]#sqlplus / as sysdba
SQL>alter diskgroup RAC_DISK add disk ‘ORCL:NOVA3′ name test_asmdisk;
登录node2测试
SQL> select path from v$asm_disk;
PATH
——————————————————————————–
ORCL:NOVA3
/dev/raw/raw2
/dev/raw/raw1
ORCL:NOVA1
ORCL:NOVA2
/dev/raw/raw3
/dev/raw/raw4
SQL> select NAME,ALLOCATION_UNIT_SIZE,TOTAL_MB from v$asm_diskgroup;
NAME ALLOCATION_UNIT_SIZE TOTAL_MB
—————————— ——————– ———-
RAC_DISK 1048576 8180
在node1上执行,ASM上创建一个表空间
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Fri May 8 17:19:58 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> create tablespace nova_test datafile ‘+RAC_DISK’ size 200M;
Tablespace created.
SQL> create user nova identified by nova default tablespace nova_test;
User created.
SQL> grant dba to nova;
Grant succeeded.
SQL> conn nova/nova;
Connected.
SQL> create table t_test as select * from dba_objects;
Table created.
SQL> select count(*) from t_test;
COUNT(*)
———-
50029
SQL>
登录node2上执行,做一下测试。
[oracle@node2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Fri May 8 17:24:00 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> conn nova/nova
Connected.
SQL> select count(*)from t_test;
COUNT(*)
———-
50029
SQL>
其他命令操作
alter diskgroup dgroup1 add failgroup fgroup1 disk ‘ORCL:NOVA3′ failgroup fgroup2 disk ‘ORCL:VOL6′;
自动平衡的工作进度
desc v$asm_operation
select * from v$asm_operation;
查询ASM磁盘组对应关系
select label,failgroup from v$asm_disk;
查看磁盘组的名称和状态
SQL> select state,header_status,substr(name,1,12) Name,free_mb,substr(path,1,16) PATH from v$asm_disk;STATE HEADER_STATU NAME FREE_MB PATH
——– ———— ———— ———- —————-
NORMAL FOREIGN 0 /dev/raw/raw2
NORMAL FOREIGN 0 /dev/raw/raw1
NORMAL UNKNOWN 0 ORCL:NOVA1
NORMAL UNKNOWN 0 ORCL:NOVA2
NORMAL MEMBER RAC_DISK_000 2496 /dev/raw/raw3
NORMAL MEMBER RAC_DISK_000 3334 /dev/raw/raw4
NORMAL MEMBER TEST_ASMDISK 826 ORCL:NOVA3
查看ASM磁盘管理均衡情况
SQL>select operation,state,power,actual,sofar,est_work,est_minutes from v$asm_operation;
登入到ASM的实例,删除磁盘组中VOL4磁盘
alter diskgroup RAC_DISK drop disk NOVA3;
强制让ASM自动平衡
alter diskgroup RAC_DISK rebalance;
加入故障盘到磁盘组
alter diskgroup dgroup1 add failgroup fgroup1 disk ‘ORCL:NOVA3′ failgroup fgroup2 disk ‘ORCL:NOVA4′;