WEB开发网
开发学院数据库Oracle Oracle RAC系列ASM基本操作维护 阅读

Oracle RAC系列ASM基本操作维护

 2012-08-23 10:37:30 来源:WEB开发网   
核心提示:Cleaning up Network socket directoriesSetting up Network socket directories Adding to inittab Startup will be queued to init within 30 seconds.Checking the stat
Cleaning up Network socket directories
Setting up Network socket directories
 Adding to inittab 
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
 Cluster Synchronization Services is active on these nodes. 
     node1
Cluster Synchronization Services is active on all the nodes. 
Oracle CSS service is installed and running under init(1M)
然后启动ASM实例:
[oracle@node1 ~]$export ORACLE_SID=+ASM 
[oracle@node1 ~]$sqlplus / as sysdba 
SQL> startup
ASM instance started
Total System Global Area   134217728 bytes
Fixed Size           1218124 bytes
Variable Size        107833780 bytes
ASM Cache           25165824 bytes
ORA-15110: no diskgroups mounted 
因为首次启动ASM实例并没有创建ASM磁盘组,所以显示 15110错误是正常的。 
3.管理ASM磁盘组
 ASM磁盘组是作为逻辑单元进行统一管理的一组磁盘,在ASM实例中,可以创建和添加新的磁盘组,可以修改现有的磁盘组,在其中添加一个磁盘或者删除一个磁盘,也可以删除现有的磁盘组。
(1)添加磁盘组
SQL> create diskgroup FLASH_DISK external redundancy disk '/dev/oracleasm/disks/ASMDISK1' name flashdisk;
Diskgroup created.
SQL> create diskgroup ARCH_DISK external redundancy disk '/dev/oracleasm/disks/ASMDISK2' name archdisk1;
Diskgroup created.
SQL> create diskgroup DATA_DISK normal redundancy disk '/dev/oracleasm/disks/ASMDISK4' name datadisk1, '/dev/oracleasm/disks/ASMDISK5' name datadisk2;
Diskgroup created.
(2)查看磁盘组状态
SQL> select name,state from v$asm_diskgroup;
NAME              STATE
-------------------     --------------
FLASH_DISK          MOUNTED
ARCH_DISK          MOUNTED
DATA_DISK         MOUNTED
(3)卸载FLASH_DISK磁盘组
SQL> alter diskgroup FLASH_DISK dismount;
Diskgroup altered.
SQL> select name,state from v$asm_diskgroup;
NAME        STATE
---------------------------  -----------
FLASH_DISK     DISMOUNTED
ARCH_DISK      MOUNTED
DATA_DISK      MOUNTED
(4)挂载FLASH_DISK磁盘组
SQL> alter diskgroup  FLASH_DISK mount;
Diskgroup altered.
SQL> select name,state from v$asm_diskgroup;
NAME         STATE
------------------------------  -----------
FLASH_DISK    MOUNTED
ARCH_DISK     MOUNTED
DATA_DISK    MOUNTED
(5)查看磁盘名与裸设备对应关系
SQL>  select name,path from v$asm_disk_stat;
NAME               PATH
-------------------     --------------------------------------
                /dev/oracleasm/disks/ASMDISK3
DATADISK2            /dev/oracleasm/disks/ASMDISK5
DATADISK1            /dev/oracleasm/disks/ASMDISK4
ARCHDISK1            /dev/oracleasm/disks/ASMDISK2
FLASHDISK            /dev/oracleasm/disks/ASMDISK1
(6)查看每个磁盘组的可用大小
SQL> select name,allocation_unit_size,total_mb from v$asm_diskgroup;
NAME    ALLOCATION_UNIT_SIZE    TOTAL_MB
------------------ --------------------------------   ----------
FLASH_DISK 1048576      3815
ARCH_DISK 1048576      3815
DATA_DISK  1048576       954
(7)向磁盘组中增加一个磁盘
SQL> ALTER DISKGROUP ARCH_DISK ADD DISK '/dev/oracleasm/disks/ASMDISK3' name ARCHDISK2;
Diskgroup altered.
查看每个磁盘组的可用大小
SQL> select name,allocation_unit_size,total_mb from v$asm_diskgroup;
NAME     ALLOCATION_UNIT_SIZE  TOTAL_MB
------------------- -------------------------------  ----------
FLASH_DISK 1048576     3815
ARCH_DISK 1048576     4292
DATA_DISK 1048576      954
SQL> select name,path from v$asm_disk_stat;
NAME               PATH
-------------------     ----------------------------------------
DATADISK2             /dev/oracleasm/disks/ASMDISK5
DATADISK1             /dev/oracleasm/disks/ASMDISK4
ARCHDISK2             /dev/oracleasm/disks/ASMDISK3
ARCHDISK1             /dev/oracleasm/disks/ASMDISK2
FLASHDISK             /dev/oracleasm/disks/ASMDISK1
可以看出,磁盘组ARCH_DISK的大小发生变化了,表明添加磁盘成功。
(8)从磁盘组中删除一个磁盘:
SQL> ALTER DISKGROUP ARCH_DISK DROP DISK ARCHDISK2;
Diskgroup altered.
(9)删除一个磁盘组:
SQL> drop diskgroup  FLASH_DISK;
Diskgroup dropped.
当有数据库使用ASM的磁盘组时,是无法卸载和删除这个磁盘组的。ASM实例如果宕掉,那么使用ASM的数据库实例也会宕掉。在RAC环境中,在删除一个磁盘组之前,其他节点的ASM实例必须将这个要删除的磁盘组卸载。
4.关闭ASM实例
关闭ASM实例的命令和关闭数据库实例的命令相同,但只有在没有任何数据库实例连接到该ASM实例的情况下,才能正常关闭ASM实例,如果至少有一个数据库实例与之连接,会提示以下错误:
ORA-15097: cannot SHUTDOWN ASM instance with connected RDBMS instance
此时,如果对该ASM实例强制执行SHUTDOWN ABORT命令,那么ASM实例将被关闭,任何与之连接的数据库实例最终也将自动关闭,同时报以下错误:
ORA-15064: communication failure with ASM instance
ASM实例被强制关闭后,在下次启动时,会要求进行恢复。
5.  ASMCMD命令
Oracle在10g版本中提供了ASMCMD命令,通过这个命令可以管理存储在ASM磁盘中的数据。下面简单介绍ASMCMD命令的使用方法。
在使用ASMCMD命令时必须启动ASM实例,然后指定ORACLE_HOME和ORACLE_SID,例如:
[oracle@node-rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@node-rac1 ~]$ asmcmd
ASMCMD>
还可以使用“asmcmd -p”,加上“-p”参数可以显示当前路径。
下面是ASMCMD提供的一些可用命令,其中oracle 11g新增的命令有cp、md_backup、md_restore。
ASMCMD> ?
     commands:
     --------
     help

上一页  1 2 3 4 5  下一页

Tags:Oracle RAC 系列

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接