虚拟机增加硬盘以及更改ORACLE DB_RECOVERY_FILE_DEST参数实验


今天在虚拟机里,发现剩余磁盘空间<10%,总共30G的磁盘,剩下不到2G,如果给Oracle做一个RMAN全备的话就所剩无几了,于是想在虚拟机里增加一块硬盘,然后格式化,挂载到ORACLE的目录下,然后把ORACLE的 FLASH_RECOVERY_AREA 改过来,步骤如下,

增加硬盘的步骤很简单,先关闭虚拟机,点EDIT =>HARD DISK=>ADD=>CREATE NEW VIRTUAL DISK=>SCSI 等按部就班,搞定后启动vm.

1,[root@coop ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3916    31350847+  8e  Linux LVM

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
[root@coop ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help):
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610

Command (m for help):
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): t
Selected partition 1
Hex code (type L to list codes): l

 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       c1  DRDOS/sec (FAT-
 1  FAT12           24  NEC DOS         81  Minix / old Lin c4  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          82  Linux swap      c6  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c7  Syrinx
 4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  da  Non-FS data
 5  Extended        41  PPC PReP Boot   85  Linux extended  db  CP/M / CTOS / .
 6  FAT16           42  SFS             86  NTFS volume set de  Dell Utility
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set df  BootIt
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       e1  DOS access
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e3  DOS R/O
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e4  SpeedStor
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          eb  BeOS fs
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ee  EFI GPT
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ef  EFI (FAT-12/16/
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         f0  Linux/PA-RISC b
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f1  SpeedStor
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f4  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f2  DOS secondary
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     fb  VMware VMFS
16  Hidden FAT16    63  GNU HURD or Sys b7  BSDI fs         fc  VMware VMKCORE
17  Hidden HPFS/NTF 64  Novell Netware  b8  BSDI swap       fd  Linux raid auto
18  AST SmartSleep  65  Novell Netware  bb  Boot Wizard hid fe  LANstep
1b  Hidden W95 FAT3 70  DiskSecure Mult be  Solaris boot    ff  BBT
1c  Hidden W95 FAT3 75  PC/IX           bf  Solaris
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): p

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2610    20964793+   b  W95 FAT32

Command (m for help): p

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2610    20964793+   b  W95 FAT32

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): t
Selected partition 1
Hex code (type L to list codes): l

 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       c1  DRDOS/sec (FAT-
 1  FAT12           24  NEC DOS         81  Minix / old Lin c4  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          82  Linux swap      c6  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c7  Syrinx
 4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  da  Non-FS data
 5  Extended        41  PPC PReP Boot   85  Linux extended  db  CP/M / CTOS / .
 6  FAT16           42  SFS             86  NTFS volume set de  Dell Utility
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set df  BootIt
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       e1  DOS access
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e3  DOS R/O
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e4  SpeedStor
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          eb  BeOS fs
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ee  EFI GPT
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ef  EFI (FAT-12/16/
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         f0  Linux/PA-RISC b
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f1  SpeedStor
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f4  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f2  DOS secondary
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     fb  VMware VMFS
16  Hidden FAT16    63  GNU HURD or Sys b7  BSDI fs         fc  VMware VMKCORE
17  Hidden HPFS/NTF 64  Novell Netware  b8  BSDI swap       fd  Linux raid auto
18  AST SmartSleep  65  Novell Netware  bb  Boot Wizard hid fe  LANstep
1b  Hidden W95 FAT3 70  DiskSecure Mult be  Solaris boot    ff  BBT
1c  Hidden W95 FAT3 75  PC/IX           bf  Solaris
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

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): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
[root@coop ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3916    31350847+  8e  Linux LVM

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2610    20964793+  8e  Linux LVM


[root@coop ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       28G   22G  4.5G  83% /
/dev/sda1              99M   14M   81M  15% /boot
none                  506M     0  506M   0% /dev/shm
[root@coop ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@coop ~]# mount /dev/sdb1 /u01/arch
[root@coop ~]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       28G   22G  4.5G  83% /
/dev/sda1              99M   14M   81M  15% /boot
none                  506M     0  506M   0% /dev/shm
/dev/sdb1              20G   77M   19G   1% /u01/arch

还要更改文件夹权限

[root@coop ~]# chmod 777 /u01/arch
[root@coop ~]# chown -R oracle /u01/arch


2,更改ORACLE 参数

SQL> show parameter db_recover

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /home/oracle/oracle/product/10
                                                 .2.0/db_1/flash_recovery_area
db_recovery_file_dest_size           big integer 2G
SQL> alter system set db_recovery_file_dest='/u01/arch/flash_recovery_area' scope=both;

System altered.

SQL> alter system set db_recovery_file_dest_size=10G;

System altered.

3.大功告成

SQL> show parameter db_recover

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/arch/flash_recovery_area
db_recovery_file_dest_size           big integer 10G

相关内容