⑴--- NEW Physical volume ---
⑵PV Name /dev/sdc
⑶PV Size . GiB
⑷Allocatable NO
⑸PE Size
⑹Total PE
⑺Free PE
⑻Allocated PE
⑼PV UUID VKCJ-GkL-QJgg-Titf-UNA-dQZ-ZTESP
⑽[rootol ~]# vgscan #vgscan时找不到vg_ossdb信息
⑾Reading all physical volumes. This may take a while.。。
⑿Found volume group “vg_ol” using metadata type lvm
⒀[rootol ~]# lvscan #lvscan时找不到lvoradata信息。
⒁ACTIVE ‘/dev/vg_ol/lvopt’ [. GiB] inherit
⒂ACTIVE ‘/dev/vg_ol/lvroot’ [. GiB] inherit
⒃ACTIVE ‘/dev/vg_ol/lvswap’ [. GiB] inherit
⒄ACTIVE ‘/dev/vg_ol/lvhome’ [. GiB] inherit
⒅五、VG恢复思路
⒆、在/etc/lvm/存放着LVM的配置、归档、备份等信息。
⒇[rootol ~]# ls -l /etc/lvm
⒈drwx------。 root root Nov : archive
⒉drwx------。 root root Nov : backup
⒊drwx------。 root root Feb cache
⒋-rw-r--r--。 root root Feb lvm.conf
⒌、在/etc/lvm/backup/下存放着vg的备份信息,但我在操作vg_ossdb之前没有备份其信息到其它目录。
⒍[rootol lvm]# ls /etc/lvm/backup/
⒎-rw-------。 root root Nov : vg_ol
⒏、在 /etc/lvm/archive/下存放着VG及LV调整前的归档信息,即VG变更或LV变更前均会备份当前信息。
⒐[rootol ~]# ls -l /etc/lvm/archive/
⒑-rw-------。 root root Nov : vg_ol_-.vg
⒒-rw-------。 root root Nov : vg_ossdb_-.vg
⒓-rw-------。 root root Nov : vg_ossdb_-.vg
⒔-rw-------。 root root Nov : vg_ossdb_-.vg
⒕-rw-------。 root root Nov : vg_ossdb_-.vg
⒖-rw-------。 root root Nov : vg_ossdb_-.vg
⒗-rw-------。 root root Nov : vg_ossdb_-.vg
⒘-rw-------。 root root Nov : vg_ossdb_-.vg
⒙备注:使用vgcreate、vgreduce、vgremove、lvcreate、lvreduce、lvremove等命令时均会生成新的归档信息
⒚、利用vgcfgrestore命令恢复误删除的VG
⒛[rootol archive]# vgcfgrestore -f /etc/lvm/archive/vg_ossdb_-.vg vg_ossdb
①Restored volume group vg_ossdb
②[rootol archive]# pvdisplay
③--- Physical volume ---
④PV Name /dev/sdb
⑤VG Name vg_ossdb
⑥PV Size . GiB / not usable . MiB
⑦Allocatable yes
⑧PE Size . MiB
⑨Total PE
⑩Free PE
ⅠAllocated PE
ⅡPV UUID Uiwea-IIq-KOx-pA-epf-hlc-NFDJF
Ⅲ--- Physical volume ---
ⅣPV Name /dev/sda
ⅤVG Name vg_ol
ⅥPV Size . GiB / not usable . MiB
ⅦAllocatable yes
ⅧPE Size . MiB
ⅨTotal PE
ⅩFree PE
㈠Allocated PE
㈡PV UUID dyBL-pZM-Mkcw-ae-DXPh-Uzg-kIQz
㈢“/dev/sdc” is a new physical volume of “. GiB”
㈣--- NEW Physical volume ---
㈤PV Name /dev/sdc
㈥PV Size . GiB
㈦Allocatable NO
㈧PE Size
㈨Total PE
㈩Free PE
Allocated PE
PV UUID VKCJ-GkL-QJgg-Titf-UNA-dQZ-ZTESP
上述操作发现只有/dev/sdb在vg_ossdb卷组中了,而/dev/sdc仍然不在vg_ossdb卷组中。这说明/etc/lvm/archive/vg_ossdb_-.vg归档文件较旧,还没有包括/dev/sdc在vg_ossdb卷组中,继续使用下一个归档文件恢复,直到/dev/sdb、/dev/sdc均在vg_ossdb卷组中,并且卷组中包含的LV个数正确。
[rootol archive]# vgcfgrestore -f /etc/lvm/archive/vg_ossdb_-.vg vg_ossdb
Restored volume group vg_ossdb
[rootol archive]# vgchange -ay /dev/vg_ossdb
logical volume(s in volume group “vg_ossdb” now active
[rootol archive]# lvscan
ACTIVE ‘/dev/vg_ossdb/lvoradata’ [. GiB] inherit
ACTIVE ‘/dev/vg_ol/lvopt’ [. GiB] inherit
ACTIVE ‘/dev/vg_ol/lvroot’ [. GiB] inherit
ACTIVE ‘/dev/vg_ol/lvswap’ [. GiB] inherit
ACTIVE ‘/dev/vg_ol/lvhome’ [. GiB] inherit
[rootol archive]# mount /dev/vg_ossdb/lvoradata /oradata/
[rootol archive]# ls -l /oradata/ossdb/
-rwxrwxr-x. Oracle oinstall Nov : control.ctl
-rwxrwxr-x. oracle oinstall Nov : redo.log
-rwxrwxr-x. oracle oinstall Nov : redo.log
-rwxrwxr-x. oracle oinstall Nov : redo.log
-rwxrwxr-x. oracle oinstall Nov : sysaux.dbf
-rwxrwxr-x. oracle oinstall Nov : system.dbf
-rwxrwxr-x. oracle oinstall Nov : temp.dbf
-rwxrwxr-x. oracle oinstall Nov : undotbs.dbf
-rwxrwxr-x. oracle oinstall Nov : users.dbf
//省略。。。。
启动数据库,一切正常。
[rootol /]# vgcfgbackup -f /home/vg_ossdb.backup vg_ossdb
上面就是Oracle Linux .不小心删除VG的解决方法的介绍了,为了避免下次再误删VG,记得对VG数据做个备份。