Monday, September 30, 2013

How to Setup Oracle ASM






Information about Configuring Oracle ASM for Database Servers.

This document describes how to configure Linux Oracle RAC servers with ASM (Automatic Storage Management).

You must complete the 'How To Configure Servers for Oracle RAC' first and have the DBA install the Oracle Software before performing the tasks described here.

Document Creator Todd Walters

How to Configure Oracle ASM
How to create Oracle ASM Disk groups.

Raid group 0 would be configured as raid5.
These drives are all used by the vault and therefore should be kept together, and used for very low i/o.
Raid group 1-5 are configured as raid1.  
         RG 1 – Single lun (lun10) assigned to SPA
         RG 2 – Single lun (lun21) assigned to SPB
         RG 3 – Single lun (lun30) assigned to SPA
         RG 4 – Single lun (lun41) assigned to SPB
         RG 5 – Single 20GB lun assigned to SPA
Raid Group 239 & 238 assigned as Hot Spares

Login to EMC Navisphere @ 192.168.X.X

-        Create Raid Groups as specified above.
-        Add LUNS to Raid Groups as numbered above
-        Add Raid Groups to the three Storage Groups.

Login to srv0dbx01
Run /etc/init.d/PowerPath start
Run powermt display dev=all to display list of emcpower devices.
Run [root@srv0dbx01 init.d]# /opt/cci/bin/lun_scan.sh all
Scanning lpfc HBA instance with scsi host number : 1
Scanning lpfc HBA instance with scsi host number : 2
-        This will scan the luns for any new devices
Run powermt display dev=all again to view devices.
*NOTE: If you need to rename pseudo devices do this:
Using 4.5.3 I've run these commands so far to clear it up
  
[root@srv0dbx01 sbin]# emcpadm renamepseudo -s emcpowera -t emcpowerz
[root@srv0dbx01 sbin]# emcpadm renamepseudo -s emcpowerb -t emcpowery
[root@srv0dbx01 sbin]# emcpadm renamepseudo -s emcpowerd -t emcpowera

 
last command there moves lun0/emcpowerd to emcpowera
 
List of Current LUNS on srv0dbx01 as of 09/11/08
[root@srv0dbx01 ~]# cat /home/admins/emcpinv_srv0dbx01.mysite.com
#######################################################################
# emcpinv
# Timestamp: Thu Sep 11 15:55:07 2008
# Hostname: srv0dbx01.mysite.com
# Pseudo|Logical Dev ID
#######################################################################
emcpowera|60060160F5701D0022F0D4676C74DD11 [LUN 0]
emcpowerb|60060160F5701D0023F0D4676C74DD11 [LUN 1]
emcpowerc|60060160F5701D0024F0D4676C74DD11 [LUN 2]
emcpowerd|60060160F5701D0025F0D4676C74DD11 [LUN 3]
emcpowere|60060160F5701D0026F0D4676C74DD11 [LUN 4]
emcpowerf|60060160F5701D00A89D50024E80DD11 [LUN 30]
emcpowerg|60060160F5701D00DA42E9BC4379DD11 [LUN 10]
emcpowerh|60060160F5701D0052DD912E4479DD11 [LUN 21]
emcpoweri|60060160F5701D009ECAE24C4E80DD11 [LUN 41]
emcpowerj|60060160F5701D00A808FBB64479DD11 [LUN 50]
emcpowerk|60060160F5701D001EC9647D637BDD11 [LUN 100]

ASM Commands

To create the ASM Disks and mark them for ASM you have to run the oracleasm command in init.d. But first you need to fdisk the device and partition it.

Run fdisk /dev/emcpowerf and create primary partition on it and
Write the partition table. Do this for all the ASM disks.\

fdisk  definitions
m to show help
p to show partition table
d to delete a partition
n to create new partion
w to write the partition table

Run fdisk > n > p > partition #1 > default > default > p to view and finally w to write./etc/init.d/oracleasm createdisk WA_046903FE /dev/emcpowerf1

Create the ASM disks:
[root@srv0dbx01 init.d]# ./oracleasm createdisk F_15960030 /dev/emcpowerf1
Marking disk "/dev/emcpowerf1" as an ASM disk:             [  OK  ]
[root@srv0dbx01 init.d]# ./oracleasm createdisk G_15960010 /dev/emcpowerg1
Marking disk "/dev/emcpowerg1" as an ASM disk:             [  OK  ]
[root@srv0dbx01 init.d]# ./oracleasm createdisk H_15960021 /dev/emcpowerh1
Marking disk "/dev/emcpowerh1" as an ASM disk:             [  OK  ]
[root@srv0dbx01 init.d]# ./oracleasm createdisk I_15960041 /dev/emcpoweri1
Marking disk "/dev/emcpoweri1" as an ASM disk:             [  OK  ]
[root@srv0dbx01 init.d]# ./oracleasm createdisk J_15960050 /dev/emcpowerj1
Marking disk "/dev/emcpowerj1" as an ASM disk:             [  OK  ]

Naming definition
F = powerpath device letter i.e. /dev/emcpowerf
1596 = Last four of EMC SAN Serial Number
0030 = LUN Number i.e. lun 30 with 00 as placeholder
[root@srv0dbx01 init.d]# ./oracleasm listdisks
F_15960030
G_15960010
H_15960021
I_15960041
J_15960050

Configure ASM
[root@srv0dbx01 init.d]# ./oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]:
Default group to own the driver interface [dba]:
Start Oracle ASM library driver on boot (y/n) [y]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration:           [  OK  ]
Scanning system for ASM disks:                             [  OK  ]


This next step will be passed off to the DBA’s to complete.

Switch User to Oracle and set SID to +ASM1
ssh srv0dbx01
su - oracle
. oraenv
ORACLE_SID = ? +ASM1
Sqlplus sys as sysdba
Enter password:

select * from v$asm_disk

ORCL:F_15960030
ORCL:G_15960010
ORCL:H_15960021
ORCL:I_15960041
ORCL:J_15960050

Now we will create PWAKDB_DATA_01

select label,path,total_mb,header_status from v$asm_disk ORDER by TOTAL_MB,LABEL;

create diskgroup PWAKDB_DATA_01 EXTERNAL REDUNDANCY Disk ‘ORCL:F_15960030‘;

select * FROM V$ASM_DISKGROUP

alter diskgroup PWAKDB_DATA_01 add disk ‘ORCL:G_15960010’;
alter diskgroup PWAKDB_DATA_01 add disk ‘ORCL:H_15960021’;
alter diskgroup PWAKDB_DATA_01 add disk ‘ORCL:I_15960041’;

SQL>  select name,total_mb from v$asm_diskgroup;

NAME                             TOTAL_MB
------------------------------ ----------
PWAKDB_DATA_01                     272788
PWAKDB_BACKUP_01                    20479

select label,path,total_mb,header_status from v$asm_disk ORDER by 3,1;

Create backup diskgroup for Archive Logs
create diskgroup PWAKDB_BACKUP_01 EXTERNAL REDUNDANCY Disk ‘ORCL:J_15960050‘;


Mount ASM diskgroup on each additional node:
alter diskgroup PWAKDB_DATA_01 mount;
alter diskgroup PWAKDB_DATA_01 mount;

Add diskgroups to init.ora file:
cd /u00/app/oracle/admin/+ASM/pfile
vi init.ora file and add the following:

asm_diskgroups='PWAKDB_DATA_01','PWAKDB_BACKUP_01'

save and exit. Do this on all nodes.


Commands from Aaron Richards in Atlanta:

ALTER DISKGROUP DATA DROP DISK DATA_0002
alter diskgroup <Diskgroup_name> dismount on all nodes;
drop diskgroup <Diskgroup_name>;

select 'alter diskgroup DOIC_DBF_DG add disk ''' || path || ''';'
from v$asm_disk
where path like 'ORCL:%' and header_status <>'MEMBER' and rownum <= &Number_Disks

create diskgroup TERPTRN_DBF_DG EXTERNAL REDUNDANCY Disk 'ORCL:AD_05700107';
alter diskgroup PERP_DBF_DG add disk 'ORCL:XN_046903D5';
alter diskgroup PERP_DBF_DG add disk 'ORCL:XD_046903E5';
alter diskgroup PERP_DBF_DG mount; on each additional node



No comments:

Post a Comment