Wednesday, December 14, 2011

CREATE DISKGROUP MANUAL in 11gR2


In the document I am creating DISK and creating the DISKGROUP in the cluster environment using manual method.  I have a two node primary database & two node standby database.

We need to identify the raw disks which are candidates for the ASM storage. I have check in the primary & standby site

Below disk are free on both side (primary RAC DB & Standby RAC DB)
raw_vote_03    
raw_vote_04    
raw_vote_05    


CREATING ORACLEASM DISKS using ‘oracleasm createdisk’ command as root. This command will make the disks available to ASMLib. List the existing disks using the listdisks option to verify that ASMLib is aware of the marked new disks.


[root@bhuora01~]# oracleasm createdisk DG_TEST /dev/mapper/raw_vote_03
Writing disk header: done
Instantiating disk: done
[root@bhuora01]# oracleasm createdisk DG_TEST1 /dev/mapper/raw_vote_04
Writing disk header: done
Instantiating disk: done
[root@bhuora01]# oracleasm createdisk DG_TEST2 /dev/mapper/raw_vote_05
Writing disk header: done
Instantiating disk: done

VERIFYING ASK DISK LABEL BY PROVIDING DISK

[root@bhuora01 ~]# oracleasm querydisk /dev/mapper/raw_vote_03
Device "/dev/mapper/raw_vote_03" is marked an ASM disk with the label "DG_TEST"
[root@bhuora01 ~]# oracleasm querydisk /dev/mapper/raw_vote_04
Device "/dev/mapper/raw_vote_04" is marked an ASM disk with the label "DG_TEST1"
[root@bhuora01 ~]# oracleasm querydisk /dev/mapper/raw_vote_05
Device "/dev/mapper/raw_vote_05" is marked an ASM disk with the label "DG_TEST2"

VERIFYING DISK USING listdiks

[root@bhuora01 ~]# oracleasm listdisks
DG_TEST
DG_TEST1
DG_TEST2


[root@bhuora01 ~]# ls -alrt /dev/oracleasm/disks/DG*
total 0
drwxr-xr-x 4 root   root         0 Nov 22 13:14 ..
drwxr-xr-x 1 root   root         0 Nov 22 13:14 .
brw-rw---- 1 oracle asmdba 253, 26 Dec 13 15:36 DG_TEST
brw-rw---- 1 oracle asmdba 253, 27 Dec 13 15:36 DG_TEST1
brw-rw---- 1 oracle asmdba 253, 28 Dec 13 15:36 DG_TEST2


Make ASM disks available to other nodes in the cluster by running the scandisk command. This needs to be run on all other nodes.

[root@bhuora02 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DG_TEST"
Instantiating disk "DG_TEST1"
Instantiating disk "DG_TEST2"
[root@bhuora02 ~]#

You can see from the scandisks commands, it display above 3 disks are creating newly on the first node

[root@bhuora02 ~]# ls -alrt /dev/oracleasm/disks/DG*
brw-rw---- 1 oracle asmdba 253, 36 Dec 13 15:40 /dev/oracleasm/disks/DG_TEST
brw-rw---- 1 oracle asmdba 253, 38 Dec 13 15:40 /dev/oracleasm/disks/DG_TEST1
brw-rw---- 1 oracle asmdba 253, 40 Dec 13 15:40 /dev/oracleasm/disks/DG_TEST2


CREATING THE DISK GROUP IN COMMAND PROMPT

oracle +ASM1 bhuora02> sqlplus / as sysasm

SQL*Plus: Release 11.2.0.2.0 Production on Tue Dec 13 16:02:22 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> CREATE DISKGROUP TEST EXTERNAL REDUNDANCY
DISK '/dev/oracleasm/disks/DG_TEST',
'/dev/oracleasm/disks/DG_TEST1',
'/dev/oracleasm/disks/DG_TEST2' ATTRIBUTE 'au_size'='4M',
'compatible.asm' = '11.2.0.2.0',
'compatible.rdbms' = '11.2.0.2.0',
'compatible.advm' = '11.2.0.2.0';

Diskgroup created.


SQL> select * from v$asm_diskgroup where name='TEST';

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY                                       V
------------------------------------------------------------ -
          32 TEST                                   512       4096
             4194304 MOUNTED     EXTERN       6144       6004           0
         140                       0           6004             0

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY                                       V
------------------------------------------------------------ -
11.2.0.2.0
11.2.0.2.0                                                   N


ON NODE#2 if you run the same queries on the second node, it shows there is no disk group with the name. When I check further on the issue, I found that we need to manual mount in all the cluster nodes.

SQL> select * from v$asm_diskgroup where name='TEST';

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY                                       V
------------------------------------------------------------ -
           0 TEST                                     0       4096
                   0 DISMOUNTED                  0          0           0
           0                       0              0             0

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY                                       V
------------------------------------------------------------ -
0.0.0.0.0
0.0.0.0.0                                                    N

WHEN I TRY TO DISMOUNT DISK GROUP, I GOT AN ERROR SAYING THAT THERE IS NO DISK AVAILABLE ON THE NODE

SQL> alter diskgroup test dismount;
alter diskgroup test dismount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15001: diskgroup "TEST" does not exist or is not mounted

THEN MOUNT THE DISK GROUP

SQL> alter diskgroup test mount;

Diskgroup altered.

SQL> select * from v$asm_diskgroup where name='TEST';

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY                                       V
------------------------------------------------------------ -
          32 TEST                                   512       4096
             4194304 MOUNTED     EXTERN       6144       6004           0
         140                       0           6004             0

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY                                       V
------------------------------------------------------------ -
11.2.0.2.0
11.2.0.2.0                                                   N


SQL>

NOTE#

I have the DISK GROUP is automatically added in the cluster registry.

oracle +ASM1 bhuora02> crsctl stat res ora.TEST.dg -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS     
----------------------------------------------------------------------------
Local Resources
----------------------------------------------------------------------------
ora.TEST.dg
               ONLINE  ONLINE       bhuora02                                
               ONLINE  ONLINE       bhuora01                                

No comments:

Post a Comment