Few good questions on Automatic Storage Management (ASM) 11gR2:
(Oracle ASM Interview questions)
Q 1
Can an ASM file be contained in more than one disk groups ?
A 1
No, Any Oracle ASM file is completely contained within a single disk group. However, a disk group might contain files belonging to several databases and a single database can use files from multiple disk groups.
Q 2
What are various ASM redundancy levels?
A 2
The redundancy level controls how many disk failures are tolerated without dismounting the disk group or losing data.When you create a disk group, you specify an Oracle ASM disk group type based on one of the following three redundancy levels:
1) Normal for 2-way mirroring
2) High for 3-way mirroring
3) External to not use Oracle ASM mirroring, such as when you configure hardware RAID for redundancy
Q 3
Why it is advised that different Oracle ASM disks should not share the same physical drive?
A 3
Oracle ASM spreads the files proportionally across all of the disks in the disk group. This allocation pattern maintains every disk at the same capacity level and ensures that all of the disks in a disk group have the same I/O load. Because Oracle ASM load balances among all of the disks in a disk group, different Oracle ASM disks should not share the same physical drive.
Q 4
What are allocation units (AU)?
A 4
Every Oracle ASM disk is divided into allocation units (AU). An allocation unit is the fundamental unit of allocation within a disk group.When you create a disk group, you can set the Oracle ASM allocation unit size with the AU_SIZE disk group attribute. The values can be 1, 2, 4, 8, 16, 32, or 64 MB, depending on the specific disk group compatibility level. Larger AU sizes typically provide performance advantages for data warehouse applications that use large sequential reads.
Q 5
What all are the files that you can store in Oracle ASM disk groups?
A 5
Files that are stored in Oracle ASM disk groups are called Oracle ASM files. Each Oracle ASM file is contained within a single Oracle ASM disk group.
You can store the various file types in Oracle ASM disk groups, including:
- Control files
- Data files, temporary data files, and data file copies
- SPFILEs
- Online redo logs, archive logs, and Flashback logs
- RMAN backups
- Disaster recovery configurations
- Change tracking bitmaps
- Data Pump dumpsets
- OCR and Voting disk files ( from 11gr2 onwards)
Q 6
What are ‘Extents’ in context of Asm?
A 6
The contents of Oracle ASM files are stored in a disk group as a set, or collection, of extents that are stored on individual disks within disk groups.
Each extent resides on an individual disk. Extents consist of one or more allocation units (AU). To accommodate increasingly larger files, Oracle ASM uses variable size extents. The initial extent size equals the disk group allocation unit size and it increases by a factor of 4 or 16 at predefined thresholds. ( for a file extent is same as AU till 20000 extent ; 4*AU size for the next 20000 extent sets (20000 – 39999); 16*AU size for the next 20000 and higher extent sets (40000+))
Q 7
What are general recommendations for ASM Storage Preparation?
A 7
Following are the basic guidelines for preparing storage for use with Oracle ASM:
- Configure two disk groups, one for data and the other for the fast recovery area.
- A minimum of four LUNs (Oracle ASM disks) of equal size and performance is recommended for each disk group.
- Ensure that all Oracle ASM disks in a disk group have similar storage performance and availability characteristics.
- Ensure that Oracle ASM disks in a disk group have the same capacity to maintain balance as Oracle ASM data distribution policy is capacity-based.
- Create external redundancy disk groups when using high-end storage arrays.
- For Linux, use the Oracle ASMLib feature to provide consistent device naming and permission persistency.
- Choose a hardware RAID stripe size that is a power of 2 and less than or equal to the size of the Oracle ASM allocation unit.
Q 8
How many Oracle ASM instance are supported on a server?
A 8
Only one Oracle ASM instance is supported on a server.
Q 9
What will happen if the version of ASM is different than database ? (take both scenarios : higher and lower)
A 9
Oracle Automatic Storage Management (Oracle ASM) in Oracle Database 11g Release 2 (11.2) supports 11g Release 2 (11.2) or older software versions of Oracle database instances, including Oracle Database 10g.
BUT it is not true vice versa ..
An Oracle ASM instance must be at 11g Release 2 (11.2) to support an 11g Release 2 (11.2) Oracle Database.
Also , When using different software versions, the database instance supports Oracle ASM functionality of the earliest release in use. For example, a 10.1 database instance operating with an 11.2 Oracle ASM instance supports only Oracle ASM 10.1 features.
Q 10
List out some of the important ASM parameters in AMS pfile/spfile.
A 10
a) ASM_DISKGROUPS
specifies a list of the names of disk groups that an Oracle ASM instance mounts at startup.
Oracle ASM automatically removes a disk group from this parameter when the disk group is dropped or dismounted.
The following is an example of the ASM_DISKGROUPS parameter in the initialization file:
ASM_DISKGROUPS = DATA, FRA
The following is an example of setting the ASM_DISKGROUPS parameter dynamically:
SQL> ALTER SYSTEM SET ASM_DISKGROUPS = DATA, FRA;
b) ASM_DISKSTRING
specifies a comma-delimited list of strings that limits the set of disks that an Oracle ASM instance discovers. Pattern matching is supported.
For example, on a Linux server that does not use ASMLib, to limit the discovery process to only include disks that are in the /dev/rdsk/mydisks directory, set the ASM_DISKSTRING initialization parameter to:
/dev/rdsk/mydisks/*
c) ASM_POWER_LIMIT
specifies the default power for disk rebalancing in a disk group. The range of values is 0 to 1024 ( higher value is 11 if ASM compatibility set to less than 11.2.0.2).
The default value is 1. A value of 0 disables rebalancing. Higher numeric values enable the rebalancing operation to complete more quickly, but might result in higher I/O overhead and more rebalancing processes.
d) ASM_PREFERRED_READ_FAILURE_GROUPS
a comma-delimited list of strings that specifies the failure groups that should be preferentially read by the given instance.
e) DB_CACHE_SIZE
The setting for the DB_CACHE_SIZE parameter determines the size of the buffer cache.You do not have to set a value for the DB_CACHE_SIZE initialization parameter if you use automatic memory management.
f) DIAGNOSTIC_DEST
specifies the directory where diagnostics for an instance are located. The default value for an Oracle ASM instance is the $ORACLE_BASE directory for the Oracle Grid Infrastructure installation.
g) INSTANCE_TYPE
The following is an example of the INSTANCE_TYPE parameter in the initialization file:
INSTANCE_TYPE = ASM
h) LARGE_POOL_SIZE
You do not have to set a value for the LARGE_POOL_SIZE initialization parameter if you use automatic memory management.
The setting for the LARGE_POOL_SIZE parameter is used for large allocations.
i) SHARED_POOL_SIZE
You do not have to set a value for the SHARED_POOL_SIZE initialization parameter if you use automatic memory management. The setting for the SHARED_POOL_SIZE parameter determines the amount of memory required to manage the instance.
j) REMOTE_LOGIN_PASSWORDFILE
specifies whether the Oracle ASM instance checks for a password file. This parameter operates the same for Oracle ASM and database instances
Q 11
What is Oracle Restart?
A 11
Oracle Restart improves the availability of Oracle database. Oracle Restart runs out of the Oracle Grid Infrastructure home. Oracle Restart provides managed startup and restart of a single-instance (non-clustered) Oracle Database, Oracle ASM instance, service, listener, and any other process running on the server. If an interruption of a service occurs after a hardware or software failure, Oracle Restart automatically takes the necessary steps to restart the component.
You need to add a component, such as an Oracle ASM instance, to Oracle Restart and enable the protection for using this feature.
Q 12
How do you Start Up an Oracle ASM Instance?
A 12
Starting an Oracle ASM instance is similar to the way in which you start an Oracle database instance
- set the ORACLE_SID environment variable to the Oracle ASM system identifier (SID). (for a single-instance database is +ASM, and the default SID for Oracle ASM for an Oracle RAC node is +ASMnode_number where node_number is the number of the node.)
- initialization parameter file must contain the entry: INSTANCE_TYPE = ASM
- remember that ASM instance doesn’t mount a database but mount Oracle ASM disk groups.
- The associated Oracle database instance does not have to be running when you start the associated Oracle ASM instance
- STARTUP FORCE will issue a SHUTDOWN ABORT to the Oracle ASM instance before restarting it.
- STARTUP MOUNT or OPEN : Mounts the disk groups specified in the ASM_DISKGROUPS initialization parameter. This is the default if no command parameter is specified.
- STARTUP NOMOUNT : Starts up the Oracle ASM instance without mounting any disk groups.
- STARTUP RESTRICT : Starts up an instance in restricted mode that enables access only to users with both the CREATE SESSION and RESTRICTED SESSION system privileges. You can use the RESTRICT clause in combination with the MOUNT, NOMOUNT, and OPEN clauses.In restricted mode, database instances cannot use the disk groups.
- STARTUP PFILE=<pfile_path> can also be used if you want to start with pfile instead of spfile
Q 13
How do you stop an Oracle ASM Instance?
A 13
Ensure that the ORACLE_SID environment variable is set to the Oracle ASM SID and run SHUTDOWN command in SQL*Plus.
IMPORTANT : If Oracle Cluster Registry (OCR) or voting files are stored in a disk group, the disk group can only be dismounted by shutting down the Oracle ASM instance as part of shutting down the clusterware on a node. To shut down the clusterware, run crsctl stop crs.
Q 14
What are various shutdown mode for stopping ASM?
A 14
- NORMAL Clause : Oracle ASM waits for all of the currently connected users to disconnect from the instance. If any database instances are connected to the Oracle ASM instance, then the SHUTDOWN command returns an error and leaves the Oracle ASM instance running. NORMAL is the default shutdown mode.
- IMMEDIATE or TRANSACTIONAL Clause : Oracle ASM does not wait for users currently connected to the instance to disconnect BUT waits for any in-progress SQL to complete before performing an orderly dismount of all of the disk groups and shutting down the Oracle ASM instance.Because the Oracle ASM instance does not contain any transactions, the TRANSACTIONAL mode behaves the same as IMMEDIATE mode.
- ABORT Clause : immediately shuts down without the orderly dismount of disk groups. This causes recovery to occur upon the next Oracle ASM startup. If any database instance is connected to the Oracle ASM instance, then the database instance aborts.
Q 15
What is the difference in connecting to ASM as SYSDBA, SYSASM and SYSOPER?
A 15
The SYSDBA privilege cannot be used to administer an Oracle ASM instance. If you use the SYSDBA privilege to run administrative commands on an Oracle ASM instance, the operation results in an error. The SYSDBA privilege is intended to be used by the database to access disk groups. The SYSDBA has a subset of the privileges of the SYSASM. Connecting as SYSDBA to the database instance has a limited set of Oracle ASM privileges. For example, you cannot create a disk group when connected with the SYSDBA privilege.
Connecting to an Oracle ASM instance as SYSASM grants you full access to all of the available Oracle ASM disk groups and management functions.
SYSOPER privilege on the Oracle ASM instance provides operations such as startup, shutdown, mount, dismount, and check disk group. This group has a subset of the privileges of the SYSASM group
Q 16
What are the methods to move from Non-ASM to ASM database?
A 16
a) Using Oracle Enterprise Manager
b) Using Oracle Recovery Manager (RMAN)
Q 17
Can the redundancy level of the disk group be changed once it is created?
A 17
After a disk group is created, you cannot alter the redundancy level of the disk group. To change the redundancy level, you must create another disk group with the appropriate redundancy and then move the files to the new disk group.
Q 18
When is it advisable to use ‘FORCE’ option when adding a disk to a diskgroup?
A 18
You must use FORCE only when adding a disk that was dropped with FORCE. If a disk is dropped with NOFORCE, then you can add it with NOFORCE. For example, a disk might have failed and was dropped from its disk group. After the disk is repaired, it is no longer part of any disk group, but Oracle ASM still recognizes that the disk had been a member of a disk group. You must use the FORCE flag to include the disk in a new disk group. In addition, the disk must be addressable, and the original disk group must not be mounted. Otherwise, the operation fails.
Q 19
How can we create a new disk group? Give example.
A 19
Disk groups can be created by ‘Create Diskgroup’ SQL command or with help of Oracle Enterprise Manager.
For Example, to create diskgroups with external redundancy :
[stextbox id=”grey”]
sqlplus / as sysasm
create diskgroup data external redundancy DISK ‘ORCL:DISK2′ name DISK2, ‘ORCL:DISK3′ name DISK3, ‘ORCL:DISK4′ name DISK4;
Diskgroup created.
create diskgroup arch external redundancy DISK ‘ORCL:DISK5′ name DISK5;
Diskgroup created.
[/stextbox]
Now if you are using RAC and if you check in asm view from the node where the ‘create diskgroup command’ was run
[stextbox id=”grey”]
SQL> select name,state,TOTAL_MB,FREE_MB from v$asm_diskgroup;
NAME STATE TOTAL_MB FREE_MB
—————————— ———– ———- ———-
OCRVOTE MOUNTED 10236 9840
DATA MOUNTED 30708 30654
ARCH MOUNTED 10236 10186
[/stextbox]
But from other RAC nodes you will find that diskgroups are visible but not mounted. You need to manually mount the diskgroups from other node
[stextbox id=”grey”]
SQL> select name,state,TOTAL_MB,FREE_MB from v$asm_diskgroup;
NAME STATE TOTAL_MB FREE_MB
—————————— ———– ———- ———-
OCRVOTE MOUNTED 10236 9840
DATA DISMOUNTED 0 0
ARCH DISMOUNTED 0 0
SQL> alter diskgroup DATA mount;
Diskgroup altered.
SQL> alter diskgroup ARCH mount;
Diskgroup altered.
SQL> select name,state,TOTAL_MB,FREE_MB from v$asm_diskgroup;
NAME STATE TOTAL_MB FREE_MB
—————————— ———– ———- ———-
OCRVOTE MOUNTED 10236 9840
DATA MOUNTED 30708 30611
ARCH MOUNTED 10236 10143
[/stextbox]
Q 20
What is the allocation units (AU) size you should keep while creating diskgroups?
A 20
The values can be 1, 2, 4, 8, 16, 32, or 64 MB, depending on the specific disk group compatibility level.
Oracle recommends that the allocation unit (AU) size for a disk group be set to 4 megabytes (MB).
Benefits of 4 mb AU are
- Increased I/O through the I/O subsystem if the I/O size is increased to the AU size.
- Reduced SGA size to manage the extent maps in the database instance.
- Faster datafile initialization if the I/O size is increased to the AU size.
- Increased file size limits.
- Reduced database open time.
Although for keeping OCR and voting disks file in different diskgroup in case of RAC, you can choose 1 mb AU because there is low I/O and small files on that diskgroup.
Q 21
How do you manage manage and monitor OCR and voting files?
A 21
The CRSCTL and ocrconfig commands enable the placement of OCR storage and Cluster Synchronization Services (CSS) voting files inside the disk groups managed by Oracle ASM.
Q 22
What will happen when a disk is dropped from a disk group?
A 22
ALTER DISKGROUP data1 DROP DISK diska5;
When a disk is dropped, the disk group is rebalanced by moving all of the file extents from the dropped disk to other disks in the disk group. A drop disk operation might fail if not enough space is available on the other disks.
IMPORTANT : The ALTER DISKGROUP…DROP DISK SQL statement returns to SQL prompt before the drop and rebalance operations are complete. Do not reuse, remove, or disconnect the dropped disk until the HEADER_STATUS column for this disk in the V$ASM_DISK view changes to FORMER.
You can query the V$ASM_OPERATION view to determine the amount of time remaining for the drop/rebalance operation to complete.
Q 23
Does Oracle ASM perform multiple rebalance operations on different disk groups in serial or parallel?
A 23
Oracle ASM can perform one disk group rebalance at a time on a given instance. If you have initiated multiple rebalances on different disk groups on a single node, then Oracle processes these operations in parallel on additional nodes if available; otherwise the rebalances are performed serially on the single node. You can explicitly initiate rebalances on different disk groups on different nodes in parallel.
Q 24
What can be the various header status that an ASM disk can assume?
A 24
MEMBER :
Disks that belong to a disk group, that is, disks that have a disk group name in the disk header, show a header status of MEMBER.
CANDIDATE :
Disks that were discovered, but that have not yet been assigned to a disk group, have a status of CANDIDATE
PROVISIONED :
PROVISIONED status implies that an additional platform-specific action has been taken by an administrator to make the disk available for Oracle ASM. These disks are discovered by ASM
FORMER :
Disks that previously belonged to a disk group and were dropped cleanly from the disk group have a status of FORMER.
FOREIGN :
When adding a disk, the FORCE option must be used if Oracle ASM recognizes that the disk was managed by Oracle. Such a disk appears in the V$ASM_DISK view with a status of FOREIGN. In this case, you can only add the disk to a disk group by using the FORCE keyword.
Q 25
How do you calculate total ASM disk space and free disk space?
A 25
The space can be queried from V$ASM_DISKGROUP
SELECT name, type, total_mb, free_mb FROM V$ASM_DISKGROUP;
Q 26
What kind of files are not directly supported on ASM
A 26
Oracle ASM cannot directly support some administrative file types on disk groups. These include trace files, audit files, alert logs, export files, tar files, and core files.
Oracle Automatic Storage Management Cluster File System (Oracle ACFS) and Oracle ASM Dynamic Volume Manager (Oracle ADVM) extend Oracle ASM support to include these files too
Q 27
How do you add/rename/drop an Alias Name for an Oracle ASM Filename?
A 27
Use the ADD ALIAS, RENAME ALIAS, DROP ALIAS clause of the ALTER DISKGROUP statement to create an alias name for an Oracle ASM filename. The alias name must consist of the full directory path and the alias itself
[stextbox id=”grey”]
ALTER DISKGROUP data ADD ALIAS ‘+data/orcl/second.dbf’ FOR ‘+data/orcl/datafile/mytable.342.123456789′;
ALTER DISKGROUP data RENAME ALIAS ‘+data/orcl/datafile.dbf’ TO ‘+data/payroll/compensation.dbf’;
ALTER DISKGROUP data DROP ALIAS ‘+data/payroll/compensation.dbf’;
[/stextbox]
- Oracle Multitenant DB 4 : Parameters/SGA/PGA management in CDB-PDB - July 18, 2020
- Details of running concurrent requests in Oracle EBS - May 26, 2020
- Oracle Multitenant DB 3 : Data Dictionary Architecture in CDB-PDB - March 20, 2020
fantastic article….please update more articles about RAC
Thanks Brijesh for your Wonderful Blog.
Nice Brijesh Gogia.
Amazing Blog Brijesh Gogia. Keep it up and update more about RAC.