Oracle 10g RAC (linux) ASM 共享存储的管理详解

---------ASM 的管理(共享磁盘的管理)
1、以 instance 的方式管理 ASM,启动 database 之前必须先启动 ASM instance,ASM instance 启动后,挂载 ASM 磁盘组。


---------安装 ASM 管理软件、驱动
1、查看操作系统内核版本(OS Kernel 版本)
[root@rac11 ~]# uname -a
Linux rac11 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:58:04 EST 2007 i686 i686 i386 GNU/Linux
2、查看OS上是否安装ASM相关的软件
[root@rac01 ~]# rpm -qa |grep asm
oracleasm-2.6.9-67.EL-2.0.3-1(注意和os kernel 版本一致)
oracleasmlib-2.0.4-1.el4
oracleasm-support-2.1.4-1.el4
安装ASM软件包
[root@rac22 asm]# rpm -Uvh oracleasm-support-2.1.4-1.el4.i386.rpm


[root@rac22 asm]# rpm -Uvh oracleasm-2.6.9-67.EL-2.0.3-1.i686.rpm


[root@rac22 asm]# rpm -Uvh oracleasmlib-2.0.4-1.el4.i386.rpm


[root@rac22 asm]# rpm -Uvh oracleasm-2.6.9-67.ELsmp-2.0.3-1.i686.rpm


[root@rac11 ~]# service oracleasm
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}


[root@rac22 asm]# service oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[root@rac22 asm]# service oracleasm enable
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [  OK  ]
[root@rac22 asm]# service oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@rac11 ~]# chkconfig oracleasm on




----------查看 ASM instance 初始化参数文件
 
[oracle@rac22 dbs]$ cat init+ASM2.ora | grep -v '^#' 


cluster_database=true
 
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
 
instance_type=asm
 
large_pool_size=12M
 
remote_login_passwordfile=exclusive
 
asm_diskgroups='DATA1','FRA'
 
 
+ASM2.instance_number=2
+ASM1.instance_number=1




-----------访问 ASM instance
[oracle@rac22 dbs]$ export ORACLE_SID=+ASM2
[oracle@rac22 dbs]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 16 09:43:35 2012


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> 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      +ASM2
lock_name_space                      string
log_file_name_convert                string
service_names                        string      +ASM


------------关闭 ASM instance 之前必须先关掉数据库
SQL> shutdown immediate
ORA-15097: cannot SHUTDOWN ASM instance with connected RDBMS instance
------------关闭 Database 之后再尝试关闭 ASM instance
[root@rac11 ~]# srvctl stop database -d prod
[oracle@rac11 dbs]$ srvctl status database -d prod
Instance PROD1 is not running on node rac11
Instance PROD2 is not running on node rac22
------------关闭 ASM instance
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
-------------启动 ASM 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> desc v$asm_diskgroup;
 Name                                                              Null?    Type
 ----------------------------------------------------------------- -------- --------------------------------------------
 GROUP_NUMBER                                                               NUMBER
 NAME                                                                       VARCHAR2(30)
 SECTOR_SIZE                                                                NUMBER
 BLOCK_SIZE                                                                 NUMBER
 ALLOCATION_UNIT_SIZE                                                       NUMBER
 STATE                                                                      VARCHAR2(11)
 TYPE                                                                       VARCHAR2(6)
 TOTAL_MB                                                                   NUMBER
 FREE_MB                                                                    NUMBER
 REQUIRED_MIRROR_FREE_MB                                                    NUMBER
 USABLE_FILE_MB                                                             NUMBER
 OFFLINE_DISKS                                                              NUMBER
 UNBALANCED                                                                 VARCHAR2(1)
 COMPATIBILITY                                                              VARCHAR2(60)
 DATABASE_COMPATIBILITY                                                     VARCHAR2(60)


 -----------查看 ASM disk group
 SQL> select GROUP_NUMBER,NAME,STATE,TYPE,TOTAL_MB,FREE_MB,OFFLINE_DISKS from v$asm_diskgroup;


GROUP_NUMBER NAME                 STATE       TYPE     TOTAL_MB    FREE_MB OFFLINE_DISKS
------------ -------------------- ----------- ------ ---------- ---------- -------------
           1 DATA1                MOUNTED     EXTERN       1504         24             0

           2 FRA                  MOUNTED     EXTERN       1504        960             0

posted @ 2014-04-02 14:31  凡轩之  阅读(1459)  评论(0编辑  收藏  举报