解決ASM無法啓動問題

解決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.

至此,實例啓動完畢.

ASM 管理命令和操作筆記

首先創建磁盤(如果是虛擬機,通過添加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′;

 

發佈了77 篇原創文章 · 獲贊 5 · 訪問量 38萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章