This 'ere is a little something I picked up while trying to attend one of Oracle's Field Change Order for the Oracle Database Appliance, where I was tasked to replace 10 600GB SAS hard disk drives.
As it turns out the disks are being managed by Oracle ASM. Never in the world have I worked on this before and before you know it I was googling away.
Basically the only information I had was the serial number of the Oracle Database Appliance, of which I will refer to as ODA henceforth, the number of disks that are to be replaced, the serial numbers, and well that's pretty much it.
Armed with some knowledge, the equipment model and make, plus the disks (model and make too), I asked the chap, well the customer who was tasked by his superiors to look after this ODA. A really nice Malay chap. Yeah, and so he had first helped me out by pulling out one of those KVM consoles that is used to access to the ODA. And once he logged in, oh well, I can see that it's running on Oracle's OEL 5 update 7 to be precise.
The first thing I had to figure out what, I need to match which disks corresponds physically with the list of serial numbers I had in hand. As it turns out the ODA had a nifty too used to interact with the OAK. OAK, as of writing is the Oracle Appliance Manager. So far I only know it handles all the nitty gritty disks stuffs. It manages disks that is discovered by OS, invokes gparted (apparently) and give name to the disks according to the enclosure and slot numbers. Pretty neat eh?
Alright, so in order to find out which disk corresponds to which serial number, I invoked:
grid@cs-oa1 $ /u01/app/oracle/grid/bin/oak show disk | awk '{print $1}'
pd_00
pd_01
...
..
pd_23
This particular ODA has 2 slots for two SATA disks, which is basically installed with Oracle's OEL, this is located at the back of the ODA. While at the front, there are 24 slots that has been designated slot where the data disks would be.
To find out what the details of the disk, such as the status, the disk name, the multipath name, the current active disk name, etc. I had invoked the following:
grid@cs-oda1 $ oakcli show disk pd_00 | egrep -i "diskid|multipathlist|serial|slotnum|sate|prevusrdevname|usrdevname|state"
DiskId : 35000cca02aae9414
IState : 0
MultiPathList : |/dev/sdan||/dev/sdd|
PrevState : 0
PrevUsrDevName :
SerialNum : 001238K30BJL
SlotNum : 4
State : Online
StateChangeTs : 1372319243
StateDetails : Good
UsrDevName : HDD_E0_S04_716084244
Armed with this knowledge I wrote a little script to find out the disk that needs to be replaced based on the list of serial numbers I had. Let's call it findserial.sh
#!/bin/sh
ORACLE_HOME=/u01/app/oracle/grid
ORACLE_SID=+ASM1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_HOME ORACLE_SID PATH
disks=`oak show disk | awk '{print $1}'`
for serial in `cat serials.txt`; do
for disk in $disks
disk_serial=`oak show $disk | grep -i serialnum | awk '{print $3}'`
echo $serial | grep "^$disk_serial$" 1>&2 >/dev/null; found_serial=$?
if [ $found_serial -eq 0 ];
echo "Found $disk:$disk_serial"
fi
done
done
On the other hand I create a text that contains the list of serial numbers.
grid@cs-oda1 # cat serials.txt
1238K2UW2L
1238K302JL
...
..
So when I ran the script the output would look something like the following:
grid@cs-oda1 $ ./findserial.sh
Found pd_10:1238K2UW2L
Found pd_18:1238K302JL
Another good feature of the OAK cli, it can be used to lit up the amber light LED on the corresponding disk
grid@cs-oda1 $ oak locate disk pd_00 on
The locate disk command can be integrated with the findserial.sh script mentioned above by adding it after the line
echo "Found $disk:$disk_serial"
oakcli locate disk $disk on
Fire it up and voila the list of disk will be lit up based on the serial numbers contained in the text file serials.txt.
No comments:
Post a Comment