【Linux】将Oracle安装目录从根目录下迁移到逻辑卷

Linux】将Oracle安装目录从根目录下迁移到逻辑卷

 

1.1  BLOG文档结构图

 

 

1.2  前言部分

1.2.1  导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

Linux逻辑卷的创建和管理(重点)

Tips:

① 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和微信公众号(xiaomaimiaolhr)上有同步更新。

② 文章中用到的所有代码、相关软件、相关资料及本文的pdf版本都请前往小麦苗的云盘下载,小麦苗的云盘地址见:http://blog.itpub.net/26736162/viewspace-1624453/

③ 若网页文章代码格式有错乱,请下载pdf格式的文档来阅读。

④ 在本篇BLOG中,代码输出部分一般放在一行一列的表格中。

本文有错误或不完善的地方请大家多多指正,您的批评指正是我写作的最大动力。

 

1.2.2  相关文章链接

linux逻辑卷管理:http://blog.itpub.net/26736162/viewspace-2124620/,这篇文章非常不错。

1.2.3  本文简介

由于Oracle版本太多,鉴于学习使用,所以,小麦苗在RHEL6.5上安装了Oracle 11.2.0.3、Oracle 10.2.0.1和Oracle 10.2.0.4。但是由于没有采用逻辑卷的管理方式,现在根目录磁盘空间不足,而且也添加了好几块硬盘了,管理非常不方便。以后等Oracle 12cR2出来后还得安装在一起,想了想还是一次性将这些Oracle的安装目录都迁移到逻辑卷中,以后也好管理。本文记录了迁移过程,以备有同样需求的朋友使用。

 

1.3  迁移过程

1.3.1  磁盘现状

 

最后操作的结果就是把磁盘2、3、4和5去掉,只剩下1块或2块磁盘。

 

1.3.2  分区并创建物理卷


[root@rhel6_lhr ~]# df -h

Filesystem                 Size  Used Avail Use% Mounted on

/dev/sda2                   48G   43G  3.0G  94% /

tmpfs                      2.0G  432M  1.6G  22% /dev/shm

/dev/sda1                  283M   58M  210M  22% /boot

/dev/mapper/testvg-testlv  380M  321M   40M  90% /var/lib/mysql

/dev/sdc1                  9.9G  4.0G  5.5G  43% /u03

/dev/sde1                   20G  7.3G   12G  39% /u04

/dev/sdf1                   50G   30G   18G  63% /u05

 

[root@rhel6_lhr ~]# fdisk -l |grep dev

Disk /dev/sda: 107.4 GB, 107374182400 bytes

/dev/sda1   *           1          39      307200   83  Linux

/dev/sda2              39        6401    51104768   83  Linux

/dev/sda3            6401        6528     1015808   82  Linux swap / Solaris

/dev/sda4            6528       13054    52427455    5  Extended

Disk /dev/sdc: 10.7 GB, 10737418240 bytes

/dev/sdc1               1        1305    10482381   83  Linux

Disk /dev/sdd: 5368 MB, 5368709120 bytes

Disk /dev/sdf: 53.7 GB, 53687091200 bytes

/dev/sdf1               1        6527    52428096   83  Linux

Disk /dev/sdg: 21.5 GB, 21474836480 bytes

Disk /dev/sde: 21.5 GB, 21474836480 bytes

/dev/sde1               1        2610    20964793+  83  Linux

Disk /dev/mapper/testvg-testlv: 419 MB, 419430400 bytes

[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]# fdisk /dev/sda

 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').

 

Command (m for help): p

 

Disk /dev/sda: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000bd0a0

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          39      307200   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              39        6401    51104768   83  Linux

/dev/sda3            6401        6528     1015808   82  Linux swap / Solaris

 

Command (m for help): m

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

 

Command (m for help): l

 

0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris       

1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-

2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-

3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-

4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx        

5  Extended        42  SFS             86  NTFS volume set da  Non-FS data   

6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .

7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility  

8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt        

9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access    

a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O       

b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor     

c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs       

e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT           

f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/

10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b

11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor     

12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor     

14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary 

16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS   

17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE

18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto

1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep       

1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT           

1e  Hidden W95 FAT1

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Selected partition 4

First cylinder (6528-13054, default 6528):

Using default value 6528

Last cylinder, +cylinders or +size{K,M,G} (6528-13054, default 13054):

Using default value 13054

 

Command (m for help): t

Partition number (1-4): 4

Hex code (type L to list codes): 8e

Changed system type of partition 4 to 8e (Linux LVM)

 

Command (m for help): p

 

Disk /dev/sda: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000bd0a0

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          39      307200   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              39        6401    51104768   83  Linux

/dev/sda3            6401        6528     1015808   82  Linux swap / Solaris

/dev/sda4            6528       13054    52427455   8e  Linux LVM

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[root@rhel6_lhr ~]# partprobe

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdc (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sde (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdf (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]# pvcreate /dev/sda4

  dev_is_mpath: failed to get device for 8:4

  dev_is_mpath: failed to get device for 8:4

  Device /dev/sda4 not found (or ignored by filtering).

[root@rhel6_lhr ~]# fdisk -l /dev/sda

 

Disk /dev/sda: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000bd0a0

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          39      307200   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              39        6401    51104768   83  Linux

/dev/sda3            6401        6528     1015808   82  Linux swap / Solaris

/dev/sda4            6528       13054    52427455   8e  Linux LVM

[root@rhel6_lhr ~]#

 

[root@rhel6_lhr ~]# pvcreate /dev/sda4

  Device /dev/sda4 not found (or ignored by filtering).

[root@rhel6_lhr ~]# l /dev/sda4

brw-rw---- 1 root disk 8, 4 Dec 26 09:51 /dev/sda4

[root@rhel6_lhr ~]# reboot

 

Broadcast message from root@rhel6_lhr

        (/dev/pts/1) at 10:12 ...

 

The system is going down for reboot NOW!

[root@rhel6_lhr ~]#

Last login: Mon Dec 26 10:06:09 2016 from 192.168.59.1

[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]# df -h

Filesystem                 Size  Used Avail Use% Mounted on

/dev/sda2                   48G   43G  3.0G  94% /

tmpfs                      2.0G     0  2.0G   0% /dev/shm

/dev/sda1                  283M   58M  210M  22% /boot

/dev/mapper/testvg-testlv  380M  321M   40M  90% /var/lib/mysql

/dev/sdc1                  9.9G  4.0G  5.5G  43% /u03

/dev/sde1                   20G  7.3G   12G  39% /u04

/dev/sdf1                   50G   30G   18G  63% /u05

[root@rhel6_lhr ~]# fdisk -l /dev/sda

 

Disk /dev/sda: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000bd0a0

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          39      307200   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              39        6401    51104768   83  Linux

/dev/sda3            6401        6528     1015808   82  Linux swap / Solaris

/dev/sda4            6528       13054    52427455   8e  Linux LVM

[root@rhel6_lhr ~]# pvcreate /dev/sda4

  Physical volume "/dev/sda4" successfully created

[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]# pvs

  PV         VG     Fmt  Attr PSize  PFree

  /dev/sda4         lvm2 a--  50.00g 50.00g

[root@rhel6_lhr ~]# pvs

  PV         VG     Fmt  Attr PSize  PFree

  /dev/sda4         lvm2 a--  50.00g 50.00g

[root@rhel6_lhr ~]# pvdisplay  

  "/dev/sda4" is a new physical volume of "50.00 GiB"

  --- NEW Physical volume ---

  PV Name               /dev/sda4

  VG Name              

  PV Size               50.00 GiB

  Allocatable           NO

  PE Size               0  

  Total PE              0

  Free PE               0

  Allocated PE          0

  PV UUID               NgZ5Vl-Jbkn-9U71-9Ypp-i2nH-HhlT-cSPQ3o

 

 

 

 

1.3.3  创建卷组


[root@rhel6_lhr ~]# vgcreate vg_orasoft /dev/sda4

  Volume group "vg_orasoft" successfully created

[root@rhel6_lhr ~]# vgdisplay 

  --- Volume group ---

  VG Name               vg_orasoft

  System ID            

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               50.00 GiB

  PE Size               4.00 MiB

  Total PE              12799

  Alloc PE / Size       0 / 0  

  Free  PE / Size       12799 / 50.00 GiB

  VG UUID               PyRYUt-ERDU-NU4o-NWHA-anpD-iTIA-aMGLnV

  

[root@rhel6_lhr ~]# vgs

  VG         #PV #LV #SN Attr   VSize  VFree

  vg_orasoft   1   0   0 wz--n- 50.00g 50.00g

[root@rhel6_lhr ~]# pvs

  PV         VG         Fmt  Attr PSize  PFree

  /dev/sda4  vg_orasoft lvm2 a--  50.00g 50.00g

[root@rhel6_lhr ~]# pvdisplay

  --- Physical volume ---

  PV Name               /dev/sda4

  VG Name               vg_orasoft

  PV Size               50.00 GiB / not usable 2.69 MiB

  Allocatable           yes

  PE Size               4.00 MiB

  Total PE              12799

  Free PE               12799

  Allocated PE          0

  PV UUID               NgZ5Vl-Jbkn-9U71-9Ypp-i2nH-HhlT-cSPQ3o

 

 

 

 

1.3.4  创建逻辑卷


[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]#  lvcreate -n lv_ora_soft_u01 -L 35G vg_orasoft

  Logical volume "lv_ora_soft_u01" created

[root@rhel6_lhr ~]# lvdisplay  

  --- Logical volume ---

  LV Path                /dev/vg_orasoft/lv_ora_soft_u01

  LV Name                lv_ora_soft_u01

  VG Name                vg_orasoft

  LV UUID                FYWeeZ-DMxB-MKBo-Lpeb-kVEz-yCFY-M2Ddmr

  LV Write Access        read/write

  LV Creation host, time rhel6_lhr, 2016-12-26 11:06:03 +0800

  LV Status              available

  # open                 0

  LV Size                35.00 GiB

  Current LE             8960

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:1

  

[root@rhel6_lhr ~]# lvs

  LV              VG         Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert

  lv_ora_soft_u01 vg_orasoft -wi-a-----  35.00g                                            

[root@rhel6_lhr ~]#

[root@rhel6_lhr ~]# vgs

  VG         #PV #LV #SN Attr   VSize  VFree

  vg_orasoft   1   1   0 wz--n- 50.00g 15.00g

[root@rhel6_lhr ~]# pvs

  PV         VG         Fmt  Attr PSize  PFree

  /dev/sda4  vg_orasoft lvm2 a--  50.00g 15.00g

[root@rhel6_lhr ~]# mkfs.ext4 /dev/vg_orasoft/lv_ora_soft_u01

mke2fs 1.43-WIP (20-Jun-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

2293760 inodes, 9175040 blocks

458752 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

280 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000, 7962624

 

Allocating group tables: done                           

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done  

 

[root@rhel6_lhr ~]#

 

 

 

 

 

 

1.3.5  停止Oracle的所有进程


 

[root@rhel6_lhr ~]# ps -ef|grep ora

grid      3087     1  0 10:18 ?        00:00:27 /u01/app/grid/11.2.0/bin/oraagent.bin

grid      3265     1  0 10:18 ?        00:00:00 oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

grid      3270     1  0 10:18 ?        00:00:00 oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle    3640     1  0 10:18 ?        00:00:00 ora_pmon_orclasm

oracle    3642     1  0 10:18 ?        00:00:00 ora_psp0_orclasm

oracle    3648     1  1 10:18 ?        00:00:51 ora_vktm_orclasm

oracle    3652     1  0 10:18 ?        00:00:00 ora_gen0_orclasm

oracle    3654     1  0 10:18 ?        00:00:00 ora_diag_orclasm

oracle    3656     1  0 10:18 ?        00:00:00 ora_dbrm_orclasm

oracle    3658     1  0 10:18 ?        00:00:03 ora_dia0_orclasm

oracle    3660     1  0 10:18 ?        00:00:00 ora_mman_orclasm

oracle    3662     1  0 10:18 ?        00:00:00 ora_dbw0_orclasm

oracle    3664     1  0 10:18 ?        00:00:00 ora_lgwr_orclasm

oracle    3666     1  0 10:18 ?        00:00:01 ora_ckpt_orclasm

oracle    3668     1  0 10:18 ?        00:00:00 ora_smon_orclasm

oracle    3670     1  0 10:18 ?        00:00:00 ora_reco_orclasm

oracle    3672     1  0 10:18 ?        00:00:00 ora_rbal_orclasm

oracle    3674     1  0 10:18 ?        00:00:00 ora_asmb_orclasm

oracle    3676     1  0 10:18 ?        00:00:00 ora_mmon_orclasm

oracle    3678     1  0 10:18 ?        00:00:01 ora_mmnl_orclasm

oracle    3680     1  0 10:18 ?        00:00:00 ora_d000_orclasm

oracle    3682     1  0 10:18 ?        00:00:00 ora_s000_orclasm

oracle    3684     1  0 10:18 ?        00:00:00 oracleorclasm (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

grid      3686     1  0 10:18 ?        00:00:00 oracle+ASM_asmb_orclasm (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle    3689     1  0 10:18 ?        00:00:00 ora_mark_orclasm

oracle    3703     1  0 10:18 ?        00:00:00 ora_rvwr_orclasm

oracle    3717     1  0 10:19 ?        00:00:00 ora_arc0_orclasm

oracle    3738     1  0 10:19 ?        00:00:00 ora_arc1_orclasm

oracle    3740     1  0 10:19 ?        00:00:00 ora_arc2_orclasm

oracle    3742     1  0 10:19 ?        00:00:00 ora_arc3_orclasm

oracle    3752     1  0 10:19 ?        00:00:00 ora_ctwr_orclasm

oracle    3758     1  0 10:19 ?        00:00:00 ora_fbda_orclasm

oracle    3760     1  0 10:19 ?        00:00:00 ora_qmnc_orclasm

oracle    3775     1  0 10:19 ?        00:00:00 oracleorclasm (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle    3779     1  0 10:19 ?        00:00:00 ora_q000_orclasm

oracle    3781     1  0 10:19 ?        00:00:00 ora_q001_orclasm

oracle    3790     1  0 10:19 ?        00:00:00 oracleorclasm (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle    3813     1  0 10:19 ?        00:00:00 ora_cjq0_orclasm

oracle    3820     1  0 10:19 ?        00:00:01 ora_j000_orclasm

oracle    3822     1  0 10:19 ?        00:00:08 ora_j001_orclasm

oracle    4115     1  0 10:24 ?        00:00:00 ora_smco_orclasm

oracle    6197     1  0 11:04 ?        00:00:00 ora_w000_orclasm

oracle    6283     1  0 11:05 ?        00:00:00 ora_w001_orclasm

root      6361  2323  0 11:07 pts/1    00:00:00 grep ora

[root@rhel6_lhr ~]# crsctl stop has -f

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rhel6_lhr'

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rhel6_lhr'

CRS-2673: Attempting to stop 'ora.orclasm.db' on 'rhel6_lhr'

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rhel6_lhr' succeeded

CRS-2677: Stop of 'ora.orclasm.db' on 'rhel6_lhr' succeeded

CRS-2673: Attempting to stop 'ora.FRA.dg' on 'rhel6_lhr'

CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rhel6_lhr'

CRS-2677: Stop of 'ora.FRA.dg' on 'rhel6_lhr' succeeded

CRS-2677: Stop of 'ora.DATA.dg' on 'rhel6_lhr' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'rhel6_lhr'

CRS-2677: Stop of 'ora.asm' on 'rhel6_lhr' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'rhel6_lhr'

CRS-2677: Stop of 'ora.cssd' on 'rhel6_lhr' succeeded

CRS-2673: Attempting to stop 'ora.ons' on 'rhel6_lhr'

CRS-2673: Attempting to stop 'ora.evmd' on 'rhel6_lhr'

CRS-2677: Stop of 'ora.ons' on 'rhel6_lhr' succeeded

CRS-2677: Stop of 'ora.evmd' on 'rhel6_lhr' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rhel6_lhr' has completed

CRS-4133: Oracle High Availability Services has been stopped.

[root@rhel6_lhr ~]# ps -ef|grep ora  

root      6420  2323  0 11:07 pts/1    00:00:00 grep ora

[root@rhel6_lhr ~]# ps -ef|grep d.bin

root      6425  2323  0 11:07 pts/1    00:00:00 grep d.bin

 

 

 

1.3.6  开始迁移

注意这里的迁移技巧:


[root@rhel6_lhr ~]# mkdir /u11

[root@rhel6_lhr ~]# mount /dev/vg_orasoft/lv_ora_soft_u01 /u11

[root@rhel6_lhr ~]# mv /u01/*  /u11/

[root@rhel6_lhr ~]# umount /u01

[root@rhel6_lhr ~]# umount /u11

[root@rhel6_lhr ~]# mount /dev/vg_orasoft/lv_ora_soft_u01 /u01

[root@rhel6_lhr ~]# df -h

Filesystem                                Size  Used Avail Use% Mounted on

/dev/sda2                                  48G   43G  3.1G  94% /

tmpfs                                     2.0G   76K  2.0G   1% /dev/shm

/dev/sda1                                 283M   58M  210M  22% /boot

/dev/sdc1                                 9.9G  4.0G  5.5G  43% /u03

/dev/sde1                                  20G  7.3G   12G  39% /u04

/dev/sdf1                                  50G   30G   18G  63% /u05

/dev/mapper/vg_orasoft-lv_ora_soft_u01     35G   28G  4.8G  86% /u01

 

 

 

依次类推,将其它的所有盘的文件都迁移至逻辑卷中,最终结果如下:


[root@rhel6_lhr ~]# df -h

Filesystem                               Size  Used Avail Use% Mounted on

/dev/sda2                                 48G   12G   35G  25% /

tmpfs                                    2.0G   76K  2.0G   1% /dev/shm

/dev/sda1                                283M   58M  210M  22% /boot

/dev/mapper/vg_orasoft-lv_orasoft_u01     35G   28G  4.8G  86% /u01

/dev/mapper/vg_orasoft-lv_orasoft_u02    5.8G  3.6G  2.0G  65% /u02

/dev/mapper/vg_orasoft-lv_orasoft_u03    5.8G  3.8G  1.8G  69% /u03

/dev/mapper/vg_orasoft-lv_orasoft_mysql  976M  320M  605M  35% /var/lib/mysql

/dev/mapper/vg_oradata-lv_oradata_u04    9.8G  7.3G  2.1G  79% /u04

/dev/mapper/vg_oradata-lv_oradata_u05     30G   23G  5.5G  81% /u05

 

1.3.7  修改/etc/fstab

修改/etc/fstab文件,加入如下内容:


/dev/vg_orasoft/lv_orasoft_u01 /u01  ext4 defaults 0 0

/dev/vg_orasoft/lv_orasoft_u02 /u02  ext4 defaults 0 0

/dev/vg_orasoft/lv_orasoft_u03 /u03  ext4 defaults 0 0

/dev/vg_oradata/lv_oradata_u04 /u04  ext4 defaults 0 0

/dev/vg_oradata/lv_oradata_u05 /u05  ext4 defaults 0 0

/dev/vg_orasoft/lv_orasoft_mysql /var/lib/mysql ext4 defaults 0 0

 

 

1.3.8  启动数据库验证


[root@rhel6_lhr ~]# crsctl start has

CRS-4123: Oracle High Availability Services has been started.

[root@rhel6_lhr ~]#

                                                             TARTING            

[root@rhel6_lhr ~]# crsctl stat res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       rhel6_lhr                                   

ora.FRA.dg

               ONLINE  ONLINE       rhel6_lhr                                   

ora.LISTENER.lsnr

               ONLINE  ONLINE       rhel6_lhr                                   

ora.asm

               ONLINE  ONLINE       rhel6_lhr                Started            

ora.ons

               ONLINE  ONLINE       rhel6_lhr                                   

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

      1        ONLINE  ONLINE       rhel6_lhr                                   

ora.diskmon

      1        OFFLINE OFFLINE                                                  

ora.evmd

      1        ONLINE  ONLINE       rhel6_lhr                                   

ora.ogg2.db

      1        ONLINE  ONLINE       rhel6_lhr                Open               

ora.orclasm.db

      1        ONLINE  ONLINE       rhel6_lhr                Open               

 

 

 

About Me


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

● 本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

● 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和个人微信公众号(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2131488/

● 本文博客园地址:http://www.cnblogs.com/lhrbest/p/6227487.html

● 本文pdf版及小麦苗云盘地址:http://blog.itpub.net/26736162/viewspace-1624453/

● QQ群:230161599     微信群:私聊

● 联系我请加QQ好友(642808185),注明添加缘由

● 于 2016-12-26 08:00 ~ 2016-12-27 24:00 在农行完成

● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解

● 版权所有,欢迎分享本文,转载请保留出处

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

手机长按下图识别二维码或微信客户端扫描下边的二维码来关注小麦苗的微信公众号:xiaomaimiaolhr,免费学习最实用的数据库技术。

 

时间: 2024-09-23 16:40:00

【Linux】将Oracle安装目录从根目录下迁移到逻辑卷的相关文章

详解如何在AIX环境下通过建逻辑卷添加ORACLE表空间

用lsvg -o命令查看oradatavg卷组有否挂载---------------------------------------------------------------- p550a:/dev#lsvg -o oradatavg rootvg 用smit lv进行逻辑卷维护(选添加逻辑卷)--------------------------------------------------------------- 550a:/dev#smit lv                  

Linux Apache PHP Oracle 安装配置(具体操作步骤)_php技巧

Oracle 就不说了,Linux 是 CentOS.1. 安装 httpd(apache)yum install httpd -y 2. 安装 php, php-gd, php-mcrypt, php-pecl*yum install php php-gd php-mcrypt php-pecl* -y 3. 安装 oci8pecl install oci8安装时输入oracle安装目录 4.修改 httpd.conf找到User apacheGroup apache改成系统中的用户,如:Us

Red Hat Enterprise Linux 6.6安装体验

Red Hat Enterprise Linux 6.6的安装首界面有五个选项,这跟以前的Red Hat Enterprise Linux 5.x的安装界面是有一些区别的.   安装或者升级现有系统(Install or upgrade an existing system)       这个选项是默认的.选择这个选项表示使用图形化安装程序安装红帽企业版系统,如果你要安装或升级一个系统:如果之前存在老的版本需要更新或者安装一个新的系统,请选择此项 使用基本视频驱动程序安装系统(Install s

linux lvm 同一块硬盘多个逻辑卷的教程

系统中有一个sda2是linux lvm格式的,对应了一个lvm的逻辑卷,怎么实现sda2对应二个或者多个逻辑卷呢,详细操作过程如下: 前面二篇文章,也是有关LVM的,每一步都说的很清楚,有兴趣的可以看一下 [root@localhost ~]# df -h    //缩小空间前  Filesystem                    Size  Used Avail Use% Mounted on  /dev/mapper/VolGroup-lv_root  356G   39G  29

Linux下Oracle安装配置宝典

    Oracle的安装包括企业版服务器端和客户端两部分,用户可以根据实际情况选择不同的部分安装.    这里以企业版服务器端为主要介绍对象,客户端的安装方法相对要简单一些.    服务器端安装分为:典型安装.最小安装和定制安装三种.    客户端安装分为:管理员客户端.程序员客户端.应用用户客户端.定制安装客户端.    ■系统需求    1.硬件需求    ● 内存最低配置为128MB,建议使用256MB;    ● 硬盘交换分区至少是400MB或者是内存的二倍以上也可以:  

Linux下的ORACLE安装成功率99.99999%的问题

相信很多童鞋都有过在Linux上安装Oracle数据库的痛苦经历,其中绝大多数都是环境设置的问题.我给大家推荐一个国外大牛写的Oracle的安装脚本 OTK,是用Bash写的,这东东大大简化了Oracle安装过程,而且成功率达到99.9999%以上,只要确保你的Linux系统是干净的,那么按照这个教程,保证你会安装成功. 准备工作 OTK针对各种Linux提供了 安装文档,本文使用的RHEL5.5_x86_64位,数据库版本为11gR2,主要参考这个 文档. 首先准备阿好如下的安装文件: lin

Linux+php+apache+oracle环境搭建之CentOS下安装Oracle数据库_Linux

这里推荐使用OTK脚本安装Oracle,会大大提高安装Oracle的成功系数. Description oraToolKit is the Swiss Army Knife for Oracle. Standards and well designed tools help DBA's mastering Oracle 10g / 11g throughout the whole lifecycle. OTK runs on Linux, zLinux, Solaris, AIX, HP-UX

VMware中linux环境下oracle安装图文教程(一)_oracle

安装流程:前期准备工作--->安装ORACLE软件--->安装升级补丁--->安装odbc创建数据库--->安装监听器--->安装EM <前期准备工作> 安装配置系统环境 安装linux , 所有服务都不选择,只是选择安装开发工具,不要安装防火墙(当然也可以在后面关闭)打开终端,执行如下命令,检查安装包,没有的都要安装 make, glibc, libaiocompat-libstdc++, compat-gcc-34, compat-gcc-34-c++, gc

Linux+php+apache+oracle环境搭建之CentOS下源码编译安装PHP_Linux

首先需要安装下面几个安装包,可以在CD-ROM数据源里找到以下安装包yum安装 yum install perl* freetype libpng* libxm2 libxm2-devel curl curl-devel libjpeg* 手动下载安装 jpegsrc.v8c.tar libmcrypt-2.5.8.tar.gz 安装 jpegsrc # tar -xvzf jpegsrc.v8c.tar # cd jpeg-8c # ./configure --prefix=/usr/loca