wxsheng 发表于 2018-9-23 10:29:51

Oracle_052_lesson_p5

Managing the ASM Instance管理ASM实例
  you should be able to:
  1、Describe the benefits of using ASM
  2、Manage the ASM instance
  3、Create and drop ASM disk groups
  4、Extend ASM disk groups
  5、Retrieve ASM metadata by using various utilities


  ASM:内存+进程
  sqlplus/as sysasm;
  v$asm_disk;
  v$asm_diskgroup;
  shared pool:元数据信息
  large pool :大池,并行操作的
  asm cache: 重平衡,(值最小1,最大11,越大重平衡越快)
  free memory: 空闲内存
  ASM实例初始化参数
  The ASM instance uses a small subset of the parameters that an Oracle Database instance uses.
  [INSTANCE_TYPE = ASM
  ASM_POWER_LIMIT = 1
  ASM_DISKSTRING = '/dev/sda1','/dev/sdb*'
  ASM_DISKGROUPS = DATA2, FRA
  ASM_PREFERRED_READ_FAILURE_GROUPS = DATA.FailGroup2
  DIAGNOSTIC_DEST = /u01/app/oracle
  LARGE_POOL_SIZE = 12M
  REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE]
  SQL> showparameterspfile;
  SQL>showparameterinstance_type;
  ASM Instance: Dynamic Performance ViewsASM动态性能视图
  ASM只有动态性能视图,文件是保存在OS的$ORACLE_HOME/dbs/orapw+asm中的
  The ASM instance hosts memory-based metadata tables presented as dynamic performance views.
  Accessed by ASM utilities to retrieve metadata-only information using the SQL language
  Contains many dedicated ASM-related views such as:
  V$ASM_ALIAS         V$ASM_ATTRIBUTE      V$ASM_CLIENT
  V$ASM_DISK          V$ASM_DISK_IOSTAT      V$ASM_DISK_STAT
  V$ASM_DISKGROUP V$ASM_DISKGROUP_STAT   V$ASM_FILE
  V$ASM_OPERATION V$ASM_TEMPLATE

  先关DB,再关ASM。先开ASM,再开DB;
  *Starting and Stopping ASM InstancesUsing SQLPlus用sqlplus起停ASM实例**
  $ . oraenv
  ORACLE_SID = ? +ASM
  The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
  $ sqlplus / AS SYSASM

  SQL*Plus:>  Copyright (c) 1982, 2009, Oracle.All rights reserved.

  Connected to an>  SQL> startup
  ASM instance started
  Total System Global Area284565504 bytes

  Fixed>
  Variable>  ASM Cache                  25165824 bytes
  ASM diskgroups mounted
  ASM diskgroups volume enabled
  SQL> shutdown abort
  Starting and Stopping ASM Instances Using srvctl用srvctl起停ASM实例
  $ . oraenv
  ORACLE_SID = ? +ASM
  The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
  $ srvctl start asm -o mount
  $ srvctl stop asm -f
  $ srvctl status asm
  ASM is running on edrsr25p1
  Starting and Stopping ASM Instances Using asmcmd用ASMCMD起停ASM实例
  $ . oraenv
  ORACLE_SID = ? +ASM
  The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
  $ asmcmd

  Connected to an>  ASMCMD> startup
  ASM instance started
  Total System Global Area284565504 bytes

  Fixed>
  Variable>  ASM Cache                  25165824 bytes
  ASM diskgroups mounted
  ASM diskgroups volume enabled
  ASMCMD> shutdown --abort
  ASM instance shut down

  Connected to an>
  ASM disks are divided into allocation units (AU):

  AU>
  Default AU>  Small enough to be cached by database and large enough for efficient sequential access

  Allowable AU>  1, 2, 4, 8, 16, 32, or 64 MB
  Large AUs may be useful in very large database (VLDB) scenarios or when using specialized storage hardware
  ASM files:
  Are a collection of ASM extents composed of AUs

  Variable>  Appear as normal files to the database kernel
  Have file names that start with '+'
  For example, +DATA/orcl/datafile/system.256.689832921
  May be associated with an optional alias file name
  For example, +DATA/dbfiles/mydb/system01.dbf
  Are evenly distributed across disks in a disk group
  Are mirrored according to the policies defined in the disk group
  Striping Granularity条带化粒度
  1、ASM separates striping for load balance and striping for latency:
  Coarse-grain striping concatenates allocation units for load balancing.
  数据文件粗粒度,以AU如1M为单元逐磁盘写入。
  2、Fine-grain striping puts 128 KB stripe units across groups of allocation units to improve latency.
  Disk group with 8 disks and external redundancy

  Default AU>  First 1 MB extent written as 128 KB stripes across 8 AUs
  细粒度 ,以128K为单元逐磁盘写入,如控制文件、日志文件用细粒度。
  管理ASM磁盘组
  CREATE DISKGROUP
  ALTER DISKGROUP
  DROP DISKGROUP
  Creating and Dropping Disk Groups Using SQLPlus
  例:
  $ . oraenv
  ORACLE_SID = ? +ASM
  The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
  $ sqlplus / AS SYSASM

  SQLPlus:>  Copyright (c) 1982, 2009, Oracle.All rights reserved.
  ..
  SQL> CREATE DISKGROUP dgroupA NORMAL REDUNDANCY
  FAILGROUP controller1 DISK

  '/devices/A1' NAME diskA1>  '/devices/A2',
  FAILGROUP controller2 DISK
  '/devices/B1',
  '/devices/B2';
  SQL> DROP DISKGROUP dgroupA INCLUDING CONTENTS;
  例:
  Remove a disk from dgroupA:
  ALTER DISKGROUP dgroupA DROP DISK A5;
  Add and drop a disk in a single command:增加和删除DISK用1条命令完成
  ALTER DISKGROUP dgroupA   DROP DISK A6
  ADD FAILGROUP controller3      DISK '/dev/sdi1' NAME A9;
  Add and drop a disk in a single command:
  ALTER DISKGROUP dgroupA UNDROP DISKS;
  例:
  Adding Disks to Disk Groups
  ALTER DISKGROUP dgroupA ADD DISK
  '/dev/sde1' NAME A5,
  '/dev/sdf1' NAME A6,
  '/dev/sdg1' NAME A7,
  '/dev/sdh1' NAME A8;
  ALTER DISKGROUP dgroupA ADD DISK '/devices/A*';
  ASMCMD> lsdsk
  descv$asm_disk;
  creatediskgroupdg_testexternal   redurancydisk '/dev/sdi5'namei5;
  ASMCMD>lsdg
  dropdiskgroupdg_testincludingcontents;
  ASM Disk Group CompatibilityASM磁盘组兼容性


  Retrieving ASM Metadata 检索ASM元数据
  SQL> SELECT f.type, f.redundancy, f.striped, f.modification_date, a.system_created, a.name FROM v$asm_alias a, v$asm_file f WHERE a.file_number = f.file_number and a.group_number = f.group_number and type='DATAFILE';
  TYPE      REDUNDSTRIPEMODIFICATSNAME
  DATAFILEMIRRORCOARSE08-JUL-09YSYSTEM.256.689832921
  DATAFILEMIRRORCOARSE08-JUL-09YSYSAUX.257.689832923
  ..
  ASMCMD> ls -l +DATA/orcl/datafile
  Type      RedundStripedTime             SysName
  DATAFILEMIRRORCOARSE   JUL 08 21:00:00Y SYSTEM.256.689832921
  DATAFILEMIRRORCOARSE   JUL 08 21:00:00Y SYSAUX.257.689832923
  ..


页: [1]
查看完整版本: Oracle_052_lesson_p5