單機環境安裝配置ASM例項

shuyingxi發表於2013-03-12
ASM是oracle針對rac釋出的儲存產品,雖然是針對叢集環境設定的,在單機環境上我們也可以採用ASM例項來管理磁碟。

(一)安裝配置
一、確認linux核心版本
[root@sigleNode ~]# uname -r
2.6.18-53.el5xen
需要根據上面核心版本去oracle官網上下載指定的ASMLib包,連結地址
<

下載的具體包如下:
kernel-debug-2.6.18-53.el5.i686.rpm
kernel-PAE-2.6.18-53.el5.i686.rpm
oracleasm-2.6.18-53.el5-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-53.el5debug-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-53.el5PAE-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-53.el5xen-2.0.4-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.0.4-1.el5.i386.rpm
其中前兩個包在oracle官網上是下載不到的,需要在csdn上下載,也可以聯絡我

二、安裝asmlib包
[root@sigleNodeasm]# rpm -ivh *.rpm

三、新增兩塊硬碟,然後分割槽,不需要格式化
[root@sigleNodedev]# fdisk /dev/hda

Command (m for help):n

Command action

 e extended

 p primary partition (1-4)

p

Partition number (1-4):1           

First cylinder (1-261, default 1):1 

Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):261

 

Command (m for help):w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

執行同樣命令對/dev/hdb進行分割槽即可
分割槽之後的結果如下:
[root@sigleNode ~]# fdisk -l
 
Disk /dev/hda: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
 
  Device Boot     Start        End     Blocks  Id System
/dev/hda1              1       4161    2097112+ 83 Linux
 
Disk /dev/hdb: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
 
  Device Boot     Start        End     Blocks  Id System
/dev/hdb1              1       4161    2097112+ 83 Linux
四、配置ASM環境
[root@sigleNode~]# /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 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]:

Scan for Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver:                   [ OK ]

Scanning the system for Oracle ASMLib disks:             [ OK ]

五、新增磁碟
[root@sigleNodeasm]# /etc/init.d/oracleasm createdisk VOL1 /dev/ hda1

Marking disk "VOL1" as an ASM disk:                      [ OK ]

[root@sigleNodeasm]# /etc/init.d/oracleasm createdisk VOL2 /dev/ hdb1

Marking disk "VOL2" as an ASM disk:                      [ OK ]

可以透過以下命令查詢已經新增的ASM磁碟
[root@sigleNode ~]# /etc/init.d/oracleasm listdisks;
VOL1
VOL2
(二)建立ASM例項
oracle10g中建立ASM例項和資料庫都可以採用DBCA,這在一定程度上隱藏了相關細節,下面採用手工建立ASM例項,其實和手工建立資料庫大體類似建立引數檔案,密碼檔案,dump路徑
1、建立引數檔案
[oracle@singleNode db_1]$ vi $ORACLE_HOME/dbs/init+ASM.ora

*.asm_diskstring='ORCL:VOL*'

*.background_dump_dest='/opt/ora10g/admin/+ASM/bdump'

*.core_dump_dest='/opt/ora10g/admin/+ASM/cdump'

*.instance_type='asm'

*.large_pool_size=24M

*.remote_login_passwordfile='SHARED'

*.user_dump_dest='/opt/ora10g/admin/+ASM/udump'

儲存修改
2、建立dump目錄
[oracle@ singleNode ~]$ mkdir -p $ORACLE_BASE/admin/+ASM/udump

[oracle@ singleNode ~]$ mkdir -p $ORACLE_BASE /admin/+ASM/bdump

[oracle@ singleNode ~]$ mkdir -p $ORACLE_BASE g/admin/+ASM/cdump

3、建立密碼檔案
[oracle@localhost ~]$ orapwd file=orapw+ASM password=asm

4、啟動ASM例項
[oracle@sigleNode ~]$ export ORACLE_SID=+ASM
[oracle@sigleNode ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 18 06:38:08 2013
 
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配置之後啟動ASM例項
[oracle@sigleNode ~]$ localconfig add
You must be logged in as root to run /u01/app/oracle/product/10.2.0.1/bin/localconfig.
Log in as root and restart /u01/app/oracle/product/10.2.0.1/bin/localconfig execution.
系統提示必須以root使用者執行localconfig命令
[oracle@sigleNode ~]$ su -
Password:
[root@sigleNode ~]# /u01/app/oracle/product/10.2.0.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.
       siglenode
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
CSS配置完畢,再次啟動ASM例項
[oracle@sigleNode ~]$ su -
Password:
[root@sigleNode ~]# su - oracle
[oracle@sigleNode ~]$ export ORACLE_SID=+ASM
[oracle@sigleNode ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 18 06:42:03 2013
 
Copyright (c) 1982, 2005, Oracle. All rights reserved.
 
Connected to an idle instance.
 
SQL> startup
ASM instance started
 
Total System Global Area  96468992 bytes
Fixed Size                 1217908 bytes
Variable Size             70085260 bytes
ASM Cache                 25165824 bytes
ORA-15110: no diskgroups mounted

提示沒有磁碟組需要載入
首先我們建立一下磁碟組
SQL> create diskgroup oradg1 external redundancy disk ‘ORCL:VOL1’;
SQL>diskGroup created
可以向現有磁碟組中增加磁碟
SQL> alter diskgroup oradg1 add disk ‘ORCL:VOL2’;
SQL>diskGroup altered
設定磁碟組oradg1為ASM例項預設載入的磁碟組
我們一開始沒有建立spfile,所以需要建立一下
SQL>create spfile from pfile;
SQL> alter system set asm_diskgroups=oradg1 scope=spfile;
System altered.
SQL> shutdown
關閉ASM例項之後重新啟動
SQL> startup
ASM instance started
 
Total System Global Area  96468992 bytes
Fixed Size                 1217908 bytes
Variable Size             70085260 bytes
ASM Cache                 25165824 bytes
ASM diskgroups mounted
 
發現磁碟組已經載入成功,ASM例項成功建立並啟動成功

轉自:http://space.itpub.net/?uid-7483882-action-viewspace-itemid-755700

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

相關文章