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

Oracle_052_lesson_p5

Oracle_052_lesson_p5

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> show parameter spfile;
SQL>show parameter instance_type;

ASM Instance: Dynamic Performance Views ASM動態性能視圖
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
Oracle_052_lesson_p5

先關DB,再關ASM。先開ASM,再開DB;
*Starting and Stopping ASM Instances Using SQLPlus 用sqlplus起停ASM實例**

$ . oraenv
ORACLE_SID = [orcl] ? +ASM
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
$ sqlplus / AS SYSASM
SQL*Plus: Release 11.2.0.1.0 - Production on Wed Jul 8 20:46:46 2009
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started

Total System Global Area 284565504 bytes
Fixed Size 1336028 bytes
Variable Size 258063652 bytes
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 = [orcl] ? +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 = [orcl] ? +ASM
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
$ asmcmd
Connected to an idle instance.
ASMCMD> startup
ASM instance started

Total System Global Area 284565504 bytes
Fixed Size 1336028 bytes
Variable Size 258063652 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
ASMCMD> shutdown --abort
ASM instance shut down
Connected to an idle instance.

Oracle_052_lesson_p5

ASM disks are divided into allocation units (AU):
AU size is configurable at disk group creation.
Default AU size is 1 MB:
Small enough to be cached by database and large enough for efficient sequential access
Allowable AU sizes:
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 sized extents support large files
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 size of 1 MB in use
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 = [orcl] ? +ASM
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
$ sqlplus / AS SYSASM
SQL
Plus: Release 11.2.0.1.0 - Production on Wed Jul 8 20:46:46 2009
Copyright (c) 1982, 2009, Oracle. All rights reserved.
..
SQL> CREATE DISKGROUP dgroupA NORMAL REDUNDANCY
FAILGROUP controller1 DISK
'/devices/A1' NAME diskA1 SIZE 120G FORCE,
'/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
desc v$asm_disk;
create diskgroup dg_test external redurancy disk '/dev/sdi5' name i5;

ASMCMD>lsdg
drop diskgroup dg_test including contents;

ASM Disk Group Compatibility ASM磁盤組兼容性
Oracle_052_lesson_p5

Oracle_052_lesson_p5

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 REDUND STRIPE MODIFICAT S NAME


DATAFILE MIRROR COARSE 08-JUL-09 Y SYSTEM.256.689832921
DATAFILE MIRROR COARSE 08-JUL-09 Y SYSAUX.257.689832923
..

ASMCMD> ls -l +DATA/orcl/datafile
Type Redund Striped Time Sys Name
DATAFILE MIRROR COARSE JUL 08 21:00:00 Y SYSTEM.256.689832921
DATAFILE MIRROR COARSE JUL 08 21:00:00 Y SYSAUX.257.689832923
..

Oracle_052_lesson_p5

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章