Currently Being Moderated
neto

Integrating Snap Creator into ASMLib (Clones)

Posted by neto in Databases on Sep 18, 2013 7:02:45 AM

Hi All,

 

This is neto from Brazil

 

How are you?

 

Here is a wonderful procedure created by the rock star Mike Doherty (NetApp) to integrate Snap Creator Framework into ASMLib (Clones) - Oracle environment.

 

We need to improve it a little bit (e.g. to handle multiple clones on the same host, error handling, etc) but this is a great start.

 

Check V2

 

#!/bin/ksh

# Created 9/17/13

#

# NetApp

#

# Authors:            Mike Doherty, Neto from Brazil, Greg Loughmiller

#

# Purpose:  Automate cloning with ASMLib, scan new luns, rename ASM Disks, rename DiskGroups

#

# - version 0.2

#

# Change Log:

# Created 9-17-2013

#

# Mod 9-18-2013

# replace string with dd -- much faster

# added better logic for disks, used config file instead of string/*

# added asmcmd mount of new DG clones

#

#

#

# NOTES:

# Best if run as ASM owner as asmcmd cmd is invoked to +ASM instance

# You can edit asmcmd and add sudo -E -u <owner> asmcmd mount <variable>

# This is if you add script in SC POST_CLONE_CREATE_CMD01= /script_name

#

# To automate process uncomment lines 66-68

#

######################################################################

# Variable Definitions

# p = current working directory

# b = original asm disk pulled from querydisk

# c = original DG pulled from device header

#

#

#

######################################################################

# Variables

p=`pwd`

#

#

######################################################################

#

sudo /usr/local/bin/ql-dynamic-tgt-lun-disc.sh -s -r << EOF

yes

 

EOF

# Remove exsisting files

rm renamedisks.sh

rm renamedg.sh

rm *.tmp

rm asm_*

 

sudo sanlun lun show -p |grep  -A 3 -i "cl_" |grep "DM-MP DevName:" |   awk '{print $3}' | while read i dummy

do

b=`sudo /etc/init.d/oracleasm querydisk /dev/mapper/$i | awk '{print $11}' | cut -d'"' -f2`

c=`sudo dd if=/dev/mapper/$i bs=1 skip=104 count=11`

echo "sudo /etc/init.d/oracleasm force-renamedisk /dev/mapper/$i CL$b" >> renamedisks.sh

echo "/dev/oracleasm/disks/CL$b $c CL_$c" >> asm_$c.conf

echo "renamedg phase=two dgname=$c newdgname=CL_$c config=asm_$c.conf" >> rndg.tmp

echo "asmcmd mount CL_$c" >> asm.tmp

done

sort rndg.tmp | uniq > renamedg.sh

sort asm.tmp | uniq > asm_mount.sh

sudo chmod 777 *

#$p/renamedisks.sh

#$p/renamedg.sh

#$p/asm_mount.sh

 

Some real data:

 

[oracle@hps11][+ASM][~/ASM]$ ./new_mike.sh

Please make sure there is no active I/O before running this script

Do you want to continue: (yes/no)?

 

Scanning HOST: host0

.............

 

Scanning HOST: host1

....

Found

0:0:0:4

0:0:0:5

0:0:0:6

0:0:1:4

0:0:1:5

0:0:1:6

1:0:0:4

1:0:0:5

1:0:0:6

1:0:1:4

1:0:1:5

1:0:1:6

 

11+0 records in

11+0 records out

11 bytes (11 B) copied, 0.000325 seconds, 33.8 kB/s

11+0 records in

11+0 records out

11 bytes (11 B) copied, 0.000323 seconds, 34.1 kB/s

11+0 records in

11+0 records out

11 bytes (11 B) copied, 0.000281 seconds, 39.1 kB/s

Renaming disk "/dev/mapper/360a98000486e2f4c533474674b62454[  OK  ]LARCH1":

Renaming disk "/dev/mapper/360a98000486e2f4c533474674b62424[  OK  ]LDATA1":

Renaming disk "/dev/mapper/360a98000486e2f4c533474674b62392[  OK  ]LCNTL1":

 

Parsing parameters..

renamedg operation: phase=two dgname=ARCH newdgname=CL_ARCH config=asm_ARCH.conf

Executing phase 2

Completed phase 2

 

Parsing parameters..

renamedg operation: phase=two dgname=CNTL newdgname=CL_CNTL config=asm_CNTL.conf

Executing phase 2

Completed phase 2

 

Parsing parameters..

renamedg operation: phase=two dgname=DATA newdgname=CL_DATA config=asm_DATA.conf

Executing phase 2

Completed phase 2

 

[oracle@hps11][+ASM][~/ASM]$

[oracle@hps11][+ASM][~/ASM]$ asmcmd ls

ARCH/

CL_ARCH/

CL_CNTL/

CL_DATA/

CNTL/

DATA/

REDO/

 

All the best

 

neto

NetApp - I love this company!

Comments

Filter Blog

By date:
By tag: