在Oracle10g 新增ASM磁碟組

paulyibinyi發表於2008-06-23

首先在虛擬機器上 新增個硬碟1G 啟動後對其進行分割槽 每個200M

[root@rac1 ~]# fdisk /dev/sdb
我把它分成了五個200M的擴充套件分割槽:
/dev/sdb5
/dev/sdb6
/dev/sdb7
/dev/sdb8
/dev/sdb9
[root@rac1 ~]# vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdf5
/dev/raw/raw2 /dev/sdf6
/dev/raw/raw3 /dev/sdf7
/dev/raw/raw4 /dev/sdf8
/dev/raw/raw5 /dev/sdf9

[root@rac1 ~]# service rawdevices restart


[root@rac1 ~]# chown oracle:dba /dev/raw/raw[1-5]
[root@rac1 ~]# chmod 660 /dev/raw/raw[1-5]
[root@rac1 ~]# ls -lat /dev/raw/raw*
crw-rw----  1 oracle dba 162, 5 Apr 17 10:57 /dev/raw/raw5
crw-rw----  1 oracle dba 162, 4 Apr 17 10:57 /dev/raw/raw4
crw-rw----  1 oracle dba 162, 3 Apr 17 10:57 /dev/raw/raw3
crw-rw----  1 oracle dba 162, 2 Apr 17 10:57 /dev/raw/raw2
crw-rw----  1 oracle dba 162, 1 Apr 17 10:57 /dev/raw/raw1
修改 /etc/udev/permissions.d/50-udev.permissions,使oracle能操作裸裝置
[root@rac1 ~]# vi /etc/udev/permissions.d/50-udev.permissions
# raw devices
ram*:root:disk:0660
#raw/*:root:disk:0660
raw/*:oracle:dba:0660
[root@rac1 ~]# service rawdevices restart
Assigning devices:
           /dev/raw/raw1  --&gt   /dev/sdb5
/dev/raw/raw1:  bound to major 8, minor 133
           /dev/raw/raw2  --&gt   /dev/sdb6
/dev/raw/raw2:  bound to major 8, minor 134
           /dev/raw/raw3  --&gt   /dev/sdb7
/dev/raw/raw3:  bound to major 8, minor 135
           /dev/raw/raw4  --&gt   /dev/sdb8
/dev/raw/raw4:  bound to major 8, minor 136
           /dev/raw/raw5  --&gt   /dev/sdb9
/dev/raw/raw5:  bound to major 8, minor 137

建立裸裝置完成後 用oracle使用者登入先啟動asm例項,後啟動資料庫

[oracle@d10031 ~]$ export ORACLE_SID=+ASM
[oracle@d10031 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 23 16:20:11 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 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, OLAP and Data Mining options
[oracle@d10031 ~]$ export ORACLE_SID=ORCL
[oracle@d10031 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 23 16:20:28 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              62916852 bytes
Database Buffers          100663296 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

[oracle@d10031 ~]$ export ORACLE_SID=+ASM
[oracle@d10031 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 23 16:21:51 2008

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, OLAP and Data Mining options

SQL>alter system set  asm_diskstring='ORCL:VOL*',' /dev/raw/raw*';

System altered.

SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
/dev/raw/raw4
/dev/raw/raw5
ORCL:VOL1
ORCL:VOL2
ORCL:VOL3
ORCL:VOL4

9 rows selected.

SQL> show parameter string;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring                       string      ORCL:VOL*, /dev/raw/raw*

SQL> create diskgroup testdg external redundancy disk '/dev/raw/raw1';

Diskgroup created.

SQL> select group_number,name,state,total_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE         TOTAL_MB
------------ ------------------------------ ----------- ----------
           1 DGROUP1                        MOUNTED           8188
           2 TESTDG                         MOUNTED            196

紅色就是新增加的磁碟組

 

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

相關文章