当前位置:Gxlcms > 数据库问题 > ORACLE之ASM概念

ORACLE之ASM概念

时间:2021-07-01 10:21:17 帮助过:20人阅读


五、  目录及目录文件管理

5.1   创建目录

SQL> alter diskgroup ASMGROUP1 add directory ‘+ASMGROUP1/WWL1‘;

Diskgroupaltered.

5.2   修改目录

SQL> alterdiskgroup ASMGROUP1 rename directory ‘+ASMGROUP1/WWL1‘ to ‘+ASMGROUP1/WWL2‘;

Diskgroupaltered.

5.3   删除目录

SQL> alter diskgroup ASMGROUP1 drop directory ‘+ASMGROUP1/WWL2‘;

Diskgroupaltered.

六、  手动平衡磁盘组

一般情况下ASM都会自动对其下的磁盘组进行平衡,不过ORACLE也提供了手动平衡磁盘组的方式,通过alter diskgroup ... power 语句。前面提到过磁盘组的平衡度有0到11多个级别,默认是按照ASM_POWER_LIMIT初始化参数中设置的值,手动平衡的话,设置的平衡度可以与初始化参数中并不相同,例如,设置磁盘组平衡度为5,语句如下:

     SQL>alter diskgroup asmgroup1 rebalance power 5;

Diskgroup altered.

七、  通过ASMCMD工具管理ASM

[oracle@wwl ~]$ which asmcmd

/oracle/orahome/10.2.0/db_1/bin/asmcmd

[oracle@wwl ~]$ cd/oracle/orahome/10.2.0/db_1/bin/

ASMCMD> ls 

ASMEXTERNAL/

ASMGROUP1/

ASMHIGH/

ASMNORMAL/

ASMCMD>

ASMCMD> help

       asmcmd [-p] [command]

       The environment variables ORACLE_HOME and ORACLE_SID determine the

       instance to which the program connects, and ASMCMD establishes a

       bequeath connection to it, in the same manner as a SQLPLUS / AS

       SYSDBA.  The user must be a memberof the SYSDBA group.

       Specifying the -p option allows the current directory to be displayed

       in the command prompt, like so:

       ASMCMD [+DATAFILE/ORCL/CONTROLFILE] >

       [command] specifies one of the following commands, along with its

       parameters.

       Type "help [command]" to get help on a specific ASMCMDcommand.

       commands:

       --------

cd:------------------------------------------进入下级目录或进入所需要的目录

du:------------------------------------------显示指定的ASM目录下ASM文件占用的所有磁盘空间

find:-----------------------------------------查找所需的文件

help:-----------------------------------------显示帮助信息

ls:---------------------------------------------列出ASM目录下的内容及其属性

lsct:-------------------------------------------列出当前ASM客户端的信息

lsdg:-------------------------------------------列出所有磁盘组及其属性

mkalias:--------------------------------------为系统生成的文件名创建别名

mkdir:----------------------------------------创建新目录

pwd:------------------------------------------显示当前目录路径

rm:--------------------------------------------删除ASM目录下的某个文件或文件夹

rmalias:--------------------------------------删除别名

ASMCMD>

要查看某个命令的相信通过在命令前添加help来查看,如下:

ASMCMD> help cd

       cd <dir>

       Change the current directory to <dir>.

ASMCMD> help du

       du [-H] [dir]

       Display total space used for files located recursively under [dir],

       similar to "du -s" under UNIX; default is the currentdirectory.  Two

       values are returned, both in units of megabytes.  The first value does

       not take into account mirroring of the diskgroup while the second does.

       For instance, if a file occupies 100 MB of space, then it actually

       takes up 200 MB of space on a normal redundancy diskgroup and 300 MB

       of space on a high redundancy diskgroup. 

       [dir] can also contain wildcards.

       The -H flag suppresses the column headers from the output.

ASMCMD> help find

       find [-t <type>] <dir> <pattern>

       Find the absolute paths of all occurrences of <pattern> under<dir>.

       <pattern> can be a directory and may include wildcards.  <dir> may also

       include wildcards.  Note thatdirectory names in the results have the

       "/" suffix to clarify their identity.

       The -t option allows searching by file type.  For instance, one can

       search for all the control files at once.  <type> must be one of the

       valid values in V$ASM_FILE.TYPE.

ASMCMD>

 

八、  oracleasm工具的使用和语法介绍

[root@wwl ~]# oracleasm --help

Usage: oracleasm[--exec-path=<exec_path>] <command> [ <args> ]

      oracleasm --exec-path

      oracleasm -h

      oracleasm -V

The basic oracleasm commands are:

   configure        Configure the OracleLinux ASMLib driver

   init             Load andinitialize the ASMLib driver

   exit             Stop the ASMLibdriver

   scandisks        Scan the systemfor Oracle ASMLib disks

   status           Display thestatus of the Oracle ASMLib driver

   listdisks        List known OracleASMLib disks

   querydisk        Determine if adisk belongs to Oracle ASMlib

   createdisk       Allocate a devicefor Oracle ASMLib use

   deletedisk       Return a deviceto the operating system

   renamedisk       Change the labelof an Oracle ASMlib disk

   update-driver    Download thelatest ASMLib driver

[root@wwl ~]#

九、  ASM相关视图(V$)和数据字典(X$)

ASM由于其高度的封装性,使得我们很难知道窥探其内部的原理。可以通过一下视图和数据字典来来查看ASM 的信息。

相关视图和数据字典

View Name

X$ Table name

Description

V$ASM_DISKGROUP

X$KFGRP

performs  disk discovery and lists diskgroups

V$ASM_DISKGROUP_STAT

X$KFGRP_STAT

diskgroup  stats without disk discovery

V$ASM_DISK

X$KFDSK,  X$KFKID

performs  disk discovery, lists disks and their usage metrics

V$ASM_DISK_STAT

X$KFDSK_STAT,  X$KFKID

lists  disks and their usage metrics

V$ASM_FILE

X$KFFIL

lists  ASM files, including metadata/asmdisk files

V$ASM_ALIAS

X$KFALS

lists  ASM aliases, files and directories

V$ASM_TEMPLATE

X$KFTMTA

lists  the available templates and their properties

V$ASM_CLIENT

X$KFNCL

lists  DB instances connected to ASM

V$ASM_OPERATION

X$KFGMG

lists  rebalancing operations

N.A.

X$KFKLIB

available  libraries, includes asmlib path

N.A.

X$KFDPARTNER

lists  disk-to-partner relationships

N.A.

X$KFFXP

extent  map table for all ASM files

N.A.

X$KFDAT

extent  list for all ASM disks

N.A.

X$KFBH

describes  the ASM cache (buffer cache of ASM in blocks of 4K (_asm_blksize)

N.A.

X$KFCCE

a  linked list of ASM blocks. to be further investigated

This list isobtained querying v$fixed_view_definitionwhere view_name like ‘%ASM%‘ whichexposes all the v$ and gv$ views with theirdefinition. Fixed tables are exposedby querying v$fixed_table where name like‘x$kf%‘ (ASM fixed tables use the‘X$KF‘ prefix).

SQL>select* fromv$fixed_view_definition whereview_name like ‘%ASM%‘;

SQL>select* from sys.v$fixed_tablewhere name like ‘X$KF%‘ ;

十、  ASM常见的错误处理

错误一、

ORA-15097:cannotSHUTDOWN ASM instance with connected RDBMS instance

解决办法:

发生这个问题,唯一的一个原因就是Oracle实例没有关闭,或ORACLE实例正在关闭或处于挂起状态,导致ASM实例无法关闭,解决办法,关闭RDBMS实例后再关闭ASM实例。

错误二、

[root@wwl ~]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd

Marking disk "VOL3" as an ASM disk: [FAILED]

   报这个错的原因在于磁盘为分区导致。在创建ASM的之前必须线将磁盘分区,但不能格式化,后执行创建就不会有问题了。

十一、       ASM 扩展性

最多支持63个磁盘组;     最多支持10000个磁盘;     最大支持4pb/磁盘;     最大支持40     exabyte/ASM存储; 最大支持1百W个文件/磁盘组; 外部冗余时单个文件最大35tb,标准冗余时单个文件最大5.8tb,高冗余度时单个文件最大3.9tb

十二、       ASM其它信息请参考如下连接:

http://docs.oracle.com/cd/E11882_01/server.112/e16102/asmfiles.htm




本文出自 “IT小矮人!” 博客,请务必保留此出处http://lqx049.blog.51cto.com/1919902/1703043

ORACLE之ASM概念

标签:oracle   数据库   asm   操作系统   

人气教程排行