6.4 添加新的硬盘,并将其格式化创建文件系统,用于数据库数据文件存放的新路径,详细步骤参考:
Fdisk分区方法:http://www.linuxidc.com/Linux/2012-05/59789.htm
Parte分区方法:http://www.linuxidc.com/Linux/2012-07/64589.htm
卷管理分方法:http://www.linuxidc.com/Linux/2012-05/60321.htm
我刚才创建的分区名称是/DBBak2,见如下:
[Oracle@wwldb /]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.7G 3.0G 4.3G 42% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/mapper/DBSoft-dbsoft
20G 1.7G 18G 9% /DBSoft
/dev/mapper/DBBack-DBBack001
20G 720M 18G 4% /DBBak
/dev/mapper/DBBak2-DBBak2
20G 173M 19G 1% /DBBak2
6.5 创建对应的目录
[oracle@wwldb ~]$ mkdir /DBBak2/oradata/WWL
[oracle@wwldb WWL]$ pwd
/DBBak2/oradata/WWL
[oracle@wwldb WWL]$ ls -a
. ..
6.6 将数据文件恢复到/DBBak2/oradata/WWL目录中
查看备份信息:
RMAN> list backup;
using target database control file instead of recoverycatalog
List of Backup Sets
===================
BS Key Type LVSize Device Type Elapsed TimeCompletion Time
------- ---- -- ---------- ----------- ---------------------------
6 Full 540.81M DISK 00:01:13 06-JUL-12
BP Key:6 Status: AVAILABLE Compressed: NO Tag: TAG20120706T154942
PieceName: /DBBak/bak_WWL_07_06_06nfdv8n_1_1
List ofDatafiles in backup set 6
File LV TypeCkp SCN Ckp Time Name
---- -- -------------- --------- ----
1 Full 1263589 06-JUL-12 /DBData/WWL/system01.dbf
2 Full 1263589 06-JUL-12 /DBData/WWL/undotbs01.dbf
3 Full 1263589 06-JUL-12 /DBData/WWL/sysaux01.dbf
4 Full 1263589 06-JUL-12 /DBData/WWL/users01.dbf
5 Full 1263589 06-JUL-12 /DBData/WWL/wwl001.dbf
6 Full 1263589 06-JUL-12 /DBData/WWL/wwl002.dbf
7 Full 1263589 06-JUL-12 /DBData/WWL/wwl003.dbf
BS Key Type LVSize Device Type Elapsed TimeCompletion Time
------- ---- -- ---------- ----------- ---------------------------
7 Full 7.11M DISK 00:00:01 06-JUL-12
BP Key:7 Status: AVAILABLE Compressed: NO Tag: TAG20120706T155059
PieceName: /DBBak/bakctl_c-5520179-20120706-01
Control FileIncluded: Ckp SCN: 1263606 Ckp time:06-JUL-12
SPFILEIncluded: Modification time: 06-JUL-12
通过备份信息执行如下恢复到新的磁盘上:
RMAN> run {
2> set newname fordatafile '/DBData/WWL/system01.dbf' to '/DBBak2/oradata/WWL/system01.dbf';
3> set newname fordatafile '/DBData/WWL/undotbs01.dbf' to '/DBBak2/oradata/WWL/undotbs01.dbf';
4> set newname fordatafile '/DBData/WWL/sysaux01.dbf' to '/DBBak2/oradata/WWL/sysaux01.dbf';
5> set newname fordatafile '/DBData/WWL/users01.dbf' to '/DBBak2/oradata/WWL/users01.dbf';
6> set newname fordatafile '/DBData/WWL/wwl001.dbf' to '/DBBak2/oradata/WWL/wwl01.dbf';
7> set newname fordatafile '/DBData/WWL/wwl002.dbf' to '/DBBak2/oradata/WWL/wwl02.dbf';
8> set newname fordatafile '/DBData/WWL/wwl003.dbf' to '/DBBak2/oradata/WWL/wwl03.dbf';
9> restore database;
10> switch datafile all;
11> recover database;
12> }
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
Starting restore at 06-JUL-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=46devtype=DISK
channel ORA_DISK_1: startingdatafile backupset restore
channel ORA_DISK_1:specifying datafile(s) to restore from backup set
restoring datafile 00001 to/DBBak2/oradata/WWL/system01.dbf
restoring datafile 00002 to/DBBak2/oradata/WWL/undotbs01.dbf
restoring datafile 00003 to/DBBak2/oradata/WWL/sysaux01.dbf
restoring datafile 00004 to/DBBak2/oradata/WWL/users01.dbf
restoring datafile 00005 to/DBBak2/oradata/WWL/wwl01.dbf
restoring datafile 00006 to/DBBak2/oradata/WWL/wwl02.dbf
restoring datafile 00007 to/DBBak2/oradata/WWL/wwl03.dbf
channel ORA_DISK_1: readingfrom backup piece /DBBak/bak_WWL_07_06_06nfdv8n_1_1
channel ORA_DISK_1: restoredbackup piece 1
piecehandle=/DBBak/bak_WWL_07_06_06nfdv8n_1_1 tag=TAG20120706T154942
channel ORA_DISK_1: restorecomplete, elapsed time: 00:01:46
Finished restore at 06-JUL-12
datafile 1 switched todatafile copy
input datafile copy recid=8stamp=787945637 filename=/DBBak2/oradata/WWL/system01.dbf
datafile 2 switched todatafile copy
input datafile copy recid=9stamp=787945637 filename=/DBBak2/oradata/WWL/undotbs01.dbf
datafile 3 switched todatafile copy
input datafile copy recid=10stamp=787945637 filename=/DBBak2/oradata/WWL/sysaux01.dbf
datafile 4 switched todatafile copy
input datafile copy recid=11stamp=787945637 filename=/DBBak2/oradata/WWL/users01.dbf
datafile 5 switched todatafile copy
input datafile copy recid=12stamp=787945637 filename=/DBBak2/oradata/WWL/wwl01.dbf
datafile 6 switched todatafile copy
input datafile copy recid=13stamp=787945637 filename=/DBBak2/oradata/WWL/wwl02.dbf
datafile 7 switched todatafile copy
input datafile copy recid=14stamp=787945637 filename=/DBBak2/oradata/WWL/wwl03.dbf
Finsh
恢复脚本如下:
run {
set newname for datafile'/DBData/WWL/system01.dbf' to '/DBBak2/oradata/WWL/system01.dbf';
set newname for datafile '/DBData/WWL/undotbs01.dbf'to '/DBBak2/oradata/WWL/undotbs01.dbf';
set newname for datafile'/DBData/WWL/sysaux01.dbf' to '/DBBak2/oradata/WWL/sysaux01.dbf';
set newname for datafile'/DBData/WWL/users01.dbf' to '/DBBak2/oradata/WWL/users01.dbf';
setnewname for datafile '/DBData/WWL/wwl001.dbf' to'/DBBak2/oradata/WWL/wwl01.dbf';
set newname for datafile'/DBData/WWL/wwl002.dbf' to '/DBBak2/oradata/WWL/wwl02.dbf';
set newname for datafile'/DBData/WWL/wwl003.dbf' to '/DBBak2/oradata/WWL/wwl03.dbf';
restore database;
switch datafile all;
}
