oracle10g中的asm的配置
asm的使用
ASM ( Automatic Storage Management)
一安装和配置
rpm -Uvh oracleasm-support-1.0.2-1.i386.rpm \
oracleasm-lib-1.0.0-1.i386.rpm \
oracleasm-2.4.21-EL-1.0.0-1.i686.rpm (相应的kernel)
/etc/init.d/oracleasm configure
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) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration [ OK ]
Creating /dev/oracleasm mount point [ OK ]
Loading module "oracleasm" [ OK ]
Mounting ASMlib driver filesystem [ OK ]
Scanning system for ASM disks [ OK ]
二创建ASM 磁盘(asm只是正对分区)
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd" as an ASM disk [ OK ]
#/etc/init.d/oracleasm createdisk VOL4 /dev/sde1
Marking disk "/dev/sde" as an ASM disk [ OK ]
#/etc/init.d/oracleasm listdisks
如果要删除ASM 磁盘通过以下命令:
# /etc/init.d/oracleasm deletedisk VOL4
Removing ASM disk "VOL4" [ OK ]
注意:如果是在RAC 环境中的某一个节点中添加了ASM 磁盘,那么需要在其它的节点上
运行scandisk 来获取这种变化。
# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks [ OK ]
三创建asm磁盘组
su – oracle
export ORACLE_SID=+ASM
sqlplus / as sysdba
SQL> create diskgroup dgroup1 normal redundancy (EXTERNAL REDUNDANCY)
2 failgroup fgroup1 disk 'ORCL:VOL1','ORCL:VOL2'
3 failgroup fgroup2 disk 'ORCL:VOL3','ORCL:VOL4';
Diskgroup created.
SQL> select name,state from v$asm_diskgroup;
SQL> ALTER DISKGROUP dgroup1 MOUNT;
SQL> show parameter asm_diskgroups
SQL>ALTER DISKGROUP ALL DISMOUNT;
SQL>ALTER DISKGROUP ALL SMOUNT;
四增加一个ASM卷
#/etc/init.d/oracleasm createdisk VOL5 /dev/sdf1
#/etc/init.d/oracleasm createdisk VOL6 /dev/sdg1
export ORACLE_SID=+ASM
sqlplus / as sysdba
SQL> ALTER DISKGROUP DGROUP1 ADD
FAILGROUP FGROUP1 DISK 'ORCL:VOL5'
FAILGROUP FGROUP2 DISK 'ORCL:VOL6' rebalance power 11 ;
注:Oracle通过一个新增的参数:asm_power_limit 来控制速度。
该参数取值范围为1~11,参数值越大平衡速度越快。
检查数据库的auto rebalance 工作进度,数据库正在将原来分布在两个磁盘上的数据平均分配到三个磁盘上
SQL> SELECT group_number, operation, state, est_work, sofar, est_rate, est_minutes FROM v$asm_operation;
五ASM数据库的启动顺序
1.以oracle 用户进入操作系统
2. $ export ORACLE_SID=+ASM
3. SQL> sqlplus / as sysdba
4. SQL> startup
5. SQL> exit
6. $ export ORACLE_SID=<your_real_db_sid>
7. SQL> sqlplus / as sysdba
8. SQL> startup
六创建一个自己的表空间,创建一个用户,创建一个表
SQL> create tablespace ts_test datafile '+DGROUP1' size 200M;
SQL> create user kamus identified by pass default tablespace ts_test;
SQL> grant dba to kamus;
SQL> create table t_test as select * from dba_objects;
七登入ASM 实例,将磁盘从磁盘组中删除
export ORACLE_SID=+ASM
sqlplus / as sysdba
SQL> alter diskgroup dgroup1 drop disk VOL4;
SQL>select group_number, operation, state, est_work, sofar, est_rate,est_minutes FROM v$asm_operation;
SQL>select name,allocation_unit_size,total_mb from v$asm_diskgroup;
SQL> select label,failgroup from v$asm_disk;
SQL> SELECT disk_number, label FROM V$asm_disk;
注.对于oracle中AMS的spfile文件和数据实例的spfile文件是不同的
获取方法:
export ORACLE_SID=+ASM
sqlplus /as sysdba
sql> CREATE PFILE='/oraback/spfile+ASM.ora' FROM SPFILE;
export ORACLE_SID=orcl
sqlplus /as sysdba
sql> CREATE PFILE='/oraback/spfile.ora' FROM SPFILE;