Thursday, November 28, 2013

ASM new features in oracle 11g


ASM was first time introduced in Oracle Database 10g. Since then lot of improvement has been done. ASM path are not part of regular OS level I/O. Because of this RDBMS does a raw I/O which will be faster as compared to file system I/O. Since there is no intervention OS


sql commands to view the asm information:


select GROUP_NUMBER,NAME,STATE,TOTAL_MB,FREE_MB from gv$asm_diskgroup;

set lines 128 pages 200
col path for a60
col header_status for a20
col name for a20
select GROUP_NUMBER,name,DISK_NUMBER,HEADER_STATUS,PATH,TOTAL_MB,FREE_MB from gv$asm_disk;

select GROUP_NUMBER,name,DISK_NUMBER,HEADER_STATUS,path,MOUNT_STATUS from v$asm_disk;

MOUNT_STATUS:
              1) MISSSING : disk there in asm metadata,but not in storage
               2) CLOSED   : disk is there in storage,but not being used by ASM
               3) OPENED   : normal state
               4) CACHED   : normal state
               5) IGNORED  : Disk header is no longer valid.
               6) CLOSING  : ASM is closing the diskgroup.

HEADER_STATUS:
               1) CANDIDATE : It is not part of any diskgroup, like brand new and ready to use/add.
               2) MEMBER       : Currently is part of disk group, we can't add to another diskgroup
               3) FORMER       : It WAS part of the diskgroup,but now it is ready to be used/add.
               4) PROVISIONED : similar to CANDIDATE.


The PROVISIONED header status is different from the CANDIDATE header status in that PROVISIONED implies that an additional platform-specific action has been taken by an administrator to make the disk available for Automatic Storage Management.
For example, on Windows, the administrator used asmtool or asmtoolg to stamp the disk with a header, or on Linux, the administrator used ASMLib to prepare the disk for ASM.




Few more ASM related commands:



alter diskgroup PROD_ADFG_TEMP dismount;  -- dismount diskgroup

ALTER DISKGROUP PROD_ADFG_TEMP DROP DISK 'PROD_ADFG_TEMP_0000','PROD_ADFG_TEMP_0003' REBALANCE POWER 1; -- to drop disk from diskgroup

drop diskgroup including contents;   -- to drop diskgroup

alter diskgroup PROD_DATA add disk '/dev/oracle/raw36' REBALANCE POWER 3; -- to add disk to diskgroup

alter diskgroup PROD_DATA rebalance power 2 NOWAIT; - to change the rebalance power


select sysdate, GROUP_NUMBER, OPERATION,STATE, POWER, ACTUAL, SOFAR, EST_WORK,EST_RATE, EST_MINUTES from v$asm_operation;  - to check the asm operations like rebalancing

select instname, dbname, group_number,failgroup,disk_number,reads,writes from v$asm_disk_iostat order by 1,2,3,4,5,6;  -- to view the asm diskgroup I/O.



Here I am going to share new feature when you use ASM in Oracle Database 11g environment.


--------------------------------------------------------------------------------------
The default parameter settings work perfectly for ASM. The only parameters needed for 11g ASM:
ASM_DISKSTRING
ASM_DISKGROUPS
INSTANCE_TYPE


ASM Preferred Mirror Read
----------------------------------

Mirroring is done to ensure the protection from data loss. ASM failure groups in Oracle Database 10g always reads the primary copy of a mirrored ASM data extent. If a node is allowed to read the data from local or from closest node inspite that data is secondary, then it can improve the performance by reducing network traffic. Oracle Database 11g can do this by configuring preferred mirror read using the new ASM_PREFERRED_READ_FAILURE_GROUPS initialization parameter to specify a list of preferred mirror read names.
ASM_PREFERRED_READ_FAILURE_GROUPS=DATA.SITEA On first instance
ASM_PREFERRED_READ_FAILURE_GROUPS=DATA.SITEB On second instance
This can be monitored from v$asm_disk(preferred_read) and v$asm_disk_iostat tables.


ASM Scalability and Performance Enhancements
---------------------------------- ---------------------
ASM uses a predetermined number of ASM data extents of each size. As soon as a file crosses a certain threshold, the next ASM data extent size is used. An ASM file can begin with 1 AU(Allocation Unit); as the file’s size increases, the ASM data extent size also increases to 8 or 64 AUs based on predefined file size thresholds.
ASM also automatically defragments during allocation if the desired size is unavailable, thereby potentially affecting allocation times but offering much faster file opens, given the reduction in the memory required to store file ASM data extents.

SYSASM privilege
----------------------------------
In Oracle Database 11g, if you log in to an ASM instance as SYSDBA, warnings are written in the corresponding alert.log file.
SYSASM privilege is replacing SYSDBA privilege as compared to proir version.
SYSDBA privilege in ASM instance will be having restricted privileges like mount/unmount diskgroups. Can't be shutdown/startup ASM instance.

ASM Disk Group Compatibility
----------------------------------
An ASM instance can support different RDBMS clients running at different compatibility settings. The database compatible version setting of each instance must be greater than or equal to the RDBMS compatibility of all disk groups used by that database. Database instances are typically run from a different Oracle home than the ASM instance. This implies that the database instance may be running a different software version than the ASM instance. When a database instance first connects to an ASM instance, it negotiates the highest version that they both can support.
Main Objective behind this new feature is to ensure heterogenous environment should also supproted by ASM.

alter diskgroup /*ASMCMD AMBR*/DATA set attribute 'COMPATIBLE.ADVM' = '11.2';

Few New Maintenance command in ASM
---------------------------------- ------------
ALTER DISKGROUP DATA CHECK;
Checks all the metadata directories by default

ALTER DISKGROUP data MOUNT RESTRICT; 
When a disk group is mounted in restricted mode, clients cannot access the files in a disk group.
In a RAC environment, a disk group mounted in RESTRICTED mode can only be accessed by a single instance.


Using RESTRICTED mode improves the performance of rebalance operations
in a RAC environment as it elimitates the need for lock and unlock extent map messaging that occurs
 between ASM instances. Once the rebalance operation is complete,
 the disk group should be dismounted then mounted in NORMAL mode (the default).



ALTER DISKGROUP data MOUNT FORCE; 
Mounts the disk group even if some disks belonging to the disk group are not accessible

DROP DISKGROUP data FORCE INCLUDING CONTENTS; 
Enables users to drop a disk group that cannot be mounted; fails if the disk group is mounted anywhere


ASMCMD is now more powerful in 11g ASM
---------------------------------------------------
The lsdsk command lists ASM disk information. This command can run in two modes:
• Connected mode: ASMCMD uses the V$ and GV$ views to retrieve disk information.
• Nonconnected mode: ASMCMD scans disk headers to retrieve disk information, using an ASM disk string to restrict the discovery set. The connected mode is always attempted first.
MD_BACKUP command is used to do backup of metadata from ASM disk group.
MD_RESTORE command is used to restore the lost metadata to ASM disk group.

ASMCMD> md_backup –b jfv_backup_file -g data
Disk group to be backed up: DATA#
Current alias directory path: jfv
ASMCMD>
ASMCMD> md_restore -b jfv_backup_file -t full -g data
Disk group to be restored: DATA#
ASMCMDAMBR-09358, Option -t newdg specified without any override options.
Current Diskgroup being restored: DATA
Diskgroup DATA created!
User Alias directory +DATA/jfv
created!

ASMCMD now support cp command 
--------------------------------------------------

by which we can copy the ASM files from local to remote node or vice versa and from file system to ASM disk or vice versa.

cp +DATA/ORCL/DATAFILE/TBSJFV.256.629730771 +DATA/ORCL/tbsjfv.bak
cp /home/oracle/tbsjfv.dbf +data/jfv
cp +DATA/orcl/datafile/tbsjfv.256.629989893 \sys@edcdr12p1.+ASM2:+D2/jfv/tbsjfv.dbf

Rename the ASM diskgroup:
--------------------------

Using renamedg asmcmd command we can also rename the ASM disk group.

asmcmd> renamedg –h




No comments:

Post a Comment