While working with Oracle databases running on Solaris servers, often we come across activities involving storage allocation of multiple disks for usage by the database. Those familiar with Oracle ASM would be aware that for disks to be used by Oracle ASM they must be labeled such that all the disk space is assigned to slice 6 starting from cylinder 1.
This is a small script I wrote to match WWNs to disk names if the storage is being allocated from HP 3PAR storage arrays.
The SAN administrator will usually provide a text file consisting of the WWN details looking something like the small snippet below:
Active VLUNs
Lun VVName -------------VV_WWN------------- HostName -Host_WWN/iSCSI_Name- Port Type Status ID
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 0:2:2 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 1:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 1:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 1:2:2 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 2:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 2:2:2 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 3:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 3:2:2 host active 1
------------------------------------------------------------------------------------------------------------------
8 total
This is a small script I wrote to match WWNs to disk names if the storage is being allocated from HP 3PAR storage arrays.
The SAN administrator will usually provide a text file consisting of the WWN details looking something like the small snippet below:
Active VLUNs
Lun VVName -------------VV_WWN------------- HostName -Host_WWN/iSCSI_Name- Port Type Status ID
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 0:2:2 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 1:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 1:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 1:2:2 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 2:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 2:2:2 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF880186 3:2:1 host active 1
30disk_root_desc 60002AC00000000000004A570000935D server_loc 21000024FF88018A 3:2:2 host active 1
------------------------------------------------------------------------------------------------------------------
8 total
Copy the contents of the text file into a file on the server & name it detail.txt.
Here is the script:
#!/bin/bash
for i in `cat detail.txt | awk '{print $3}' | egrep -v 'showvlun|VV_WWN' | uniq -u`
do
echo "Corresponding to
`cat detail.txt | awk '{print $2,$3}' | egrep -v 'Templates|VVName|total|VLUNs|cli%' | uniq -u | cut -d "_" -f2,3,4 | grep $i | sed '/^$/d' `
disk is `echo | format | grep -i $i | awk '{print $1,$6}' | egrep -v '3PARdata|scsi|alt'` "
done
The output of this script will be as follows:
Corresponding to
root_desc 60002AC00000000000000BEE0000935C
disk is c0t60002AC00000000000000BEE0000935Cd0: 149.99GB
Corresponding to
bin_desc 60002AC00000000000000BEF0000935C
disk is c0t60002AC00000000000000BEF0000935Cd0: 50.00GB
The output prints the VV name, WWN, the matching disk name & the size of the disk.
To label all the disks in one go, put the names of the disks in a file named disks.txt & run the following for loop:
for i in `cat disks.txt`
do
printf "p\n0\n\n\n0\n0\n1\n\n\n0\\n0\n6\n\n\n1\n$\nlabel\nyes\nquit\nquit" | format -d $i
done
The above for loop will label all the disks assigning all space to slice 6 starting at cylinder 1.
No comments:
Post a Comment