Friday, 8 June 2018

Interview Q and A for Oracle ASM Part - 3

61. How do you stop an Oracle ASM Instance?
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.

62. What will happen if the version of ASM is different than database ? (take both scenarios : higher and lower)
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.

63. How many Oracle ASM instance are supported on a server?
Only one Oracle ASM instance is supported on a server.

64. Can an ASM file be contained in more than one disk groups ?
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.

65. What are various ASM redundancy levels?
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

66. Why it is advised that different Oracle ASM disks should not share the same physical drive?
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.

67. What are ‘Extents’ in context of Asm?
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+))

68. What are general recommendations for ASM Storage Preparation?
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.

69. How do you Start Up an Oracle ASM Instance?
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

70. How to find out the databases, which are using the ASM instance?
ASMCMD>lsct
SQL> select DB_NAME from V$ASM_CLIENT;

71. What is Oracle Restart?
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.

72. What is Kfed?
kfed is a utility which can be used to view the ASM Disk information. Syntax for using it is
         kfed read devicename

73.  Can we use BCV to clone the ASM Diskgroup on same host?
Diskgroup Cloning is not supported on the same host using BCV. You have no other option to use except RMAN DUPLICATE. You can find more detail on BCV and ASM in below whitepaper

74. How can we copy the files from/to ASM?
You can use RMAN or DBMS_FILE_TRANSFER.COPY_FILE procedure to copy the files to/from ASM from/to Filesystem. Starting from Oracle 11g, you can use cp command in asmcmd to perform the same between ASM Diskgroups and also to OS Filesystem.

75. Can we edit the ASM Disk header to change the Diskgroup Name?
No. This cannot be done.

76. What is ASMLIB?
ASMLIB is the support library for the ASM. ASMLIB allows an Oracle database using ASM more efficient and capable access to diskgroups. The purpose of ASMLIB, is to provide an alternative interface to identify and access block devices. Additionally, the ASMLIB API enables storage and operating system vendors to supply extended storage-related features. You can read more about ASMLIB in
Note: 359266.1 – FAQ ASMLIB CONFIGURE, VERIFY, TROUBLESHOOT
ASMLIB has following benefits:
• Simplified disk discovery
• Persistent disk names
• Efficient use of system resources
o Reduced Overhead

77. I am unable to open the ASM instance. What is the reason?
ASM instance does not have open stage. It has got only two options
  • Nomount- This starts the ASM instance
  • Mount- At this stage, Diskgroup defined in ASM_DISKGROUPS parameter are mounted
When you try to open the ASM instance , you get error
<span style="font-size: small; font-family: arial,helvetica,sans-serif;">SQL&gt; alter database open;
alter database open
*
ERROR at line 1:
ORA-15000: command disallowed by current instance type</span>

78. Can ASM be used as replacement for RAID?
ASM is supposed to stripe the data and also mirror the data (if Using Normal, High Redundancy). So this can be used as a alternative for RAID 0+1 solutions

79. Is it possible to do rolling upgrades on ASMLIB in a RAC configuration
ASMLIB is independent of Oracle Clusterware and Oracle Database, and thus can be upgraded on its own Upgrading ASMLIB one a given node will require that ASMLIB be disabled/stop, will require the database and ASM to also be shutdown on that node. Once the ASMLIB is upgarded then the stack can be restarted.

80. Can DBMS_FILE_TRANSFER be used to upload text files into ASM ?
This is not possible because DBMS_FILE_TRANSFER can be used for Archive logs, RMAN backups, datafile copies, spfiles, DataGuard configuration files, change tracking file, flashback logs, cross platform transportable tablespaces, and datapump files.
Oracle Binaries, trace files and other OS files cannot be stored on ASM diskgroups.

81. Can External Tables Be Placed inside ASM diskgroups?  
ASM cannot store external tables in ASM diskgroups since external tables are flat ASCII files which are not a file type supported in ASM, therefore external tables must be allocated on regular filesystem files.

82. Can you create a second voting disk in a different ASM diskgroup when using External Redundancy in 11.2?
You cannot create more than 1 voting disk in the same or on another/different diskgroup disk when using External Redundancy in 11.2. The rules are as follows:
External = 1 voting disk
Normal= 3 voting disk
High= 5 voting disk

83. Is it possible to create disk at single-path device, then reconfigure disc-array to multipath and still use this asm-disk?
yes. ASM will scan the disks based on the parameter asm_diskstring and the permissions. When the disk is scanned and the data is found, it does not matter the path or the major,minor numbers.
ASM does not change anything in the metadata when using different paths.
There is a discovery phase when starting up the ASM instance based on the ASM_DISKSTRING parameter. There is nothing in the dictionary.
All the needed information is located in the disk header and so it doesn't care to the device name.
This is also the reason why you must take care to avoid to have the same device twice visible with
different names, because from ASM point of view this will be duplicate disks.

84. Whether the failover of ASM based instance using HA-Agent like VCS/SG is supported or not.
At the moment, single instance Oracle databases using ASM cannot be failed over. That's because when a database instance is halted, and the ASM disk groups are dropped, ASM processes still keep some file descriptors to the ASM disk groups open.
First of all if a 3rd party clusterware controls applications running on a server (including ASM instance, db instance, listener, ...) these applications are not required to support this setup in any way. And in fact ASM does not 'support' HA clusters in any meaning of that word.
The best way to solve this problem is to run ASM instances as a cluster all the time on all nodes. All the ASM instances mount all the diskgroups.The databases can fail over to another node and access the same files via the local ASM instance. This does not require a RAC license even though ASM is using
Oracle clusterware.

85. can we execute add disk & drop disk statements in one operation, in that way only one rebalance operation will be started as
SQL> alter diskgroup<diskgroup name>
add disk '<new device physical name 1>', .., '<new device physical name N>'
drop disk <old disk logical name 1>, <old disk logical name 2>, ..,<old disk logical name N>
rebalance power <#>;
This is more efficient than separated commands (add disk & drop disk statements).

86. ASMLIB INSTALLATION
ASMLIB is distributed as Linux RPMs which are specific for the different Linux distributions based on:
- Linux distribution (RedHat 2.1, 3.0, 4.0, 5.0 or Suse Enterprise Server 8,9,10)
- Linux Kernel. (smp, highmem, or release)
- Type of CPUs: AMD64, Intel 64, Itanium 64bits, Intel 32 bits.
To verify the RPM installed execute rpm -qa |grep oracleasm.
$ rpm -qa |grep oracleasm
oracleasm-support-2.0.4-1.el5
oracleasm-2.6.18-53.el5-2.0.4-1.el5
oracleasmlib-2.0.3-1.el5
The following syntax will print at the end of the file, the platform:
$rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm\n" | grep asm
oracleasm-support-2.0.4-1.el5.x86_64.rpm
oracleasm-2.6.18-53.el5-2.0.4-1.el5.x86_64.rpm
oracleasmlib-2.0.3-1.el5.x86_64.rpm
As mentioned before, this set of files is different for each platform, but once you have selected the correct set, files oracleasm-support and oracleasmlib are identical for all the possible kernels (smp,highmem,etc). Only the third RPM is unique to the kernel release installed, which is obtained executing command uname -a or uname -r
$ uname -a
Linux jfrac1.us.oracle.com 2.6.18-53.el5 #1 SMP Sat Nov 10 19:37:22 EST 2007 x86_64
In this example using RedHat 5.0 for 64bits on Intel processors, checking the files in ASMLIB download page,
notice there are four different kernels :
oracleasm-2.6.18-53.el5xen-2.0.4-1.el5.x86_64.rpm
oracleasm-2.6.18-53.el5debug-2.0.4-1.el5.x86_64.rpm
oracleasm-2.6.18-53.el5-2.0.4-1.el5.x86_64.rpm
Downloading the correct RPM is required and for this kernel, it will be oracleasm-2.6.18-53.el5-2.0.4-1.el5.x86_64.rpm. The installation of an incorrect RPM will produce different errors, during the configuration of ASMLIB or later during the discovery of the disks.
* Is /dev/oracleasm created
When ASMLIB is configured, a special filesystem is created and mounted: /dev/oracleasm.
$ df -ha
Filesystem Size Used Avail Use% Mounted on
/dev/hdc2 13G 11G 1.9G 85% /
none 0 0 0 - /proc
none 0 0 0 - /dev/pts
usbdevfs 0 0 0 - /proc/bus/usb
/dev/hdc1 101M 14M 81M 15% /boot
none 250M 0 250M 0% /dev/shm
/dev/sda1 8.4G 4.8G 3.2G 60% /oradata2
/dev/sde1 8.3G 6.6G 1.4G 84% /oradata3
oracleasmfs 0 0 0 - /dev/oracleasm
When command oracleasm createdisk is executed, a block device is created under /dev/oracleasm/disks. This is the device discovered by ASMLIB using the string ORCL:*.
brw-rw---- 1 usupport dba 8, 33 Feb 23 10:54 VOL1
* Checking if ASMLIB was installed properly:
[root@arlnx2 asm_tar]# /etc/init.d/oracleasm status
Checking if ASM is loaded: [ OK ]
Checking if /dev/oracleasm is mounted: [ OK ]
If the command fails, use strace and generate a log file:
strace -f -o asm_status.out /etc/init.d/oracleasm status
* Listing the ASMLIB disks:
/etc/init.d/oracleasm listdisks
TESTX
VOL1
You will find an entry under /dev/oracleasm/disks. This is the block device associated to the physical device. If the file exist the command will return information, but if not, please execute:
strace -f -o asm_listd.out /etc/init.d/oracleasm listdisks.

87. Error Device "/dev/sdg" is not a partition when creating the ASMLIB device
This problem is reported during the creation of the ASMLIB device:
[root@arlnx2 asm_tar]# /etc/init.d/oracleasm createdisk mydisk /dev/sdg
Marking disk "/dev/sdg" as an ASM disk: asmtool: Device "/dev/sdg" is not a partition [FAILED]
The message indicates the disk is not a partition and ASMLIB requires the disk has at least one partition.
How to check this: using command fdisk -l <device name>
Example:
[root@arlnx2 asm_tar]# /sbin/fdisk -l /dev/sdg
Disk /dev/sdg: 9105 MB, 9105018880 bytes
64 heads, 32 sectors/track, 8683 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sdg1 1 2862 2930672 83 Linux
The command shows disk /dev/sdg having one partition /dev/sdg1 and this is the device that should be referenced on command oracleasm createdisk. If you still have problems, then use strace:
# strace -f -o asm_create.out /etc/init.d/oracleasm createdisk <disk name> <physical disk>

88. How to identify the physical disk bound to the ASMLIB disk.
Use /etc/init.d/oracleasm querydisk <NAME> where NAME is any name under /dev/oracleasm/disks.
Example:
[root@arlnx2 asm_tar]# /etc/init.d/oracleasm querydisk -d VOL1
Disk "VOL1" is a valid ASM disk on device [8, 33]
The command reports the device identified with major,minor numbers which are unique numbers associated to each disk. File /proc/partitions can be used to find the name of the device associated with those numbers:
major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
8 0 8891620 sda 39715 78016 941080 417000 156198 242472 3189752 214180 0 420630 631180
8 1 8891376 sda1 39691 77970 940922 416780 156198 242472 3189752 214180 0 420410 630960
8 16 8891620 sdb 87 250 803 740 0 0 0 0 0 740 740
8 17 8891376 sdb1 57 193 632 480 0 0 0 0 0 480 480
8 32 17783250 sdc 745 2993 8321 8300 0 0 0 0 0 5250 8300
8 33 977904 sdc1 87 139 644 1040 0 0 0 0 0 1040 1040
8 34 977920 sdc2 35 193 456 230 0 0 0 0 0 230 230
8 35 1 sdc3 4 0 8 40 0 0 0 0 0 40 40
8 37 977904 sdc5 57 193 632 1240 0 0 0 0 0 1240 1240
8 38 977904 sdc6 57 193 632 1170 0 0 0 0 0 1170 1170
Also connected as root you can run the same command but referencing the physical device:
[root@arlnx2 dbs]# /etc/init.d/oracleasm querydisk /dev/sdc1
Disk "/dev/sdc1" is marked an ASM disk with the label "VOL1"
Any error on this command will require using strace:
strace -f -o asm_query.out /etc/init.d/oracleasm querydisk <NAME>.

89. ASM disks are not discovered when using asm_diskstring='ORCL:*'
In 10gR2 if the disks are not discovered using string ORCL:*, the alternative is using /dev/oracleasm/disks. This could be set in parameter asm_diskstring or using this path in the DDL statement when creating a diskgroup or adding a disk. This is possible because in this release Oracle
can open directly the block device. 10.1 requires binding the block device to the character device known as /dev/raw/rawX.
Notice the output of ls -l /dev/oracleasm/disks
[root@arlnx2 asm_tar]# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 usupport dba 7, 1 Feb 20 13:30 TESTX
brw-rw---- 1 usupport dba 8, 33 Feb 17 09:41 VOL1
The b at the beginning indicates this is a block device. When referencing /dev/oracleasm/disks/VOL1 there is not ASMLIB used as we are accessing
directly the block device. Using /dev/sdg1 or /dev/oracleasm/disks/VOL1 is exactly the same.
This situation could affect environments where ASM is using 10.2 but there are databases using 10.1 and 10.2. Databases using 10.2 can use the diskgroup but 10.1 will fail when a file is created. Example: creating a tablespace will fails with error ora-600:
ORA-00600: internal error code, arguments: [kfioSubmitIO07], [], [], [], [], [], [], []
CallStack:
kgeasnmierr kfioSubmitIO kfioRequest ksfd_osmcrt ksfd_create ksfdcre kcfcedtf tbsafl ctsdrv1 ctsdrv.
kfioSubmitIO is trying to obtain the extent map of the disks associated to the diskgroup but can not identify the disk. The reason is because 10.1 can
not reference directly the block device /dev/oracleasm/disks/.
* How to diagnose why ORCL:* is not working: Use /usr/sbin/oracleasm-discover 'ORCL:*'.
When ORCL:* is resolved, the following output is presented:
[root@arlnx2 asm_tar]# /usr/sbin/oracleasm-discover 'ORCL:*'
Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
[ASM Library - Generic Linux, version 2.0.0 (KABI_V1)]
Discovered disk: ORCL:TESTX [819200 blocks (419430400 bytes), maxio 128]
Discovered disk: ORCL:VOL1 [1955808 blocks (1001373696 bytes), maxio 128]
If something is wrong, you could get error Unable to open ASMLib. Use strace to debug the command:
strace -f -o asm_discover.out /usr/sbin/oracleasm-discover 'ORCL:*'
Check for the reference to library libasm.so.
open("/opt/oracle/extapi/32/asm/orcl/1/libasm.so", O_RDONLY) = 3.
If you get open("/opt/oracle/extapi/32/asm/orcl/1/libasm.so", O_RDONLY) = -1 EACCES (Permission denied), then that is the cause of the problem.
Check if the library exists or if the permissions are correct: 755. Also validate that the directories in the path also have the correct permissions (755).

90. Starting ASM instance report errors ORA-604, ORA-15183, ORA-15180 after deleting file libasm.so
When all the files under /opt/oracle/extapi path are deleted, if ASMLIB is used, when mounting diskgroups, following errors will be reported:
ORA-00604 : error occurred at recursive SQL level 2
ORA-15183 : ASMLIB initialization error [/opt/oracle/extapi/64/asm/orcl/1/libasm.so]
ORA-15180 : Could not open dynamic library /opt/oracle/extapi/64/asm/orcl/1/libasm.so, error
This set of directories and files are created during the installation of the ASMLIB rpms, particularly oracleasmlib-*. The diskgroups can not be mounted because there are not ASMLIB devices available.
During the installation, the following directories and files are created:
/opt/oracle/extapi
/opt/oracle/extapi/32
/opt/oracle/extapi/32/asm
/opt/oracle/extapi/32/asm/orcl
/opt/oracle/extapi/32/asm/orcl/1
/opt/oracle/extapi/32/asm/orcl/1/libasm.so
For 64bit platforms the 32 directory will be renamed by 64 directory. You can verify the existence of these elements executing command find
/opt/oracle/extapi
Also executing /usr/sbin/oracleasm-discover (strace -f -o asm_discover.out /usr/sbin/oracleasm-discover 'ORCL:*'), will report errors when trying to read the missing directories/files.
In order to create this objects, oracleasmlib-* rpm needs to be reinstalled, first deleting from disk the rpm image.
For example, in this environment those are the rpms installed:
[usupport@arlnx2 admin]$ rpm -qa |grep oracleasm
oracleasm-support-2.0.0-1
oracleasmlib-2.0.0-1
oracleasm-2.4.21-EL-1.0.0-1
oracleasm-2.4.21-27.0.4.EL-1.0.4-2
To remove the rpm as root execute: rpm -e oracleasmlib-2.0.0-1
To reinstall the rpm as root execute: rpm -Uvh oracleasmlib-2.0.0-1
Note: Use --force flags to reinstall the rpms if the normal flags Uvh don't work.
Due to Unpublished BUG:9824267 you can get this:
ORA-15183: ASMLIB initialization error [driver/agent not installed]
WARNING: FAILED to load library: /opt/oracle/extapi/64/asm/orcl/1/libasm.so

if you have asmlib rpms installed but not configured. Even if your asm discovery string contains NO asmlib components.

No comments:

Post a Comment