linux下ASM配置

sky850623發表於2015-09-03
1.ASMLib管理磁碟
1)ASMLib下載
http://www.oracle.com/technetwork/topics/linux/asmlib/index-101839.html
[root@ocp ~]# uname -r
2.6.9-78.EL
下載對應的核心版本進行安裝
[root@ocp asm]# ll
total 652
-rw-r--r--  1 root root 132372 Jul 12 12:58 oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm
-rw-r--r--  1 root root   2537 Jul 12 12:58 oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm
-rw-r--r--  1 root root 127733 Jul 12 12:58 oracleasm-2.6.9-78.ELhugemem-2.0.5-1.el4.i686.rpm
-rw-r--r--  1 root root 134679 Jul 12 12:58 oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
-rw-r--r--  1 root root 137437 Jul 12 12:58 oracleasm-2.6.9-78.ELxenU-2.0.5-1.el4.i686.rpm
-rw-r--r--  1 root root  13105 Jul 12 12:58 oracleasmlib-2.0.4-1.el4.i386.rpm
-rw-r--r--  1 root root  83636 Jul 12 12:58 oracleasm-support-2.1.7-1.el4.i386.rpm
[root@ocp asm]# rpm -ivh oracleasm-support-2.1.7-1.el4.i386.rpm 
warning: oracleasm-support-2.1.7-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]
[root@ocp asm]# rpm -ivh oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm 
warning: oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.9-78.EL-d########################################### [100%]
[root@ocp asm]# rpm -ivh oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm 
warning: oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.9-78.EL  ########################################### [100%]
[root@ocp asm]# rpm -ivh oracleasmlib-2.0.4-1.el4.i386.rpm 
warning: oracleasmlib-2.0.4-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1:oracleasmlib           ########################################### [100%]
2配置ASMLib
[root@ocp dev]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.
Default user to own the driver interface [oracle]: 
Default group to own the driver interface [dba]: 
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [OK]

3建立ASM磁碟
[root@ocp ~]# oracleasm createdisk vol1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@ocp ~]# oracleasm createdisk vol2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
檢視建立的磁碟
[root@ocp disks]# oracleasm listdisks
VOL1
VOL2
[root@ocp disks]# oracleasm-discover
Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
Discovered disk: ORCL:VOL1 [2088387 blocks (1069254144 bytes), maxio 256]
Discovered disk: ORCL:VOL2 [2088387 blocks (1069254144 bytes), maxio 256]

到這裡,所建立的磁碟可以被oracle所使用了.
接下來可以建立ASM例項,可以識別並使用這些磁碟,建立磁碟組.
建立ASM例項可以通過圖形介面,也可以使用手工方式來建立ASM例項。
4手工建立ASM例項
1)建立引數檔案
[oracle@ocp udump]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@ocp dbs]$ vi init+ASM.ora
*.asm_diskstring='ORCL:VOL*'
*.background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'
*.core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/u01/app/oracle/admin/+ASM/udump'
2)建立密碼檔案
[oracle@ocp dbs]$ orapwd file=orapw+ASM password=oracle
3)建立相應目錄
[oracle@ocp dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/udump
[oracle@ocp dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/bdump
[oracle@ocp dbs]$ mkdir -p /u01/app/oracle/admin/+ASM/cdump

4)切換到ASM例項,啟動例項
[oracle@ocp dbs]$ export ORACLE_SID=+ASM
[oracle@ocp dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 28 07:57:35 2015
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup
ORA-29701: unable to connect to Cluster Manager

出現錯誤,該錯誤是由於沒有新增CSS服務所致,所以下一步來新增CSS服務
5)新增CSS服務
使用root使用者新增
[root@ocp disks]# /u01/app/oracle/product/10.2.0/db_1/bin/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

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.
        ocp
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

6)重新啟動ASM
SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

7)檢視磁碟建立磁碟組
SQL> select total_mb,free_mb,name,group_number,disk_number from v$asm_disk;

  TOTAL_MB    FREE_MB NAME                           GROUP_NUMBER DISK_NUMBER
---------- ---------- ------------------------------ ------------ -----------
      1019          0                                           0           1
      1019          0                                           0           0

SQL> create diskgroup dg1 external redundancy disk 'ORCL:VOL1';
Diskgroup created.
SQL> select group_number,disk_number,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER PATH
------------ ----------- ------------------------------
           0           0 ORCL:VOL2
           2           0 ORCL:VOL1



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26937943/viewspace-1790216/,如需轉載,請註明出處,否則將追究法律責任。

相關文章