oracle10g中的asm的配置(轉)

ba發表於2007-08-16
oracle10g中的asm的配置(轉)[@more@]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=
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;

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

相關文章