Tuesday, September 5, 2017

Oracle Flex ASM

Starting 12c, Oracle has introduced two very interesting features to add up to MAA (Maximum Availability Architecture), flex cluster and flex ASM. Oracle flex cluster has been discussed here. In this article I will be explaining and demonstrating about Oracle flex ASM.
In flex ASM, you don’t need ASM instance to be running on each node (Hub node) because database instance can communicate with some other ASM instance running on any other node in the cluster.
This is beneficial if ASM goes down on the same node where instance is running, because of some reason, or if shared storage becomes unavailable on this node. An ASM listener has been introduced that runs on the node where ASM instance runs and remote database instance clients can connect with remote ASM instance using ASM listener. This listener listens on port 1526 by default. Each ASM instances on cluster register themselves with all other ASM listeners in the cluster.
For this demonstration, I have a 2 RAC nodes (built using Virtual Box) and 2 instances of my RAC database running on each node.
First we check status of ASM and also check if flex ASM is configured.
[grid@salman11 ~]$ srvctl status asm
ASM is running on salman11,salman12

[grid@salman11 ~]$ srvctl config asm
ASM home: <CRS home>
Password file: +DATA/orapwASM
Backup of Password file:
ASM listener: LISTENER
ASM instance count: 3
Cluster ASM listener: ASMNET1LSNR_ASM

-- Check Flex mode
[grid@salman11 ~]$ asmcmd showclustermode
ASM cluster : Flex mode enabled
[grid@salman11 ~]$

-- Status of ASM Listener. Both of ASM instances in my RAC are registered with both of ASM listeners running on each of 2 nodes
[grid@salman11 ~]$ lsnrctl status ASMNET1LSNR_ASM

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 03-MAY-2017 13:57:10

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=ASMNET1LSNR_ASM)))
STATUS of the LISTENER
------------------------
Alias                     ASMNET1LSNR_ASM
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                03-MAY-2017 12:48:07
Uptime                    0 days 1 hr. 9 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/12.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/salman11/asmnet1lsnr_asm/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=ASMNET1LSNR_ASM)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.10)(PORT=1526)))
Services Summary...
Service "+ASM" has 2 instance(s).
  Instance "+ASM1", status READY, has 2 handler(s) for this service...
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 2 instance(s).
  Instance "+ASM1", status READY, has 2 handler(s) for this service...
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@salman11 ~]$

We can see above that flex mode is already enabled. Now we do the testing about how flex ASM works.
First, let me show you my both database instances and status of other related cluster resources.
[grid@salman11 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       salman11                 STABLE
               ONLINE  ONLINE       salman12                 STABLE
ora.DATA.dg
               ONLINE  ONLINE       salman11                 STABLE
               ONLINE  ONLINE       salman12                 STABLE
ora.asm
      1        ONLINE  ONLINE       salman11                 Started,STABLE
      2        ONLINE  ONLINE       salman12                 Started,STABLE
      3        ONLINE  OFFLINE                                      STABLE
ora.salman12.db
      1        ONLINE  ONLINE       salman11                 Open,HOME=/u01/app/o
                                                                                       racle/product/12.2.0
                                                                                       /dbhome_1,STABLE
      2        ONLINE  ONLINE       salman12                 Open,HOME=/u01/app/o
                                                                                       racle/product/12.2.0
                                                                                      /dbhome_1,STABLE
--------------------------------------------------------------------------------
[grid@salman11 ~]$

[grid@salman11 ~]$ srvctl status database -d salman12
Instance salman121 is running on node salman11
Instance salman122 is running on node salman12

Now on node2 (salman12), I SHUTDOWN ABORT the ASM instance, but still my database instance on node2 would keep running.
[grid@salman12 ~]$ sqlplus

SQL*Plus: Release 12.2.0.1.0 Production on Wed May 3 14:13:04 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Enter user-name: sys as sysasm
Enter password:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> shutdown abort
ASM instance shutdown
SQL>
Let’s check again status of ASM and also database instances after I just stopped the ASM instance on node 2. ASM

-- ASM is running only on node1
[grid@salman11 ~]$ srvctl status asm
ASM is running on salman11
-- Both database instances on both nodes are running.
[grid@salman11 ~]$ srvctl status database -d salman12
Instance salman121 is running on node salman11
Instance salman122 is running on node salman12

-- ASM on node1 can also been see as DOWN if we check cluster resources status. Since ASM is down, ASM diskgroup DATA is also offline on node2.
[grid@salman11 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       salman11                 STABLE
               ONLINE  OFFLINE      salman12                 STABLE
ora.asm
      1        ONLINE  ONLINE       salman11                 Started,STABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,STBLE
      3        ONLINE  OFFLINE                               STABLE
ora.salman12.db
      1        ONLINE  ONLINE       salman11                 Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /dbhome_1,STABLE
      2        ONLINE  ONLINE       salman12                 Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /dbhome_1,STABLE
------------------------------------------------------------------------------

-- “lsct” command executed from ASMCMD prompt on node1 (salman11) shows that database instance salman122 is now connected with ASM running on this node.
DB_Name    Status                Software_Version  Compatible_version           Instance_Name        Disk_Group
+ASM       CONNECTED       12.2.0.1.0             12.2.0.1.0                            +ASM1                   DATA
_mgmtdb   CONNECTED       12.2.0.1.0             12.2.0.0.0                            -MGMTDB            DATA
_OCR        CONNECTED                 -                  -                 salman11.salman.com                     DATA
salman12  CONNECTED        12.2.0.1.0           12.2.0.0.0                               salman121             DATA
salman12  CONNECTED      12.2.0.1.0           12.2.0.0.0                               salman122            DATA

No comments: