Tips_33 Managing Storage with ASM
ASM,is an Oracle-aware logical volume manager,or LVM,that can stripe and mirror database files and recovery files across a number of physical devices.
■
・Logical volumes are virtual disks, or file systems,that are visible to application software, such as the Oracle database.
・Physical volumes are presented to the software as logical volumes by the operating system’s logical volume manager, or LVM.
■■Logical Volume Manager
RAID Levels:
①level 0
is optimal for performance but suboptimal for fault tolerance.
consists of one or more logical volumes cut across two or more physical volumes
②level 1
is optimal for fault tolerance.
consists of one or more logical volumes mirrored across two or more disks
③level 5
is a compromise between the performance of RAID 0 and the fault tolerance of RAID 1
The logical volume is cut across multiple physical volumes (so concurrent read and writes are possible), and a checksumming algorithm writes out enough information to allow reconstruction of the data on any one physical volume,if it gets damaged.
④RAID 0+1
is optimal for both fault tolerance and performance: you mirror your striped disks.
Choice of RAID Level:
As the DBA, you should take control of the RAID strategy and apply different levels to different file types.
①Some files are critical to the database remaining open:
the files that make up the SYSTEM tablespace, the active UNDO tablespace, should be on RAID 1 volumes
The controlfile copies are critical for performance,but if any copy is damaged, the database will crash; thus, RAID 0+1
②Some files are critical for performance:
the online redo log files and the controlfiles.
should be on RAID 0 volumes
■ASM vs Third-Party LVMs
ASM has a huge advantage over other logical volume managers:
it is aware of the nature of Oracle database files. This means it can make more intelligent decisions about how to manage the files than a third-party product
■■The ASM Architecture
・INSTANCE_TYPE defaults to RDBMS
An RDBMS instance is a normal instance, used for opening a database and accepting user sessions.
Setting to ASM will start an Automatic Storage Management instance, which is very different.
■The ASM Disks and Disk Groups
An ASM disk group is a pool of ASM disks managed as one logical unit.
ASM disks must be raw devices, without a file system, but they do not need to be actual disks. They can be disks, partitions of a disk, or logical volumes managed by an LVM.
You can use ASM only for database files, not for your Oracle home or for anything else.
■The ASM Instance
*Normal disk activity does not go through the ASM instance.
ASM is a management and control facility that makes the files available; it does not do the actual I/O work.
・ASM instance cannot mount or open a database, it will never be able to read a data dictionary;
for this reason, you can only connect to it with password file or operating system authentication, as SYSOPER or as SYSDBA.
all ASM instance can do is locate and manage ASM disks.
・You should create one ASM instance per computer and use it to manage all the ASM disks available to that computer on behalf of all the RDBMS instances running on the computer.
・An ASM instance will have two background processes in addition:
used to handle rebalancing activity—the movement of data between ASM disks in an ASM disk group, in response to adding or removing a disk to or from the group.
①RBAL:coordinates the rebalancing,
②ARBn:to bring the disk into use.
■The RDBMS Instance
An RDBMS instance that is using ASM files functions as normal, except that it will have two additional background processes:
・RBALopens the ASM disks, which it will locate through the ASM instance.
・ASMB:connects to the ASM instance by creating a session against it, via a server process.
in effect, the RDBMS instance becomes a client to the ASM server.
Commonly, an RDBMS instance will require access to only two disk groups: one for its live database files, the other for its flash recovery area.
■The ASM Files
・the whole database can be stored on ASM disks, as can all recoveryrelated files; you can direct the flash recovery area to an ASM disk group.
*ASM does not manage the Oracle binaries, nor the alert log, trace files, or password file.
・All ASM files are created and managed by the RDBMS instance,using the usual commands.
The only difference is in the filename: when creating a database file, you specify only the name of the disk group to which the file should be directed,
and ASM will generate the actual filename and manage the physical locations.
・Normal operating system commands cant see ASM file,mean that you must use RMAN to back up your ASM datafiles, archive logs, and controlfiles.
・ASM files can coexist with files stored within file systems.
■Creating Raw Devices
On a Windows PC, you could use the Microsoft Management Console Disk Management snap-in to create the devices.
On a Linux PC, you could use the fdisk utility.
■Creating, Starting, and Stopping an ASM Instance
・Parameter file
eg Win:
instance_name='+asm'
instance_type='asm'
asm_diskstring='\\.\*:'
asm_diskgroups=dgroupA,dgroupB
background_dump_dest='d:\oracle\admin\dump\asm'
eg Linux:
instance_name='+asm'
instance_type='asm'
asm_diskstring='/dev/md2','/dev/md3','/dev/md4','/dev/md5'
asm_diskgroups=dgroupA,dgroupB
remote_login_passwordfile=exclusive
・RDBMS instances use files in disk groups managed by the ASM instance.
If the ASM instance has not started and mounted the disk groups, then the RDBMS instances cannot open.
・If an RDBMS instance fails, the ASM instance will not be affected.
If an ASM instance fails, the RDBMS instances will abort
■Creating ASM Disk Groups
Disk groups are created by an ASM instance and then used by an RDBMS instance
If you nominate a disk that is already part of a disk group, the command will fail.
・
NORMAL redundancy(default):meaning single mirror
HIGH REDUNDANCY:create three copies of every allocation unit
EXTERNAL REDUNDANCY:will not mirror at all
・
SQL> create diskgroup dg1 disks '/dev/sdc', '/dev/sdd', '/dev/sde', '/dev/sdf';
SQL> create diskgroup dgroupa normal redundancy failgroup controller2 disk '/dev/rdsk/c2*' failgroup controller3 disk '/dev/rdsk/c3*';
The views V$ASM_DISK and V$ASM_DISKGROUP are only populated in an ASM instance. They are always empty in an RDBMS instance.
Eg:
Creating a Disk Group (Windows)
1. From an operating system prompt, set your ORACLE_SID environment variable to the ASM instance.
C:\> set ORACLE_SID=+ASM
2. Connect to your ASM instance with SQL*Plus with the SYSDBA privilege using operating system authentication.
c:\> sqlplus / as sysdba
3. Create a disk group, nominating the two raw volumes
SQL> create diskgroup dg1 disk '\\.\E:','\\.\F:';
4. Confirm the creation of the group by querying the relevant views.
SQL> select name,group_number,type,state,total_mb from v$asm_diskgroup;
SQL> select path,group_number,total_mb from v$asm_disk;
■Creating and Using ASM Files
SQL> create tablespace new_tbs datafile '+dg1' size 100m;
SQL> alter tablespace system add datafile '+system_dg' size 1000m;
SQL> alter database add logfile group 4 '+dg_log1','+dg_log2' size 100m;
SQL> alter system set log_archive_dest_1='location=+dg_arc1';
SQL> alter system set log_archive_dest_2='location=+dg_arc2';
SQL> alter system set db_recovery_file_dest='+dg_flash';
In all these examples, you do not specify a filename, only a disk group.
ASM will generate the actual filenames according to its own conventions.
■■ASM and RMAN
RMAN is the only tool you can use to back up ASM files. Usermanaged backups are not possible.
①To migrate the controlfile
SQL> alter system set controlfiles='+dgroup2','+dgroup3' scope=spfile;
SQL> shutdown immediate;
SQL> startup nomount;
RMAN> restore controlfile from '/u1/ocp10g/ctrl1.con';
②To migrate all your datafiles to an ASM disk group
SQL> shutdown immediate;
SQL> startup mount;
RMAN>backup as copy database format '+dgroup1';
RMAN>switch database to copy;
RMAN>alter database open;
③To migrate the redo logs,create new members in your disk groups and drop the old members:
SQL> alter database add logfile member '+dgroup2','+dgroup3' to group 1;
SQL> alter database drop logfile member '/u02/ocp10g/log1a.rdo','/u03/ocp10g/log1b.rdo';
④To move your temporary tablespace
drop the whole temporary tablespace and create a new one.
■■ASM and Linux
use ASM on Linux, you must do some research on Metalink to locate the correct version of the ASMLib for your Linux installation.
The URL to obtain the various versions of the ASM libraries: