0% found this document useful (0 votes)
116 views

Oracle ASM Interview Questions and Answers

Uploaded by

Mortal FC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

Oracle ASM Interview Questions and Answers

Uploaded by

Mortal FC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

ASM Interview Questions and Answers

1. Which are the storage solutions for Oracle RAC?

a. Oracle ASM
b. OCFS – Windows
c. OCFS2 (Oracle Cluster File System) – Linux
d. NFS

We may optionally use third-party cluster file system or cluster-aware volume manager that is certified
for Oracle RAC. Oracle highly recommends using ASM as the storage solution for RAC.

2. What is OMF (Oracle Managed Files)?

Oracle Managed Files (OMF) simplifies the creation of databases as Oracle does all OS operations and file
naming. It has several advantages.

a. Automatic cleanup of the filesystem when database objects are dropped.


b. Standardized naming of database files.
c. Increased portability since file specifications are not needed.
d. Simplified creation of test systems on differing operating systems.
e. No unused files wasting disk space.

3. What are the different RAID levels?

RAID 0 – provides striping capability. RAID 1 – Provides mirroring capability.


RAID 0+1 – First striping, then mirrored RAID 1+0 – First mirroring then striping
RAID 5 – With additional parity RAID 6 – With additional parity

4. What is ASM?

Automatic Storage Management (ASM) is a new feature that has be introduced in Oracle 10g to simplify
the storage of Oracle datafiles, control files and log files. The ASM functionality is an extension of the
Oracle Managed Files (OMF) functionality that also includes striping and mirroring to provide balanced
and secure storage.

(Traditional Filesystem) (Using ASM)


5. How ASM does integrates with OMF?

Oracle Automatic Storage Management (ASM) integrates with Oracle Managed Files (OMF) by integrating
the OMF hierarchical structure and removing the need for file manageability.

How to find whether my database using OMF or not

If we have named datafiles, controlfiles, and redolog files manually, then OMF is not enabled.

For best practices using ASM, every database should implement the Oracle Managed File (OMF) feature.
OMF can be enabled by setting the DB_CREATE_FILE_DEST and DB_RECOVERY_FILE_DEST parameters.
OMF will allow simpler file naming and also provides better file handling. For example, if a tablespace is
dropped, ASM will delete the file automatically only if it is an OMF datafile. If OMF is not used, then the
DBA must drop the file manually by connecting to the ASM instance.

Is OMF is default for ASM?

Yes

Is OMF mandatory for ASM?

No, but it is highly recommended.

6. What are the advantages of using ASM?

a. It spreads I/O across the disk uniformly.


b. Performs automatic rebalance upon disk addition and deletion
c. Capable of leveraging multipath layer.
d. Mirroring and striping capability.
e. tightly coupled with OMF
f. Reduces administration complexity.
g. Overcomes file size limitation

7. What are the reasons ASM is better than file system for an Oracle database?

a. Management and administration


b. Performance

ASM disks are block devices that are accessed using direct I/O. This bypasses a lot of moving parts
that you will typically find in a cooked file system. Raw/direct disk I/O is faster than doing I/O via
a kernel file system driver.

8. How ASM achieves load balancing?

Oracle Automatic Storage Management (ASM) uses striping and mirroring to balance I/O load across
disks in a disk group:
Stripping

Writes data in a round-robin fashion across disks to balance I/O load. This minimizes I/O latency for small
I/O operations.

Mirroring
Mirrors data based on file extents to ensure that file extents are equally distributed across disks.

9. Explain the mirroring concept in Oracle ASM?

Oracle Automatic Storage Management (ASM) mirroring is the process of keeping redundant copies of
data on multiple disks to prevent data loss in case of disk failure:

How it works

ASM mirroring is done at the extent level, typically 1 MB, and can be configured for two or three-way
mirroring.

Why it's important

Mirroring protects data integrity by ensuring that there is always a copy of the data on a different disk in
case one of the disks fails.

How it's configured

When ASM allocates an extent for a Normal Redundancy Diskgroup, it creates a primary copy and a
secondary copy. The secondary copy is placed on a disk in a different Failure Group than the primary
copy.

10. What is ASM striping?


Oracle ASM separate files into stripes and spread them across all the disks of a disk group.

Striping is mainly performed to balance the load across the disks and to reduce the I/O latency.

Two types of striping

 Coarse Grained – Stripe size is same as of AU size of diskgroup. Datafiles, redologs and
temp files are coarse grained.

 Fine Grained – The stripe size is 128KB and is useful for files of small size. Control file is
fine grained.

11. What is an ASM instance?

An ASM instance is a component of Oracle's Automatic Storage Management (ASM) feature that
manages disk groups and metadata for Oracle ASM files. ASM instances are built on the same technology
as Oracle Database instances and have similar System Global Area (SGA) and background processes.
The following tasks are done by ASM instance:

1. Manages metadata.
2. Allocates space.
3. Provides file layout information.
4. Controls disk groups.

12. How many ASM instances can have in a same server?

Multiple ASM instances can be configured in a same server. However, normal configuration keeps only
one to one relationship with an ASM instance and RDBMS instance.

Please note, multiple databases can share a single ASM instance.

13. Which are the ASM specific initialization parameters?

 INSTANCE_TYPE – It is ASM or RDBMS


 DB_UNIQUE_NAME – Specifies a globally unique name for the database. This defaults to +ASM.
 ASM_POWER_LIMIT - The maximum power for a rebalancing operation on an ASM instance.
 ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM instance during
instance startup
 ASM_DISKSTRING - Specifies a value that can be used to limit the disks considered for discovery.

14. What are the startup options for ASM instance?

ASM instance are started and stopped in a similar way to normal database instances. The options for
the STARTUP command are:

 FORCE - Performs a SHUTDOWN ABORT before restarting the ASM instance.


 MOUNT - Starts the ASM instance and mounts the disk groups specified by
the ASM_DISKGROUPS parameter.
 NOMOUNT - Starts the ASM instance without mounting any disk groups.

15. What are the shutdown options for ASM instance?

The options for the SHUTDOWN command are:

 NORMAL - The ASM instance waits for all connected ASM instances and SQL sessions to exit
then shuts down.
 IMMEDIATE - The ASM instance waits for any SQL transactions to complete then shuts down. It
doesn't wait for sessions to exit.
 TRANSACTIONAL - Same as IMMEDIATE.
 ABORT - The ASM instance shuts down instantly.

16. What is an ASM disk?

The Storage administrator will identify a set of disks and create the appropriate LUNs from the storage
array and finally present them to the host. The ASM disk could be any of these
1. Raw disk partition - A disk partition can be the entire disk drive or a section of a disk drive.
2. Logical Unit Numbers (LUN) - A LUN is a disk presented to a computer system by a storage
array. Oracle recommends that you use hardware RAID functionality to create LUNs. Storage
hardware RAID 0+1 or RAID5, and other RAID configurations, can be provided to Oracle ASM as
Oracle ASM disks.
3. Raw logical volume (LVM) - A logical volume is supported in less complicated configurations
where a logical volume is mapped to a LUN, or a logical volume uses disks or raw partitions.
Logical volume configurations are not recommended by Oracle because they create a duplication
of functionality.

17. Describe ASM disk discovery process?

Disk discovery is the mechanism used to find the operating system names for disks Oracle ASM can
access.
This mechanism finds all the disks that comprise a disk group to be mounted, the disks an administrator
wants to add to a disk group, or the disks the administrator might consider adding to a disk group.

How a disk is discovered?

 When an Oracle ASM instance is initialized, Oracle ASM discovers and examines the contents of
all of the disks that are in the paths that you designated with values in
the ASM_DISKSTRING initialization parameter.
 After Oracle ASM successfully discovers a disk, the disk appears in the V$ASM_DISK view with the
respective status of the disk header like MEMBER, CANDIDATE, PROVISIONED, FORMER.

18. What are the different redundancy types in oracle ASM?

a. External redundancy – Oracle ASM doesn’t provide mirroring redundancy and relies on the
storage system to provide RAID functionality.
b. Normal redundancy – Oracle ASM provides two-way mirroring by default, which means that all
files are mirrored so that there are two copies of every extent. A loss of one oracle ASM disk is
tolerated.
c. High redundancy – Oracle ASM provides three-way mirroring by default. A loss of two oracle
ASM disks in different failure group is tolerated.

19. What are the different header status of ASM disks?

CANDIDATE – Disk is available and can be added to diskgroup. (Usually in Solaris sparc, hpux)

PROVISIONED – Same as candidate disk, but disk was provisioned using ASMLib. (Usually in Linux,)

MEMBER – Means disk is already part of a diskgroup

FORMER – Mean disk was formerly part of a diskgroup, but currently not part of any diskgroup.

20. What is an ASM diskgroup?

Collection of ASM disks that are controlled as a single unit.


21. What is an ASM failure group?

Failure groups are used to store mirror copies of data. When ASM allocates an extent for a normal
redundancy file, ASM allocates a primary copy and a secondary copy. ASM chooses the disk on which to
store the secondary copy so that it is in a different failure group than the primary copy. Each copy is on
a disk in a different failure group so that the simultaneous failure of all disks in a failure group does not
result in data loss.
There are always failure groups even if they are not explicitly created. If you do not specify a failure group
for a disk, then Oracle automatically creates a new failure group containing just that disk.

22. Can I keep disks of different sizes in a diskgroup?

Though we can keep different sized disks in a diskgroup, the extent distribution will be unbalanced. And
it will induce unbalanced I/O across the diskgroup.

Oracle always recommends to use disks of same size in a diskgroup.

23. How many diskgroups can have in an ASM instance?

Minimum only one diskgroup is needed for all database files. However, best practice is to keep another
diskgroup for recovery files.

Example: Keep +DATA diskgroup for database files and +FRA for recovery files.

24. Can we change the diskgroup redundancy after creating the diskgroups?

No, once a diskgroup is created, its redundancy cannot be changed. The only way to change the
redundancy is to create a new diskgroup with required redundancy and move the datafiles on it using
RMAN restore or DBMS_FILE_TRANSFER.

25. What is the + sign in every ASM diskgroup?

+ Sign shows that it’s a root directory (+DATA, +FRA etc.…)

26. How to identify a failed disk in ASM?

select path, name, mount_status, header_status


from v$asm_disk
where WRITE_ERRS > 0

select path, name, mount_status, header_status


from v$asm_disk
where READ_ERRS > 0;

But despite the read/write errors, the header_status column value may still be shown as "MEMBER".

27. What is ASM data scrubbing?

Disk scrubbing checks logical data corruptions and repairs them automatically in normal and high
redundancy disks groups. The scrubbing process repairs logical corruptions using the mirror disks. Disk
scrubbing can be combined with disk group rebalance to reduce I/O resources.” This feature is available
in ASM version 12c.

SQL> ALTER DISKGROUP data SCRUB POWER LOW;

SQL> ALTER DISKGROUP data SCRUB FILE '+DATA/ORCL/DATAFILE/example.266.806582193'

REPAIR POWER HIGH FORCE;

SQL> ALTER DISKGROUP data SCRUB DISK DATA_0005 REPAIR POWER HIGH FORCE;

 The optional REPAIR option automatically repairs disk corruptions. If the REPAIR option is not specified,
then the SCRUB option only checks and reports logical corruptions of the specified target.
 The optional POWER value can be set to AUTO, LOW, HIGH, or MAX. If the POWER option is not
specified, the power value defaults to AUTO and the power adjusts to the optimum level for the system.
 If the optional WAIT option is specified, the command returns after the scrubbing operation has
completed. If the WAIT option is not specified, the scrubbing operation is added into the scrubbing queue
and the command returns immediately.
 If the optional FORCE option is specified, the command is processed even if the system I/O load is high
or scrubbing has been disabled internally at the system level.
 The scrubbing process is visible in the fields of the V$ASM_OPERATION view while the scrubbing process
is running.

28. What is ASM Dynamic Volume Manager (ADVM)?

Oracle ASM Dynamic Volume Manager provides volume management services and a standard disk
device driver interface to clients.
You can store additional files except from database files on the ASM Disks such as binary files, trace
files, log files etc.

To create a volume: ALTER DISKGROUP data ADD VOLUME volume1 SIZE 5G;

29. How ASM handles the disk failure?

Let’s explain the answer with an example for the easy understanding.

Consider Normal Redundancy diskgroup DATA1 with 2 failgroups called MIRROR1 and MIRROR2. Each
failgroup has 3 x disks (let's say 512GB).
Now assume that Disk2 in Failgroup1 fails.

Disk 2 in failgroup MIRROR1 fails. The MIRROR1 failgroup is not available as a result. DB operations
continue unaware of the problem as MIRROR2 is online and working fine.

The dba cannot fix disk 2 within the meantime for repair period of ASM. ASM forces disk 2 out the
MIRROR1 failgroup by force dropping it. MIRROR1 has now 2 disk remaining.

ASM starts a rebalance process to stripe the contents of the MIRROR1 failgroup across 2 disks - as oppose
to 3 disks. If the space in use fits on 2 disks the rebalance operation will succeed. MIRROR1 will become
online and available. But it will only be able to carry 1TB of data, as oppose to MIRROR2 with it 3 disks
and 1.5TB capacity.

If the space used cannot be striped across the remaining disks in MIRROR1, the rebalance will fail due to
insufficient capacity and the failgroup will remain offline.

In either scenario, the recommended action is to add a new 512GB disk to MIRROR1, reverting it back to
a 3 disk failgroup, and then rebalance the failgroup.

30. What are the steps to copy datafiles from one diskgroup to another diskgroup using RMAN?

Below steps shows the datafile movement from +DATA diskgroup to +NEWDATA

a. Connect to RMAN and identify the name of the datafile to move.


rman target /
report schema;
b. Backup the datafile to the new ASM diskgroup

BACKUP AS COPY DATAFILE ‘+DATA/orcl/datafile/test.255.876787656’ FORMAT ‘+NEWDATA’

c. Offline the datafile that we intent to move to the new diskgroup

RMAN> sql “alter database datafile ‘+DATA/orcl/datafile/test.255.876787656’ ‘ offline”;

d. Switch the datafile to the new copy. Following command will point the controlfile to the
newly created copy of the datafile.

RMAN> sql “SWITCH DATAFILE ‘+DATA/orcl/datafile/test.255.876787656’ FORMAT TO COPY”;


Note: output of this command will show a new name for the datafile.

e. Recover the renamed datafile.

RMAN> RECOVER DATAFILE ‘+NEWDATA/orcl/datafile/test.261.6787654345’;

f. Bring the datafile online

RMAN> sql “ALTER DATABASE DATAFILE ‘+NEWDATA/orcl/datafile/test.261.6787654345’


ONLINE”;

g. Delete the old copy of the datafile.

RMAN> DELETE DATAFILECOPY ‘+DATA/orcl/datafile/test.255.876787656’;

31. Which are the queries related to diskgroup?

a. create diskgroup

SQL> create diskgroup DATA EXTERNAL REDUNDANCY disk '/dev/oracleasm/disks/DISK1' name


DATA_1;

SQL> CREATE DISKGROUP data NORMAL REDUNDANCY FAILGROUP failure_group_1 DISK


'/dev/oracleasm/disks/DISK2' NAME DATA_2, '/dev/oracleasm/disks/DISK3' NAME DATA_3
FAILGROUP failure_group_2 DISK
'/dev/oracleasm/disks/DISK4' NAME DATA_4, '/dev/oracleasm/disks/DISK5' NAME DATA_5;
b. Drop a diskgroup

DROP DISKGROUP data INCLUDING CONTENTS;

c. Alter a diskgroup
 ALTER DISKGROUP data ADD DISK '/dev/oracleasm/disks/DISK6'; - adding a new disk to diskgroup
 ALTER DISKGROUP data DROP DISK DATA_5; - dropping a disk from the diskgroup
 ALTER DISKGROUP DATA REBALANCE POWER 8; - Manual rebalance of the data in the diskgroup.
 ALTER DISKGROUP data MOUNT; - Mount a specific diskgroup
 ALTER DISKGROUP data DISMOUNT; - Unmount a specific diskgroup
 ALTER DISKGROUP ALL MOUNT; - Mount all diskgroups
 ALTER DISKGROUP ALL DISMOUNT; -Unmount all diskgroups
 ALTER DISKGROUP data CHECK ALL; - Verify the internal consistency of disk group metadata
 ALTER DISKGROUP data RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 1024G; - Resize all disks
in a failure group.
 ALTER DISKGROUP data RESIZE DISK DATA_0006 SIZE 100G; - Resize a specific diskgroup
 ALTER DISKGROUP data RESIZE ALL SIZE 100G; - Resize all disks in a diskgroup.
32. Suppose we need 5 disks of 1 TB each to an existing diskgroup. Should I add them one by one or
add all the 5 disk at a time? Which method will create less overhead?

I t is a best practice to add and drop multiple disks at a time so that ASM can reorganize partnership

information within ASM metadata more efficiently.


33. Can we take export backup to ASM diskgroup?

Yes we can. Create a directory under ASM path.

Create directory EXPDIR as ‘+FRA/BACKUP’;

34. What is allocation unit in ASM?


 AU is the fundamental unit of allocation in a diskgroup.
 Default AU is 1 MB, can be changed to 2, 4, 8, 16, 32MB etc.
 In exadata default AU is 4 MB. This is a disk group attribute.
 So, each diskgroup can have their own AU_SIZE attribute.
 For flex disk groups, the default value for AU size is set to 4 MB

35. How to decide the right Allocation Unit for ASM diskgroup?

AU size of between 1 MB and 4 MB for mostly OLTP workloads, and an 8 MB or larger AU size for OLAP
workloads.
For very large databases, a 16 MB or larger AU size should be considered for diskgroups where most of
the data will be stored.

36. What is an ASM Extent?

ASM Extent consists of one or more AU. The initial extent size is the same as the disk group allocation
unit (AU) size. After that, the extent size increases by a factor of 4 or 16 at certain thresholds.

It is important to remember that when using ASM mirroring, ASM mirrors by ASM extent, not disk or
diskgroup.

For disk groups with AU size less than 4 MB:

 Extent size always equals the disk group AU size for the first 20000 extent sets (0 - 19999).
 Extent size equals 4*AU size for the next 20000 extent sets (20000 - 39999).
 Extent size equals 16*AU size for the next 20000 and higher extent sets (40000+).

An ASM File consists of one or more ASM Extents.

37. Why extent size varies?

For each extent there’s an extent map present in the shared pool. If a large database uses the default
extent size, which is equal to AU_SIZE, then sga memory requirement for ASM instance will be very high
and it needs to store a lot extent maps in memory. With variable extent size feature, database needs fewer
extents to describe an ASM file, and less memory to manage the extent maps in the shared pool.
38. What is a quorum failure group?

A quorum failure group is a special type of failure group that is used to store the Oracle Clusterware
voting files. The quorum failure group is used to ensure that a quorum of the specified failure groups is
available. When Oracle ASM mounts a disk group that contains Oracle Clusterware files, the quorum
failure group is used to determine if the disk group can be mounted in the event of the loss of one or
more failure groups. Disks in the quorum failure group do not contain user data, therefore a quorum
failure group is not considered when determining redundancy requirements in respect to storing user
data.

39. What is disk group dynamic rebalancing?

Diskgroup dynamic rebalancing is a feature in Oracle ASM that automatically redistributes data across
disks in a disk group. This is done in the background, with minimal impact on the database performance.

It happens automatically when a disk is added or removed from a diskgroup.

40. How rebalancing happens in Oracle ASM?

Consider that a new disk has been added to an ASM diskgroup. Rebalance operation will occur as in
sequence below.

a. RBAL process will create a rebalance plan and begin coordination of the redistribution.

b. RBAL calculates the estimated time and work required to perform the rebalance and inform ARBx
process to handle the request. ASM_POWER_LIMIT parameter decides how many ARBx processes
to be spawned.

c. Continues Operations Directory (COD) is updated with the details of the ongoing rebalance. This
is needed when rebalance gets failed in the middle, then other instance can take over and decide
either to complete or rollback the rebalance operation.
d. RBAL distributes the plans for each files to the ARBs and it perform rebalance on the respective
extents by locking, relocating and unlocking.

Rebalance operation can be monitored using a view called v$asm_operation.

41. What is fast rebalance operation in ASM?

Usually, when we add or drop disks to a diskgroup, rebalance is initiated and communication started
between all the active ASM instances. And if rebalance operation is big one, then these messaging
between the asm instances can cause a delay.
So in a situation, where user don’t need to access the diskgroup, then we can use this fast rebalance
feature. Means rebalance will be performed by only one asm instance.
Note – The asm diskgroup will be accessible to oracle database during this phase.
Steps for fast rebalance in 2 node RAC:
1. Dismount the diskgroup from all the asm nodes.
2. Mount the diskgroup only one node asm instance with restrict( ALTER DISKGROUP DATA
MOUNT restrict)
3. Do storage activities like add/drop disk ( this will start the rebalance)
4. Once rebalance is completed. Dismount the diskgroup from that one node. And MOUNT the
diskgroup on all nodes of cluster.

42. Is it possible to increase the power limit of a running rebalance operation?

Yes, we can increase the power limit of existing rebalance operation. As soon as a request is placed,
additional ARB processes will be spawned and completes the rebalance operation.
What if we reduce the number of processes? Yes, that’s also possible. Only needed processes will keep
running and other ARB processes will be closed after completing their task.

43. What is this compact phase in asm rebalance? Is it really necessary and can we disable it?

In compact phase, the data is moved to outer layer of the asm disks. Because outer region or the hot
track has good bandwidth and greater speed.
Compact phase may take some time during the rebalance operation. So if we are using flash disks,
then there is no need of compacting. So we can chose the disable it depending on which oracle
version you were.
Oracle 12c onward :( we can alter at diskgroup level)
ALTER DISKGROUP <dg> SET ATTRIBUTE ‘_rebalance_compact’=’FALSE’;

Prior to 12c (We need to change parameter at instance level)


alter system set _disable_rebalance_compact=true ….

44. What could be the reason for unbalanced disks?

To clarify more, all disks are of same size but it is found that disks are not balanced.
This could be due to following reasons.
 Either ASM disk was added with rebalance power of zero.

 Previous rebalance operation was aborted due to some error and is not completed afterwards.

45. What is Continues Operations Directory (COD)?

In Oracle Automatic Storage Management (ASM), COD stands for Continuing Operation Directory. It's
similar to an undo tablespace and is responsible for maintaining the state of active ASM operations.

There’re two types of continuing operations.

1. Background operation

A background operation is performed by an ASM instance background process. It is done


as part of a disk group maintenance and it continues until it is either completed or the
ASM instance dies. If the instance dies, then the recovering instance needs to resume the
background operation. The disk group rebalance is the best example of a background
operation.
2. Rollback operation

A rollback operation is similar to a database transaction. It is started at the request of an


ASM foreground process. Creating a file is a good example of a rollback operation. If an
error occurs while allocating the space for the file, then the partially created file must be
deleted. If the database instance does not commit the file creation, the file must be
automatically deleted. If the ASM instance dies then this must be done by the recovering
instance.

46. What is ASM Fast Disk Resync?

By default, when a disk in an ASM disk group fails the disk will be taken offline automatically. The disk
will be dropped some 3.6 hours later. As a result, you have only 3.6 hours by default to respond to a disk
outage. If you correct the problem and the physical disk media is not corrupted, then ASM fast disk resync
will quickly re-synchronize the disk when it comes back online, correcting the problem very quickly.

ALTER DISKGROUP data SET ATTRIBUTE 'disk_repair_time' = '4.5h'


ALTER DISKGROUP data SET ATTRIBUTE 'disk_repair_time' = '270m'

47. What is ASM power limit?

ASM_POWER_LIMIT parameter controls the throughput and speed of the rebalance operation.

In 12c the values varies from 1-1024. Value of 0 will disable the automatic rebalance operation.

If asm_power_limit is 10, then 10 ARBn processes will be created to do the rebalance job. But please note,
higher value of asm_power_limit can cause more CPU load. So always use a balanced value and try to do
these in non-peak hours.

48. What is ASM Metadata?

ASM stores metadata to describe and track diskgroup contents. All of the metadata that describe the
composition and contents of an ASM diskgroup are stored within the diskgroup itself, which makes each
diskgroup self-describing.

Default ASM Metadata block size is 4k.

ASM has two main classes of metadata.

1. Physical Metadata (They’re stored in fixed locations of disk, needed for ASM bootstrapping)
 Disk Header
 Allocation Table (AT) – (Each disk has an AT to track free and allocated space)
 Free Space Table (FST) – ( Tracks free AU in Allocation Table Block)
 Partnership Status Table (PST) -
2. Virtual Metadata
 File Directory
 Disk Directory
 Active Change Directory – Same as redolog in database. When ASM needs to
change multiple metadata blocks, a log record is written into ACD.
 Continuing Operations Directory (COD)
 Attribute Directory
 Staleness Directory – Contains metadata to map the slots in staleness registry to
disk.
 Staleness Registry – Tracks AU that become stale when the disk is offline.

49. How to backup and restore ASM metadata?

ASM diskgroup metadata backup is performed using md_backup command. If no diskgroup specified
ASM md_backup backs up all the mounted diskgroup metadata.

Backup

ASMCMD> md_backup /home/oragrid/dg_bkp -> backup metadata of all diskgroups.


ASMCMD> md_backup /home/oragrid/dg_bkp_DG_FLEX_DATA -G DG_FLEX_DATA-> Backup a specific
diskgroup.

Restore

ASMCMD> md_restore /home/oragrid/dg_bkp_DG_FLEX_DATA --full -G DG_FLEX_DATA -> To restore a


specific diskgroup with the same name as before.

ASMCMD>md_restore /home/oragrid/dg_bkp_DG_FLEX_DATA --newdg –o


'DG_FLEX_DATA:DG_FLEX_FRA' -> To restore a diskgroup with a different name.

Note: - md_backup does not take the backup of data and therefore md_restore does not restore the data.
It just takes the diskgroup metadata backup so incase if you lose your diskgroup you can rebuild its
structure from scratch. Once you have built the diskgroup you can restore the data in diskgroup using
RMAN/Import etc. depending the backup solution you use to backup your database.

50. What is an ASM template?

Templates are collections of file attribute values, used to set mirroring and striping attributes of each type
of database file (datafile, control file, redo log file, and so on) created in ASM disk groups.

chtmpl Changes the attributes of a template.

lstmpl Lists disk group templates.

mktmpl Adds a template to a disk group.

rmtmpl Removes a template from a disk group.


51. Explain how extent relocation happens in asmdisks?

Relocation is the act of moving extents from one disk to another disk in a diskgroup, which mostly
happens during rebalance operation. Relocation happens per extent basis.

There two relocation scenarios.

File close

For a given extent, if the file is closed, then ASM can relocate the extents without sending any message
to other ASM or RDBMS instance.

File open

 But for a given extent, if the file is open, then the asm instance, which is handling this relocation,
will first send a message to all the asm instances that it is planning to relocate the extent. The asm
instances will again send messages to rdbms instance using umbilicius.
 Now rdbms will delay the write to this extent until relocation is completed. (Though chances are
small that, the rdbms is writing to the extent, which is getting relocated at the same time).
 Now asm will do the actual relocation. And at this time, if any rdbms instance wants to read that
extent, they can read from the old location also. But if write request comes, then they need to wait
till relocation is completed.
 Once relocation is done, asm will release the old AU extents to free pool.

52. Explain how ASM crash recovery happens?

ASM crash recovery is similar to that of database instance crash recovery. Two virtual metadata directories
are responsible for crash recovery.

 Active change Directory (ACD) – Which is like REDO in database


 Continuous Change Directory (COD) – Which is like UNDO in database

When we asm crash recovery Means it is asm diskgroup recovery. During recovery

 First the surviving instance applies the ACD record associated with crashed instance. Applying
ACD records ensure that the asm cache is in consistent mode.
 After ACD recovery is completed, COD recovery happens if any long running operation like file
creation or disk addition was going on during instance crash.

53. What are kfed and kfod utilities in ASM?

kfed

A utility that can read, repair, and examine ASM disk headers and metadata. It can be used to diagnose
issues when ASM disk groups can't be mounted. KFED can be found in $GRID_HOME/bin/kfed.

Example: kfed read /dev/sdd1


kfod

A utility that can be used to perform disk discovery during installation. It can also be used to check the
redundancy of ASM disk groups.

54. What is Flex ASM?

Flex ASM is a feature introduced in Oracle 12c onwards to remove the dependency of one to one
relationship with RDBMS and ASM instance on the same node.

In detail, prior to 12c, it was mandate that one both RDBMS and ASM instance should run on the same
node and if the ASM instance goes down, database will also be down. When it comes to 12c and flex
ASM is introduced, even if the ASM instance on a node is down, RDBMS instance will switch it’s connection
to the ASM instance running on the another node of the cluster without any interruptions.

The following image also illustrates that it is not mandate to run both ASM and RDBMS instances on the
same node.

Command to check if Flex ASM is enabled

asmcmd showclustermode
(Or)
crsctl get cluster mode status

Query to check the status of ASM running on each nodes and how many clients are connected.

srvctl status asm –detail


select * from v$asm_client;
asmcmd lsct
55. What is oracle ASM flex diskgroup, file group and quota group?

Oracle has introduced the concept of FlexASM from 12.2 onwards.

When multiple databases share the same diskgroup, there may be chances that not all attributes applies
to all databases. For example, 1 PROD, 1 TEST, 1 DEV databases might be using the diskgroup and
rebalance power_limit for prod will be high and it can be low for TEST and DEV. Setting different values
are not possible normally. Hence Oracle has introduced the concept Flex diskgroup wherein file groups
and quota groups are created. The following images shows the difference.

A flex disk group requires a minimum of three failure groups and the redundancy setting of a flex disk
group is set to FLEX REDUNDANCY. The flex disk group can tolerate two failures which is the same as a
HIGH redundancy disk group.

File group

An Oracle ASM file group is a group of files that share the same set of properties and characteristics.

Quota group

A quota group defines the quota allocated to a group of Oracle ASM File Groups. A file group belongs to
only one quota group.

56. What is extended diskgroup?

An Oracle ASM extended disk group has all the features of a flex disk group, with a specific design to be
highly available in an extended (stretch) cluster environment, which contains nodes that span multiple
physically separated sites.

SQL> CREATE DISKGROUP extended_site_data EXTENDED REDUNDANCY

SITE NY FAILGROUP fg1 DISK '/devices/disks/disk01'

FAILGROUP fg2 DISK '/devices/disks/disk02'

FAILGROUP fg3 DISK '/devices/disks/disk03'

SITE NJ FAILGROUP fg4 DISK '/devices/disks/disk04'

FAILGROUP fg5 DISK '/devices/disks/disk05'

FAILGROUP fg6 DISK '/devices/disks/disk06'


SITE QM QUORUM

FAILGROUP fg7 DISK '/devices/disks/disk07';

57. What are the steps to create ASM flex diskgroup and add a database to it?

SQL> CREATE DISKGROUP flex_data FLEX REDUNDANCY DISK my_disk_discovery_path;

SQL > ALTER DISKGROUP DiskGroup_1 ADD FILEGROUP FileGroup_PDB1 DATABASE PDB1 SET
'quota_group' = 'QuotaGroup_QGRP1';

58. What are the best practices to consider when using ASM disks?

 In most cases you will only need two disk groups (DATA and FRA), where DATA holds all database
related files and FRA holds the fast recovery area, including multiplexed copies on online redo
logs and control files. Typically, the FRA disk group will be twice the size of the DATA disk group,
since it must hold all backups.
 Oracle recommend a minimum of 4 LUNs per disk group, with LUNs using hardware RAID and
external redundancy if possible.
 All LUNs within a disk group should be the same size and have the same performance
characteristics.
 LUNs should be made up from disks dedicated to Oracle, not shared with other applications.

59. How an RDBMS instance connects to the ASM instance?

When an ASM instance is started, it registers with CSS (Cluster Synchronization Daemon) running as
cssd.bin. This is part of Oracle Clusterware, but the occsd.bin runs in a single instance configuration as
well.

RDBMS contacts CSS and get passed the connect string for the ASM instance. RDBMS’s ASMB then
connects as SYSDBA to the ASM instance using OS authentication.

60. Where do I run my database listener from; i.e., ASM HOME or DB HOME?

It is recommended to run the listener from the ASM HOME. This is particularly important for RAC env,
since the listener is a node-level resource. In this config, you can create additional [user] listeners from
the database homes as needed.

61. How a datafile read requests are sent to ASM by RDBMS instance?

RDBMS maintains a series of connections to ASM instance via ONN background process (ONN process
opens a connection between the database instance and the ASM for metadata operations).

a. RDBMS sends a request to open a file via ONN background process to the ASM instance.
b. ASM instance then sends an extent map to the RDBMS instance.
c. RDBMS instance use the extent map to perform I/O direct to the file.

Note: Always keep in mind that I/O requests from RDBMS do not go via ASM instance, but straight to the
devices using the extent map. ASM instance only looks after the metadata that describes disk groups and
extent allocations.
62. How a file creation requests are sent to ASM by RDBMS instance?

1. RDBMS sends a request to the ASM instance to create a file via ONN background process. This
request contains the information on the size of the file to create, the type and the disk group name
where to create the file in.
2. The ASM instance then uses this information to allocate the appropriate number of extents on the
correct disks.
3. After allocating the extents for the file ASM sends the extent map information back to the RDBMS
instance and creates an entry in its Continuing Operations Directory (COD) metadata file.
4. Once the RDBMS has the extent map it can issue the I/O to initialize the file.
5. After this I/O has completed, the RDBMS instance messages the ASM instance that the creation of
the file has completed successfully. The ASM instance then updates its metadata files to reflect the
change.
6. Should the RDBMS decide to abort the file creation, then ASM can use the COD to roll back the
creation of the file, which includes freeing the space that was allocated for the new file.

63. How can we improve the I/O performance between the ASM instance and RDBMS instance?
As database perform I/O directly with the ASM disks, it doesn’t go through the ASM instance. In fact, in
terms of input and output operation, no relationship is there between RDBMS and ASM instances.

64. Can my RDBMS and ASM versions be different?

Yes. ASM can be at a higher version or at lower version than its client databases.

65. Which are the compatibility parameters in ASM?

 COMPATIBLE.ASM: Determines the minimum ASM software version.


 COMPATIBLE.RDBMS: Determines the minimum database initialization parameter setting for any
database instance that uses the disk group.
 COMPATIBLE.ADVM: The value for the disk group COMPATIBLE.ADVM attribute determines whether
the disk group can contain Oracle ADVM volumes. (ADVM - Oracle ASM Dynamic Volume Manager
(Oracle ADVM)

66. Which are the ASM background processes?

RBAL – This opens all the devices upon discovery and coordinate the rebalance operation.

ARBn – These are the slave processes that do the rebalance operation
DBWR – Writes ASM instance metadata changes in sga buffer to DISK.

LGWR – It manages the active change directory and flushes the ACD change records to disk.
PMON – This manages process and process death.

GMON – This manages disk level activities like disk drop/add/offline/online.

MARK – Mark allocation Unit, process coordinates the updates to the staleness registry
SMON – System Monitor process

PING – Monitors network latency


67. Suppose the spfile location inside the GPnP profile is missing, Will the asm start during cluster
startup?

When an Oracle ASM instance searches for an initialization parameter file, the search order is:
1. The location of the initialization parameter file specified in the Grid Plug and Play (GPnP)
profile
2. If the location has not been set in the GPnP profile, then the search order changes to:
SPFILE OR PFILE in the Oracle ASM instance home. For example, the SPFILE for Oracle
ASM has the following default path in the Oracle Grid Infrastructure home in a Linux
environment:$GRID_HOME/dbs/spfile+ASM.ora

68. What is ASMLib?

ASMLib, short for "Automatic Storage Management Library," is a support library provided by Oracle for
managing Oracle ASM (Automatic Storage Management) on Linux systems. It simplifies the
administration and management of Oracle ASM disk groups and volumes by providing a set of utilities
and kernel modules.

ASMLib is typically used in Oracle Database environments to interact with ASM disks and is specifically
designed to work with Oracle ASM. All ASMLib installations require the oracleasmlib and oracleasm-
support packages appropriate for their machine.

69. What are the steps to configure ASMLib and creation of disks?
1. Creation of user and group for ASM.
2. Add raw disks to the server (It should be shared between all nodes in the cluster in case of RAC). OS
administrator must perform step1 and step2.
3. List the disks

fdisk -l
(or)
lsblk
Sample output:
4. Create partitions for the disks.
fdisk /dev/sdb
lsblk – to see the disks after creating partitions
5. Install ASMLib packages
yum install -y oracleasm
yum install -y oracleasm-support
yum install oracleasmlib
6. Configure Oracle ASMLib
/usr/sbin/oracleasm configure -i
/usr/sbin/oracleasm init
/usr/sbin/oracleasm status
7. Now create ASM disks
/usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
/usr/sbin/oracleasm scandisks
/usr/sbin/oracleasm listdisks
8. List oracleasm disks
ls -ltra /dev/oracleasm/disks/*
70. What is the security compromise of using ASMLib and its solution?
The ASM disks were owned by GI homeowner and both the owner and any users belonging to an
operating system group designated as the OSASM group could read from and write to ASM disks
using OS commands like strings, echo, dd etc. This led to compromising the security of data as well
as accidental corruption of the data in the ASM disks and ASM disks themselves.
As a solution, Oracle has introduced ASMFD (ASM Filter Driver) from 12.1.0.2 version onwards.
71. What is Oracle ASMFD (ASM Filter Driver)?
Oracle ASMFD is a kernel module that resides in the I/O path of the Oracle ASM disks. ASMFD uses
the filter driver to validate write I/O requests to Oracle ASM disks. Any write I/O requests that are not
issued by Oracle software (e.g. using dd command) are not committed to ASM disks. Thus, it helps to
prevent users, including those with administrative privileges, from inadvertently overwriting Oracle
ASM disks, thereby preventing corruption of the data stored on ASM disk(s) within the disk group(s).
72. What are the steps to configure ASMFD?
1. Verify if ASMFD is configured.
 asmcmd afd_lsdsk – It shows an error Failed to load AFD library if AFD is not installed.
 asmcmd afd_state - The AFD state is 'NOT INSTALLED' and filtering is 'DEFAULT' on host
 SELECT SYS_CONTEXT('SYS_ASMFD_PROPERTIES', 'AFD_STATE') FROM DUAL;
2. asmcmd afd_configure
3. asmcmd afd_state
Output: The AFD state is 'LOADED' and filtering is 'DEFAULT' on host 'host01.example.com'.
73. What are the high-level steps to migrate the diskgroups from ASMLib to ASMFD?
1. Check the list of available disks (oracleasm)
oracleasm listdisks
2. Locate the physical path of disks configured in oracleasm.
3. Check which disks are not part of any of the diskgroups.
4. Consider we have two diskgroups, DATA and TEST. Let’s check out which disks are part of this
diskgroup.
asmcmd dsget
5. Check the configuration of ASM
6. Update the ASM Disk discovery path to enable ASMFD lookup
7. Bring down the clusterware stack
8. Configure ASMFD
a. asmcmd afd_configure
b. asmcmd afd_state
c. vi /etc/oracleafd.conf (mention the diskstring parameter like
afd_diskstring='/dev/xvd*1' )
d. asmcmd afd_filter -e (to enable the filter)
9. Migrate all the ASMLib disks.

asmcmd afd_label ACFSD01 /dev/xvdg1 –migrate


asmcmd afd_label ACFSD02 /dev/xvdg2 –migrate

10. Validate all the migrated disks.

$ORACLE_HOME/bin/asmcmd afd_lsdsk
ls -ltr /dev/oracleafd/disks/

11. Edit the below file with the necessary contents.

[root@hostname1 ~]# vi /etc/afd.conf


#afd_diskstring='/dev/oracleasm/disks/*'
afd_diskstring='/dev/xvd*'
afd_filtering=enable

12. Start the clusterware stack and perform post checks.

crsctl start has

74. What are the high-level steps to migrate a database from filesystem to ASM?

a. Configure Disk for ASM

Install required packages, users and group creation


b. Install Oracle Grid software

Install Oracle grid software.

c. Setup ASM Diskgroups

Use ASMCA (GUI) or oracleasm commands to configure diskgroups.

d. Move Parameter File to ASM

rman target /

backup as backupset spfile;


restore spfile to '+DATA/spfileorcl.ora';

e. Move Control Files to ASM

rman target/

restore controlfile to '+DATA' from '/u01/app/oracle/oradata/ORCL/control01.ctl';


restore controlfile to '+FRA' from '/u01/app/oracle/FRA/ORCL/control02.ctl';

Once controlfiles are restore, update the new location in database.

alter system set control_files='+DATA/CDB1/CONTROL/control01.ctl',


'+FRA/CDB1/CONTROL/control02.ctl' scope=spfile;

f. Move Data Files to ASM

rman target/

backup as copy database format '+DATA';

Switch the database to the data files on ASM.

switch database to copy;

g. Migrate Temp Files to ASM

RMAN>run
{
set newname for tempfile '/u01/app/oracle/oradata/ORCL/temp01.dbf' to '+DATA';
switch tempfile all;
}

h. Migrate Redo Log Files to ASM

alter database add logfile member '+data' to group 1;


alter database add logfile member '+data' to group 2;
alter database add logfile member '+data' to group 3;
alter database add logfile member '+fra' to group 1;
alter database add logfile member '+fra' to group 2;
alter database add logfile member '+fra' to group 3;

75. What are the high-level steps to upgrade grid from 12c to 19c?

1. Review the pre-upgrade checklist.


2. Download 19c Grid software.
3. Run the Orachk readiness assessment.
4. Apply mandatory 19c patches.
5. Run the cluster verification utility.
6. Dry-run upgrade.
7. Upgrade Grid.
8. Verify Grid upgrade.

You might also like