12-03-2012 08:02 AM - edited 12-05-2012 11:13 AM
We had a raw device (disk115) that was presented to Oracle ASM. This device was inadvertently used in LVM, pvcreate was used to create the physical volume. We want to re-present this disk back to Oracle ASM. Is there a way to undo the pvcreate and make the LUN a raw device again? This is a development server and Oracle DBAs are learning ASM.
12-03-2012 08:16 AM
All disk (LUN) devices have a raw and cooked device file. LVM simply initializes data on the disk (and destroys anything else that was on the disk (ie, Oracle). If the disk was incorprated into a volume group, you'll have to remove any logical volumes that are attached to this disk, then vgreduce the disk from the VG. Now the disk can be added to the Oracle definitions. If it already exists, it will need repair/rebuild using standard Oracle tools.
12-06-2012 05:34 AM
The pvcreate command creates an unique PVID for the new PV and initializes the LVM metadata at the beginning of the disk. It does not backup the data it overwrites. You can use the pvremove command to remove the LVM metadata, but the command has no way of restoring what was there before the pvcreate command was run.
According to some "cookbook" documents I found with Google, the beginning of the disk needs to be filled with zero bytes or ASM won't accept it (this prevents ASM from accidentally claiming disks that are already in use).
If the pvremove command is not enough to make the disk available to ASM again, you probably need to do something like this:
dd if=/dev/zero of=/dev/rdisk/disk115 bs=8192 count=12800
The "cookbook" document referred to Oracle Metalink Note 268481.1 for more information regarding this command.