ASM管理与维护
1、登陆ASM实例
如果以sysdba身份登陆asm实例进行维护,在执行一些操作的时候会遇到如下错误:
node1-> sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 13 11:21:49 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Real Application Clusters and Automatic Storage Management options SQL> desc v$asm_diskgroup; Name Null? Type ----------------------------------------- -------- ---------------------------- GROUP_NUMBER NUMBER NAME VARCHAR2(30) SECTOR_SIZE NUMBER BLOCK_SIZE NUMBER ALLOCATION_UNIT_SIZE NUMBER STATE VARCHAR2(11) TYPE VARCHAR2(6) TOTAL_MB NUMBER FREE_MB NUMBER HOT_USED_MB NUMBER COLD_USED_MB NUMBER REQUIRED_MIRROR_FREE_MB NUMBER USABLE_FILE_MB NUMBER OFFLINE_DISKS NUMBER COMPATIBILITY VARCHAR2(60) DATABASE_COMPATIBILITY VARCHAR2(60) VOTING_FILES VARCHAR2(1) SQL> col name for a30 SQL>select name,state from v$asm_diskgroup NAME STATE ------------------------------ --------------------------------- OCR_VOTE MOUNTED DG1 DISMOUNTED FRA1 DISMOUNTED HIGH_DG1 DISMOUNTED NORMAL_DG1 DISMOUNTED SQL> alter diskgroup dg1 mount; alter diskgroup dg1 mount * ERROR at line 1: ORA-15032: not all alterations performed ORA-15260: permission denied on ASM disk group
究其原因在于sysdba身份权限不足,需要以sysasm身份进行登陆
SQL> conn / as sysasm Connected.
此时再执行相关的维护操作即可
SQL> alter diskgroup dg1 mount; Diskgroup altered. SQL> alter diskgroup fra1 mount; Diskgroup altered. SQL> alter diskgroup high_dg1 mount; Diskgroup altered. SQL> alter diskgroup normal_dg1 mount; Diskgroup altered. SQL> select name,state from v$asm_diskgroup; NAME STATE ------------------------------ --------------------------------- OCR_VOTE MOUNTED DG1 MOUNTED FRA1 MOUNTED HIGH_DG1 MOUNTED NORMAL_DG1 MOUNTED SQL>
创建ASM磁盘
/etc/init.d/oracleasm createdisk asm_disk_lv1 /dev/sdb1 /etc/init.d/oracleasm createdisk asm_disk_lv2 /dev/sdb2 /etc/init.d/oracleasm createdisk asm_disk_lv3 /dev/sdb3 /etc/init.d/oracleasm createdisk asm_disk_lv4 /dev/sdc1 /etc/init.d/oracleasm createdisk asm_disk_lv5 /dev/sdd1 /etc/init.d/oracleasm createdisk asm_disk_lv6 /dev/sde1 /etc/init.d/oracleasm createdisk asm_disk_lv7 /dev/sdc2 /etc/init.d/oracleasm createdisk asm_disk_lv8 /dev/sdd2 /etc/init.d/oracleasm createdisk asm_disk_lv9 /dev/sde2 /etc/init.d/oracleasm createdisk asm_disk_lv7 /dev/sdc2 /etc/init.d/oracleasm createdisk asm_disk_lv8 /dev/sdd2 /etc/init.d/oracleasm createdisk asm_disk_lv9 /dev/sde2 /etc/init.d/oracleasm createdisk asm_disk_lv10 /dev/sdc3 /etc/init.d/oracleasm createdisk asm_disk_lv11 /dev/sdd3 /etc/init.d/oracleasm createdisk asm_disk_lv12 /dev/sde3
扫描ASM磁盘
/etc/init.d/oracleasm scandisks
查看ASM磁盘
/etc/init.d/oracleasm listdisks
查看ASM日志
tail -f /var/log/oracleasm