Friday, 8 June 2018

Interview Q and A for Oracle ASM Part - 1

1.     What is ASM in Oracle?
Oracle ASM is Oracle’s volume manager specially designed for Oracle database data. It is available since Oracle database version 10g and many improvements have been made in versions 11g release 1 and 2. 
ASM offers support for Oracle RAC clusters without the requirement to install 3rd party software, such as cluster aware volume managers or filesystems.
ASM is shipped as part of the database server software (Enterprise and Standard editions) and does not cost extra money to run.
ASM simplifies administration of Oracle related files by allowing the administrator to reference disk groups rather than individual disks and files, which are managed by ASM.
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. The new ASM functionality can be used in combination with existing raw and cooked file systems, along with OMF and manually managed files.
In Oracle Database 10g/11g there are two types of instances: database and ASM instances. The ASM instance, which is generally named +ASM, is started with the INSTANCE_TYPE=ASM init.ora parameter. This parameter, when set, signals the Oracle initialization routine to start an ASM instance and not a standard database instance. Unlike the standard database instance, the ASM instance contains no physical files; such as logfiles, controlfiles or datafiles, and only requires a few init.ora parameters for startup.
Upon startup, an ASM instance will spawn all the basic background processes, plus some new ones that are specific to the operation of ASM. The STARTUP clauses for ASM instances are similar to those for database instances. For example, RESTRICT prevents database instances from connecting to this ASM instance. NOMOUNT starts up an ASM instance without mounting any disk group. MOUNT option simply mounts all defined disk groups
For RAC configurations, the ASM SID is +ASMx instance, where x represents the instance number.

2. Advantages of ASM in Oracle? OR List Key benefits of ASM?
The following are some key benefits of ASM:
  • ASM spreads I/O evenly across all available disk drives to prevent hot spots and maximize performance.
  • ASM eliminates the need for over provisioning and maximizes storage resource utilization facilitating database consolidation.
  • Inherent large file support.
  • Performs automatic online redistribution after the incremental addition or removal of storage capacity.
  • Maintains redundant copies of data to provide high availability, or leverages 3rd party RAID functionality.
  • Supports Oracle Database as well as Oracle Real Application Clusters (RAC).
  • Capable of leveraging 3rd party multipathing technologies.
  • For simplicity and easier migration to ASM, an Oracle database can contain ASM and non-ASM files.
  • Any new files can be created as ASM files whilst existing files can also be migrated to ASM.
  • RMAN commands enable non-ASM managed files to be relocated to an ASM disk group.
  • Enterprise Manager Database Control or Grid Control can be used to manage ASM disk and file activities.
  • Stripes files rather than logical volumes
  • Provides redundancy on a file basis
  • Enables online disk reconfiguration and dynamic rebalancing
  • Reduces the time significantly to resynchronize a transient failure by tracking changes while disk is offline
  • Provides adjustable rebalancing speed
  • Is cluster-aware
  • Supports reading from mirrored copy instead of primary copy for extended clusters
  • Is automatically installed as part of the Grid Infrastructure

3. What is ASM Striping?
ASM can use variable size data extents to support larger files, reduce memory requirements, and improve performance. Each data extent resides on an individual disk. Data extents consist of one or more allocation units. The data extent size is:
  • Equal to AU for the first 20,000 extents (0–19999)
  • Equal to 4 × AU for the next 20,000 extents (20000–39999)
  • Equal to 16 × AU for extents above 40,000
ASM stripes files using extents with a coarse method for load balancing or a fine method to reduce latency.
  • Coarse-grained striping is always equal to the effective AU size.
  • Fine-grained striping is always equal to 128 KB.
                                                                
4. What is ASM instance in Oracle?
The ASM functionality is controlled by an ASM instance. This is not a full database instance, just the memory structures and as such is very small and lightweight. 
Characteristics of Oracle ASM instance
1. do not have controlfile and datafiles, do not have online redo logs
2. do have init.ora and a passwordfile
3. for connecting remotely, create passwordfile and set following in init.ora
remote_login_passwordfile=exclusive
create a password file:
$ORACLE_HOME/bin/orapwd file=orapw+ASM1 password=yourpw entries=10
4. ASM instance cannot be in open status as there are not data files. Can be in mount (although
there is no controlfile) and nomount status. When in mount status, database can use the
diskgroup. The mount status means mount disk groups.

5.What are ASM Background Processes in Oracle?
Both an Oracle ASM instance and an Oracle Database instance are built on the same technology. Like a database instance, an Oracle ASM instance has memory structures (System Global Area) and background processes. Besides, Oracle ASM has a minimal performance impact on a server. Rather than mounting a database, Oracle ASM instances mount disk groups to make Oracle ASM files available to database instances. There are at least two new background processes added for an ASM instance:
ASM Instance Background Processes:
ARBx (ASM) Rebalance working process
ARBn performs the actual rebalance data extent movements in an Automatic Storage Management instance. There can be many of these processes running at a time, named ARB0, ARB1, and so on. These processes are managed by the RBAL process. The number of ARBx processes invoked is directly influenced by the asm_power_limit parameter.
RBAL (Re-balancer) RBAL runs in both database and ASM instances. In the database instance, it does a global open of ASM disks. In an ASM instance, it also coordinates rebalance activity for disk groups. RBAL, which coordinates rebalance activities for disk resources controlled by ASM.
Database Instance ASM Background Processes: 
In the database instances, there are three background process to support ASM, namely:
ASMB, this process contact CSS using the group name and acquires the associated ASM connect string. The connect string is subsequently used to connect to the ASM instance.
RBAL, which performs global opens on all disks in the disk group. A global open means that more than one database instance can be accessing the ASM disks at a time.
O00x, a group slave processes, with a numeric sequence starting at 000. 
Process
Description
RBAL
Opens all device files as part of discovery and coordinates the rebalance activity
ARBn
One or more slave processes that do the rebalance activity
GMON
Responsible for managing the disk-level activities such as drop or offline and advancing the ASM disk group compatibility
MARK
Marks ASM allocation units as stale when needed
Onnn
One or more ASM slave processes forming a pool of connections to the ASM instance for exchanging messages
PZ9n
One or more parallel slave processes used in fetching data on clustered ASM installation from GV$ views

6. What are the components of components of ASM are disk groups?
The main components of ASM are disk groups, each of which comprise of several physical disks that are controlled as a single unit. The physical disks are known as ASM disks, while the files that reside on the disks are know as ASM files. The locations and names for the files are controlled by ASM, but user-friendly aliases and directory structures can be defined for ease of reference.
Failure groups are defined within a disk group to support the required level of redundancy. For two-way mirroring you would expect a disk group to contain two failure groups so individual files are written to two locations.

7. What are ASM instance initialization parameters?
INSTANCE_TYPE - Set to ASM or RDBMS depending on the instance type. The default is RDBMS.
DB_UNIQUE_NAME - Specifies a globally unique name for the database. This defaults to +ASM but must be altered if you intend to run multiple ASM instances.
ASM_POWER_LIMIT -The maximum power for a rebalancing operation on an ASM instance. The valid values range from 1 to 11, with 1 being the default. 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.
This value is also used as the default when the POWER clause is omitted from a rebalance operation.
ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM instance during instance startup, or by the ALTER DISKGROUP ALL MOUNT statement. ASM configuration changes are automatically reflected in this parameter. Oracle ASM  automatically removes a disk group from this parameter when the disk group is dropped or dismounted.
                                                      ASM_DISKGROUPS = DATA, FRA
The following is an example of setting the ASM_DISKGROUPS parameter dynamically:
                                                      SQL> ALTER SYSTEM SET ASM_DISKGROUPS = DATA, FRA;
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.
Altering the default value may improve the speed of disk group mount time and the speed of adding a disk to a disk group. Changing the parameter to a value which prevents the discovery of already mounted disks results in an error. The default value is NULL allowing all suitable disks to be considered.
            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/*
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. 
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. 
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. 
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. 
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. 
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

8. Why should we use separate ASM home?
ASM should be installed separately from the database software in its own ORACLE_HOME directory. This will allow you the flexibility to patch and upgrade ASM and the database software independently.

9. How many ASM instances should one have?

Several databases can share a single ASM instance. So, although one can create multiple ASM instances on a single system, normal configurations should have one and only one ASM instance per system.
For clustered systems, create one ASM instance per node (called +ASM1, +ASM2, etc).

10. How many diskgroups should one have?
Generally speaking one should have only one disk group for all database files - and, optionally a second for recovery files (see FRA).
Data with different storage characteristics should be stored in different disk groups. Each disk group can have different redundancy (mirroring) settings (high, normal and external), different fail-groups, etc. However, it is generally not necessary to create many disk groups with the same storage characteristics (i.e. +DATA1, +DATA2, etc. all on the same type of disks).
To get started, create 2 disk groups - one for data and one for recovery files. Here is an example:
CREATE DISKGROUP data    EXTERNAL REDUNDANCY DISK '/dev/d1', '/dev/d2', '/dev/d3', ....;
CREATE DISKGROUP recover EXTERNAL REDUNDANCY DISK '/dev/d10', '/dev/d11', '/dev/d12', ....;
Here is an example how you can enable automatic file management with such a setup:
ALTER SYSTEM SET db_create_file_dest   = '+DATA' SCOPE=SPFILE;
ALTER SYSTEM SET db_recovery_file_dest = '+RECOVER' SCOPE=SPFILE;
You may also decide to introduce additional disk groups - for example, if you decide to put historic data on low cost disks, or if you want ASM to mirror critical data across 2 storage cabinets. 

11.What is ASM Rebalancing?
The rebalancing speed is controlled by the ASM_POWER_LIMIT initialization parameter. Setting it to 0 will disable disk rebalancing.
ALTER DISKGROUP data REBALANCE POWER 11;

12. What happens when an Oracle ASM diskgroup is created?
When an ASM diskgroup is created, a hierarchical filesystem structure is created.

13. How does this filesystem structure appear?
Oracle ASM diskgroup's filesystem structure is similar to UNIX filesystem hierarchy or Windows filesystem hierarchy.

14. Where are the Oracle ASM files stored?
Oracle ASM files are stored within the Oracle ASM diskgroup. If we dig into internals, oracle ASM files are stored within the Oracle ASM filesystem structures.

15. How are the Oracle ASM files stored within the Oracle ASM filesystem structure?
Oracle ASM files are stored within the Oracle ASM filesystem structures as objects that RDBMS instances/Oracle database instance access. RDBMS/Oracle instance treats the Oracle ASM files as standard filesystem files.

16. How can you access a database file in ASM diskgroup under RDBMS?
Once the ASM file is created in ASM diskgroup, a filename is generated. This file is now visible to the user via the standard RDBMS view V$DATAFILE.
 
17. What will be the syntax of ASM filenames?

ASM filename syntax is as follows:
+diskgroup_name/database_name/database_file_type/tag_name.file_number.incarnation
where,
+diskgroup_name - Name of the diskgroup that contains this file
database_name - Name of the database that contains this file
datafile - Can be one among 20 different ASM file types
tag_name - corresponds to tablespace name for datafiles, groupnumber for redo log files
file_number - file_number in ASM instance is used to correlate filenames in database instance
incarnation_number - It is derived from the timestamp. IT is used to provide uniqueness

18. What is an incarnation number?
An incarnation number is a part of ASM filename syntax. It is derived from the timestamp. Once the file is created, its incarnation number does not change.

19. What is the use of an incarnation number in Oracle ASM filename?
Incarnation number distinguishes between a new file that has been created using the same file number and another file that has been deleted.

20. Where ASM instance spfile reside and from where get details about for spfile?
ASM's SPFile will be residing inside ASM itself. This could be found out in number of ways, looking at the alert log of ASM when ASM starts
Machine:        x86_64
Using parameter settings in server-side spfile +DATA/asm/asmparameterfile/registry.253.766260991
System parameters with non-default values:
  large_pool_size          = 12M
  instance_type            = "asm"
  remote_login_passwordfile= "EXCLUSIVE"
  asm_diskgroups           = "FLASH"
  asm_diskgroups           = "DATA"
  asm_power_limit          = 1
  diagnostic_dest          = "/opt/app/oracle"
Or using the asmcmd's spget command which shows the spfile location registered with GnP profile
ASMCMD>spget
+DATA/asm/asmparameterfile/registry.253.766260991

21.  How does database connects to ASM Instance?
The database communicates with ASM instance using the ASMB (umblicus process) process. Once the database obtains the necessary extents from extent map, all database IO going  forward is processed through by the database processes, bypassing ASM. Thus we say ASM is not really in the IO path. So, the question how do we make ASM go faster…..you don’t have to.

22. How does the database interact with the ASM instance and how do I make ASM go faster?
ASM is not in the I/O path so ASM does not impede the database file access. Since the RDBMS instance is performing raw I/O, the I/O is as fast as possible.

23. Do I need to define the RDBMS FILESYSTEMIO_OPTIONS parameter when I use ASM?
No. The RDBMS does I/O directly to the raw disk devices, the FILESYSTEMIO_OPTIONS  parameter is only for filesystems.

24. Why Oracle recommends two diskgroups?
Oracle recommends two diskgroups to provide a balance of manageability, utilization, and performance.

25. We have a 16 TB database. I’m curious about the number of disk groups we should use; e.g. 1 large disk group, a couple of disk groups, or otherwise?
For VLDBs you will probably end up with different storage tiers; e.g with some of our large customers they have Tier1 (RAID10 FC), Tier2 (RAID5 FC), Tier3 (SATA), etc. Each one of these is mapped to a diskgroup.

26. We have a new app and don’t know our access pattern, but assuming mostly sequential access, what size would be a good AU fit?
For 11g ASM/RDBMS it is recommended to use 4MB ASM AU for disk groups.

27. Would it be better to use BIGFILE tablespaces, or standard tablespaces for ASM?
The use of Bigfiletablespaces has no bearing on ASM (or vice versa). In fact most database object related decisions are transparent to ASM.

28. What is the best LUN size for ASM?
There is no best size! In most cases the storage team will dictate to you based on their standardized LUN size. The ASM administrator merely has to communicate the ASM Best Practices and application  characteristics to storage folks :
• Need equally sized / performance LUNs
• Minimum of 4 LUNs
• The capacity requirement
• The workload characteristic (random r/w, sequential r/w) & any response time SLA
Using this info , and their standards, the storage folks should build a nice LUN group set for you.

29. 11g RAC we want to separate ASM admins from DBAs and create different users and groups. How do we set this up?
For clarification
• Separate Oracle Home for ASM and RDBMS.
• RDBMS instance connects to ASM using OSDBA group of the ASM instance.
Thus, software owner for each RDBMS instance connecting to ASM must be a member of ASM’s OSDBA group.
• Choose a different OSDBA group for ASM instance (asmdba) than for RDBMS instance (dba)
• In 11g, ASM administrator has to be member of a separate SYSASM group to separate ASM Admin and DBAs.

30.  Can my RDBMS and ASM instances run different versions?

Yes. ASM can be at a higher version or at lower version than its client databases. There’s two
components of compatiblity:
Software compatibility
Diskgroup compatibility attributes:
compatible.asm
compatible.rdbms

No comments:

Post a Comment