About Me
- babumani
- Database and GIS Consultant.
Thursday, April 3, 2014
Manually Add a Shared Disk and Create a DISKGROUP in ASM
Objective: Below steps will explain how to manually add a shared disk, create and mount a DISKGROUP in ASM using the newly created shared disk.
Environment: Oracle 11g Grid Infrastructure, ASM, Oracle 11g RAC Database, 64 bit Oracle Linux Server 6.3, VMware Hypervisor ESXi 5.5
Existing RAC setup: 2 nodes called "rac1" and "rac2", RAC database "babu" has 2 instances called "babu1" and "babu2".
Hardware (VM) Configuration:
1) Follow Steps 4 through 17 in Section 2 of this link on how to create a Shared Disk.
OS / ASM Configuration:
2) In Node 1, connect as "root" and see if the newly added disk is visible:-
[root@rac1 oracle]# ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Jan 20 13:19 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan 20 13:19 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan 20 13:19 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jan 20 13:19 /dev/sdb
brw-rw---- 1 root disk 8, 17 Jan 20 13:19 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Jan 20 13:19 /dev/sdc
3) Create a new partition (in the new disk) using all available space as shown below:-
[root@rac1 oracle]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x7fb6e683.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4) Once partition is created, list it to see if its visible:-
[root@rac1 oracle]# ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Jan 20 13:19 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan 20 13:19 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan 20 13:19 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jan 20 13:19 /dev/sdb
brw-rw---- 1 root disk 8, 17 Jan 20 13:19 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Jan 20 13:24 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jan 20 13:24 /dev/sdc1
5) Create an ASM disk called "DISK2" using the newly partitioned/created disk:-
[root@rac1 oracle]# oracleasm createdisk DISK2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@rac1 oracle]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@rac1 oracle]# oracleasm listdisks
DISK1
DISK2
6) Switch to "oracle" user and start the existing database "babu":-
[root@rac1 oracle]# su oracle
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [+ASM1] ? babu
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1 ~]$ srvctl start database -d babu
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [babu] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
7) Connect to ASM instance 1 and check the mounted / participating ASM instances (optional step):-
[oracle@rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 20 13:50:13 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> select * from v$active_instances;
INST_NUMBER INST_NAME
----------- ------------------------------------------------------------
1 rac1.localdomain:+ASM1
2 rac2.localdomain:+ASM2
8) Verify if the new disk is visible from the ASM instance 1:-
SQL> SELECT MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,NAME,FAILGROUP,PATH,FAILGROUP_TYPE FROM V$ASM_DISK;
MOUNT_S HEADER_STATU MODE_ST NAME FAILGROUP PATH FAILGRO
------- ------------ ------- ---------- ---------- -------------------------- -------
CLOSED PROVISIONED ONLINE /dev/oracleasm/disks/DISK2 REGULAR
CACHED MEMBER ONLINE DATA_0000 DATA_0000 /dev/oracleasm/disks/DISK1 REGULAR
9) Create DISKGROUP using the new disk:-
SQL> CREATE DISKGROUP DSK_GRP_02
EXTERNAL REDUNDANCY
DISK '/dev/oracleasm/disks/DISK2';
Diskgroup created.
10) See if the new DISKGROUP is visible from the ASM instance:-
SQL> SELECT MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,NAME,FAILGROUP,PATH,FAILGROUP_TYPE FROM V$ASM_DISK;
MOUNT_S HEADER_STATU MODE_ST NAME FAILGROUP PATH FAILGRO
------- ------------ ------- ---------------- --------------- -------------------------- -------
CACHED MEMBER ONLINE DSK_GRP_02_0000 DSK_GRP_02_0000 /dev/oracleasm/disks/DISK2 REGULAR
CACHED MEMBER ONLINE DATA_0000 DATA_0000 /dev/oracleasm/disks/DISK1 REGULAR
11) As "root" user, check the status. You will see its online in node 1, but offline (not mounted) in node2:-
[root@rac1 oracle]# crsctl status resource -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DSK_GRP_02.dg
ONLINE ONLINE rac1
OFFLINE OFFLINE rac2
12) In Node2, login as "oracle" user and verify the status of the newly created DISKGROUP:-
From database instance 2:-
[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? babu
expThe Oracle base has been set to /u01/app/oracle
[oracle@rac2 ~]$ export ORACLE_SID=babu2
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 20 14:04:55 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DATA CONNECTED 3592 1332
0 DSK_GRP_02 DISMOUNTED 0 0
From ASM instance 2:-
[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM2
The Oracle base has been set to /u01/app/oracle
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 20 14:02:29 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ -------------------- ----------- ---------- ----------
1 DATA MOUNTED 3592 1332
0 DSK_GRP_02 DISMOUNTED 0 0
13) Login as "root" user, enable and mount the new diskgroup:-
[root@rac2 oracle]# srvctl enable diskgroup -g DSK_GRP_02
PRCC-1010 : DSK_GRP_02 was already enabled
PRCR-1002 : Resource ora.DSK_GRP_02.dg is already enabled
[root@rac2 oracle]# srvctl start diskgroup -g DSK_GRP_02
[root@rac2 oracle]# crsctl stat resource -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DSK_GRP_02.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
From ASM instance 2:-
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ -------------------- ----------- ---------- ----------
1 DATA MOUNTED 3592 1332
2 DSK_GRP_02 MOUNTED 5114 5021
From database instance 2:-
[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? babu
expThe Oracle base has been set to /u01/app/oracle
[oracle@rac2 ~]$ export ORACLE_SID=babu2
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 20 14:04:55 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DATA CONNECTED 3592 1332
2 DSK_GRP_02 MOUNTED 5114 5021
Now the new diskgroup DSK_GRP_02 is ready for use.
Next step is to manually create a 11g RAC database and placing the database files in the newly created DISKGROUP.
Subscribe to:
Post Comments (Atom)
1 comment:
Thanks for Information Oracle Online Training
Post a Comment