New Disk Group Compatibility Attributes
Oracle 11g ASM includes two new compatibility attributes that determine the version of the ASM and database software that can use specific disk groups:
COMPATIBLE.ASM
- The minimum version of the ASM software that can access the disk group. In 11g, the default setting is 10.1.
it defines the format of the data on ASM disksCOMPATIBLE.RDBMS
- The minimumCOMPATIBLE
database initialization parameter setting for any database instance that uses the disk group. In 11g, the default setting is 10.1.
Compatible.asm should always be equal or greater than Compatible.rdbms parameter
The compatibility versions of a disk group can only be increased not decreased. If you have increased the version by mistake, you will need to create a new disk group.
Once this parameter is set they cannot be rolled back, each disk group can have it own compatible parameter. So different database version can connect to same ASM instance.
The disk group compatibility attributes can be set during disk group creation by adding the ATTRIBUTE
clause to the CREATE DISKGROUP
command.
CREATE DISKGROUP data DISK '/dev/raw/*'
ATTRIBUTE 'compatible.asm' = '11.1';
CREATE DISKGROUP data DISK '/dev/raw/*'
ATTRIBUTE 'compatible.rdbms' = '11.1', 'compatible.asm' = '11.1';
The disk group compatibility attributes for existing disk groups can be altered using the SET ATTRIBUTE
clause to the ALTER DISKGROUP
command.
ALTER DISKGROUP data SET ATTRIBUTE 'compatible.asm' = '11.1';
ALTER DISKGROUP data SET ATTRIBUTE 'compatible.rdbms' = '11.1';
The new remap command of asmcmd can be used to recover a range of unreadable blocks. ASM would read a bad block from the good copy(failover group) and restore it to a new location on the disk
ASM drops disks if they remain offline for more than 3.6 hours. The disk groups default time limit is altered by changing the DISK_REPAIR_TIME
parameter with a unit of minutes (M or m) or hours (H or h).
The parameter will become applicable to all
disks that are online.
-- Set using the hours unit of time.
ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '4.5h';
-- Set using the minutes unit of time.
ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '300m';
Oracle introduces the SYSASM privilege and the OSASM operating system group, which provide two mechanisms to enable the separation of storage and database administration duties. Granting these users the SYSASM privilege allows them to connect to the ASM instance and perform administration tasks. First, connect to the ASM instance.
$ export ORACLE_SID=+ASM
$ sqlplus / as sysasm
Allocation Unit (AU)
In Oracle 10g each extent mapped directly to one allocation unit (AU), but in Oracle 11g an extent can be made up of one or more allocation units. As files get larger, the extent size can grow to reduce the size of the extent map describing the file, thus saving memory.
The first 20,000 extents match the allocation unit size (1*AU). The next 20,000 extents are made up of 8 allocation units (8*AU). Beyond that point, the extent size becomes 64 allocation units (64*AU).
This causes better performance for large objects.
Oracle 11g also allows control over the allocation unit size using the ATTRIBUTE
clause in the CREATE DISKGROUP
statement, with values ranging from 1M to 64M.
CREATE DISKGROUP disk_group_2
EXTERNAL REDUNDANCY
DISK '/dev/sde1'
ATRRIBUTE 'au_size' = '32M';
By default the AU size is 1 Mb. The size can be defined using the power of 2(1, 2,4,8 etc.).
Disk_repair_time – Causes the resync process to begin to keep track of changes to disk extents that belong to offline disk. By default is 3.6 hrs. It defines the time to evacuate the offline disk for 3.6 hrs. In case we change the parameter value it is applicable only to online disks and not to offline disk.
ASM Fast Disk Resync
It allows to resynchronize ASM disks within an ASM disk group
ASMCMD Commands
asmcmd> md_backup
It will backup the entire ASM metadata repository. A file will be created in the current working directory. On my linux system this file was called ambr_backup_intermediate_file.md_backup
command makes a copy of the metadata for one or more disk groups
lsdsk - lists information about ASM disks from theV$ASM_DISK_STAT
andV$ASM_DISK
views.
lsdsk -d data -k
Total_MB Free_MB OS_MB Name Failgroup Library Label UDID Product Redund Path
8189 6961 8189 DATA_0000 DATA_0000 System UNKNOWN /dev/sdc1
8189 6961 8189 DATA_0001 DATA_0001 System UNKNOWN /dev/sdd1
8189 6950 8189 DATA_0002 DATA_0002 System UNKNOWN /dev/sde1
The cp
command allows files to be copied between ASM and local or remote destinations. The summary usage is shown below.
cp [-ifr] <[\@connect_identifier:]src> <[\@connect_identifier:]tgt>
ASMCMD [+] > cp +DATA/db11g/datafile/users.273.661514191 /tmp/users.dbf
The md_backup
command makes a copy of the metadata for one or more disk groups. The summary usage is shown below.
md_backup [-b location_of_backup] [-g dgname [-g dgname …]]
An example of the command is shown below. The resulting file contains all the metadata needed to recreate the ASM setup.
ASMCMD [+] > md_backup -b /tmp/backup.txt -g data
Disk group to be backed up: DATA
The md_restore
command allows you to restore a disk group from the metadata created by the md_backup
command. It also allows a certain amount of manipulation of the final disk groups during the restore. The summary usage is shown below.
md_restore -b[-li]
[-t (full)|nodg|newdg] [-f]
[-g ', ,...']
[-o ': ,...']
A straight restore of the backup shown previously is shown below.
ASMCMD [+] > md_restore -b /tmp/backup.txt -t full -g data
The remap command repairs a range of physical blocks on disk. The contents of each block are not validated, so only blocks exhibiting read errors are repaired. The summary usage is shown below.
remap
An example of the command is show below.
ASMCMD [+] > remap data data_0001 5000-5999
Preferred Read Failover Group
In Oracle 10g, ASM always reads the primary copy of the mirrored extent set. This isn't a problem when both nodes and both failure groups are all located in the same site, but it can be inefficient for extended clusters, causing needless network traffic. Oracle 11g allows each node to define a preferred failure group, allowing nodes in extended clusters to access local failure groups in preference to remote ones.
Once the compatibility options are correct, theASM_PREFERRED_READ_FAILURE_GROUPS
parameter is set to the preferred failure groups for each node.
ALTER SYSTEM SET ASM_PREFERRED_READ_FAILURE_GROUPS = 'data.data_0000', 'data.data_0001', 'data.data_0002';
The "ALTER DISKGROUP ... MOUNT
" statement allows disk groups to be mounted in restricted mode.
SQL> ALTER DISKGROUP data MOUNT RESTRICTED;
Diskgroup altered.
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).
The CHECK
clause of the ALTER DISKGROUP
command has been simplified so there are only two options, NOREPAIR
and REPAIR
, available, with NOREPAIR
as the default. Summarized errors are displayed, with full error messages writen to the alert log.
ALTER DISKGROUP data CHECK; -- Like NOREPAIR
The above command will log the error in Alert log file.
ALTER DISKGROUP data CHECK NOREPAIR;
ALTER DISKGROUP data CHECK REPAIR;
Check repair will report the block error in alert log file and also repair it.
Disk groups that can't be mounted by ASM can now be dropped using the FORCE
keyword of the DROP DISKGROUP
command.
DROP DISKGROUP data FORCE;
ASM Rolling Upgrades
Before upgrading ASM , CRS need to be upgraded.
AMM – Automatic Memory Management
Memory_max_target
Memory_target
V$Memory_Target_Advice
V$Memory_Dynamic_Components
V$memory_resize_ops