Day-20 : ASM

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 extention 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.
--------------------------------------------------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------------------------------------------------
How  to create tablespace in ASM?
SQL> CREATE TABLESPACE TS1 DATAFILE '+DATA1' SIZE 20GB;
Above command creates a datafile in DATA1 diskgroup. use " sqlplus / as sysasm"
--------------------------------------------------------------------------------------------------------------------------
How  to add datafile to tablespace in ASM?
SQL> alter tablespace TS1 add datafile '+DATA' size 10G;
Above command adds a datafile in DATA1 diskgroup. use " sqlplus / as sysasm"
--------------------------------------------------------------------------------------------------------------------------
How  to add logfile to tablespace in ASM?
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 5 ('+REDO/db_name/redo__t2_5a.log','+REDO/db_name/redo__t2_5b.log') SIZE 100m,
GROUP 6 ('+REDO/db_name/redo__t2_6a.log','+REDO/db_name/redo__t2_6b.log') SIZE 100m;
Above command adds a logfile in REDO diskgroup. use " sqlplus / as sysasm"
--------------------------------------------------------------------------------------------------------------------------
How  to drop redolog  group in ASM?
Alter database drop logfile group 1;
--------------------------------------------------------------------------------------------------------------------------
How  to drop redolog  file in ASM?
ALTER DISKGROUP REDO DROP FILE '+REDO/db_name/redo02a.log';
--------------------------------------------------------------------------------------------------------------------------
Why should we use separate ASM home from DB home?
Because ASM will have its own ORACLE_HOME. To patch the ASM alone we need it in seperate home.
--------------------------------------------------------------------------------------------------------------------------
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).
--------------------------------------------------------------------------------------------------------------------------
What is the syntax of ASM filenames?
ASM filename syntax is as follows:
+DATA/PRODDB/datafile/undotbs02.491.870097913
+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
--------------------------------------------------------------------------------------------------------------------------
How many diskgroups should one database have?
As per my recommendation it is better to have one disk group for all database files(maintenace will be easy) and optionally a second for recovery files (see FRA).
--------------------------------------------------------------------------------------------------------------------------
How can you access a database files 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.
you have to set ASM environment variables ,connect using asmcmd command to see the files at OS level
--------------------------------------------------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------------------------------------------------
How to check the ASM parameter file?
set the ASM environment variables(HOME and ORACLE_SID)
cd $ASM_HOME/bin
Method-1:
sqlplus /as sysdba
sho parameter spfile
Method-2:
asmcmd
ASMCMD> spget
+DATA/asm/asmparameterfile/registry.253.766260991
--------------------------------------------------------------------------------------------------------------------------
What is ASM Rebalancing?
ASM attempts to spread the data evenly across all disks in a disk group. It does this on a 'file' basis, and in the database, a 'datafile' assigned to a tablespace is a 'file'.So when you add a new datafile, ASM tries to spread that file across all available disks in the diskgroup.
If you add another disk, or if you remove a disk (or it fails) ASM will automatically re-spread all files across the new disk layout for that group. This re-spread is called 'rebalance', which happens at disk add/remove time. Normally a separate process is fired up to do that rebalance. This will take a certain amount of time. If you want it to happen faster, fire up more processes. You tell ASM it can add more processes by increasing the rebalance power.
--------------------------------------------------------------------------------------------------------------------------
how to control rebalancing in ASM?
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;
--------------------------------------------------------------------------------------------------------------------------
Advantages of ASM in Oracle?
Provides automatic load balancing over all the available disks, thus reducing hot spots in the file system
Prevents fragmentation of disks, so you don’t need to manually relocate data to tune I/O performance
Adding disks is straight forward – ASM automatically performs online disk reorganization when you add or remove storage
Uses redundancy features available in intelligent storage arrays
The storage system can store all types of database files
Using disk group makes configuration easier, as files are placed into disk groups
ASM provides stripping and mirroring (fine and coarse gain – see below)
ASM and non-ASM oracle files can coexist
Striping—ASM spreads data evenly across all disks in a disk group to optimize performance and utilization. This even distribution of database files eliminates the need for regular monitoring and I/O performance tuning.
--------------------------------------------------------------------------------------------------------------------------
What are characteristics of 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 can not be in open status as there are not datafiles. 
--------------------------------------------------------------------------------------------------------------------------
What are ASM Background Processes in Oracle?
ARBx These are the slave processes that do the rebalance activity (where xis a number).
CKPT The CKPT process manages cross-instance calls (in RAC).
DBWR This process manages the SGA buffer cache in the ASM instance.DBWR writes out dirty buffers (changed metadata buffers) from the ASMbuffer cache to disk.
GMON This process is responsible for managing the disk-level activities (drop/offline) and advancing diskgroup compatibility.
KATE The Konductor or ASM Temporary Errands (KATE) process is usedto process disks online. This process runs in the ASM instance and is startedonly when an offlined disk is onlined.
LGWR The LGWR process maintains the ASM Active Change Directory (ACD) buffers from the ASM instance and flushes ACD change records to disk.
MARK The Mark Allocation Unit (AU) for Resync Koordinator (MARK) process coordinates the updates to the Staleness Registry when the disks gooffline. This process runs in the RDBMS instance and is started only when disks go offline in ASM redundancy diskgroups.
PING The PING process measures network latency and has the same functionality in RDBMS instances.
PMON This manages processes and process death in the ASM instance.
PSP0 This process spawner process is responsible for creating and managing other Oracle processes.
PZ9x These processes are parallel slave processes (where x is a number), used in fetching data on behalf of GV$ queries.
RBAL This opens all device files as part of discovery and coordinates the rebalance activity.
SMON This process is the system monitor and also acts as a liaison to the Cluster Synchronization Services (CSS) process (in Oracle Clusterware) fornode monitoring.
VKTM This process is used to maintain the fast timer and has the samefunctionality in the RDBMS instances.
--------------------------------------------------------------------------------------------------------------------------
What are the 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.
--------------------------------------------------------------------------------------------------------------------------
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. The higher the limit the more resources are allocated resulting in faster rebalancing operations. 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.
ASM_DISKSTRING – Specifies a value that can be used to limit the disks considered for discovery. 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.
--------------------------------------------------------------------------------------------------------------------------
What are the files that can be  stored within the Oracle ASM?
Files stored in Oracle ASM diskgroup/Oracl ASM filestructures include:
1) Datafile
2) Controlfiles
3) Server Parameter Files(SPFILE)
4) Redo Log files
5) Archived logs & backup files

No comments:

ORA-600 [kwqitnmphe:ltbagi], [1], [0] reported in the alert log file.

ORA-00600 [kwqitnmphe:ltbagi] Cause: This issue arises in 12.1.0.2. The error occurs because there are still Historical Messages without...