OS: both rhel u4
ORACLE: both 10.2.0.4
步骤:
1.full backup 61.106的数据
RMAN> backup database;
Starting backup at 04-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=235 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00008 name=/u01/oradata/orcl/office01.dbf
input datafile fno=00011 name=/u01/oradata/orcl/cmrspace01.dbf
input datafile fno=00013 name=/u01/oradata/orcl/pbrspace01.dbf
input datafile fno=00014 name=/u01/oradata/orcl/q01_arbspace01.dbf
input datafile fno=00017 name=/u01/oradata/orcl/c202_vipspace01.dbf
input datafile fno=00018 name=/u01/oradata/orcl/c202_vipspace02.dbf
input datafile fno=00019 name=/u01/oradata/orcl/c202_vipspace03.dbf
input datafile fno=00020 name=/u01/oradata/orcl/c202_vipspace04.dbf
input datafile fno=00021 name=/u01/oradata/orcl/c202_vipspace05.dbf
input datafile fno=00022 name=/u01/oradata/orcl/c202_vipspace06.dbf
input datafile fno=00023 name=/u01/oradata/orcl/c202_vipspace07.dbf
input datafile fno=00024 name=/u01/oradata/orcl/c202_vipspace08.dbf
input datafile fno=00012 name=/u01/oradata/orcl/MPSPACE_001.dbf
input datafile fno=00002 name=/u01/oradata/orcl/undotbs01.dbf
input datafile fno=00005 name=/u01/oradata/orcl/qhtdata01.dbf
input datafile fno=00006 name=/u01/oradata/orcl/l5mspace01.dbf
input datafile fno=00015 name=/u01/oradata/orcl/q01_l5mspace01.dbf
input datafile fno=00009 name=/u01/oradata/orcl/mtrxspace01.dbf
input datafile fno=00010 name=/u01/oradata/orcl/magspace01.dbf
input datafile fno=00003 name=/u01/oradata/orcl/sysaux01.dbf
input datafile fno=00001 name=/u01/oradata/orcl/system01.dbf
input datafile fno=00007 name=/u01/oradata/orcl/clt_stats01.dbf
input datafile fno=00016 name=/u01/oradata/orcl/q01_brdspace01.dbf
input datafile fno=00004 name=/u01/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 04-JUL-08
channel ORA_DISK_1: finished piece 1 at 04-JUL-08
piece handle=/u01/backup/rman_106/ORCL_1_1.bak tag=TAG20080704T091759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:07:56
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 04-JUL-08
channel ORA_DISK_1: finished piece 1 at 04-JUL-08
piece handle=/u01/backup/rman_106/ORCL_2_1.bak tag=TAG20080704T091759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 04-JUL-08
2.将两个backupset拷贝到61.99:/u01/backup/rman_106
3.建立或恢复pfile.
直接将61.106的pfile拷贝过来或者从backupset恢复,恢复时需先指定dbid,用无参数文件的方式
启动到nomount状态.后recover spfile to pfile 'XXX' from '[backupset] XXX'.恢复过来后用恢
复的pfile重新启动的mount状态.
4.恢复控制文件
RMAN> restore controlfile from '/u01/backup/ORCL_2_1.bak';
Starting restore at 04-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output filename=/u01/oradata/orcl/control01.ctl
output filename=/u01/oradata/orcl/control02.ctl
output filename=/u01/oradata/orcl/control03.ctl
Finished restore at 04-JUL-08
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
5.恢复数据文件
这里出现了点问题,刚开始恢复时,错误如下:
RMAN> restore database;
Starting restore at 04-JUL-08
Starting implicit crosscheck backup at 04-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=321 devtype=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 04-JUL-08
Starting implicit crosscheck copy at 04-JUL-08
using channel ORA_DISK_1
Finished implicit crosscheck copy at 04-JUL-08
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/04/2008 10:31:56
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 24 found to restore
RMAN-06023: no backup or copy of datafile 23 found to restore
RMAN-06023: no backup or copy of datafile 22 found to restore
RMAN-06023: no backup or copy of datafile 21 found to restore
RMAN-06023: no backup or copy of datafile 20 found to restore
RMAN-06023: no backup or copy of datafile 19 found to restore
RMAN-06023: no backup or copy of datafile 18 found to restore
RMAN-06023: no backup or copy of datafile 17 found to restore
RMAN-06023: no backup or copy of datafile 16 found to restore
RMAN-06023: no backup or copy of datafile 15 found to restore
RMAN-06023: no backup or copy of datafile 14 found to restore
RMAN-06023: no backup or copy of datafile 13 found to restore
RMAN-06023: no backup or copy of datafile 12 found to restore
RMAN-06023: no backup or copy of datafile 11 found to restore
RMAN-06023: no backup or copy of datafile 10 found to restore
RMAN-06023: no backup or copy of datafile 9 found to restore
RMAN-06023: no backup or copy of datafile 8 found to restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
分析原因,应该是找不到备份集来做恢复,用list backup看看恢复集的情况,发现status是expired的.
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 9.16G DISK 00:07:53 04-JUL-08
BP Key: 1 Status: EXPIRED Compressed: NO Tag: TAG20080704T091759
Piece Name: /u01/backup/rman_106/ORCL_1_1.bak
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 65089949 04-JUL-08 /u01/oradata/orcl/system01.dbf
2 Full 65089949 04-JUL-08 /u01/oradata/orcl/undotbs01.dbf
3 Full 65089949 04-JUL-08 /u01/oradata/orcl/sysaux01.dbf
4 Full 65089949 04-JUL-08 /u01/oradata/orcl/users01.dbf
5 Full 65089949 04-JUL-08 /u01/oradata/orcl/qhtdata01.dbf
6 Full 65089949 04-JUL-08 /u01/oradata/orcl/l5mspace01.dbf
7 Full 65089949 04-JUL-08 /u01/oradata/orcl/clt_stats01.dbf
8 Full 65089949 04-JUL-08 /u01/oradata/orcl/office01.dbf
9 Full 65089949 04-JUL-08 /u01/oradata/orcl/mtrxspace01.dbf
10 Full 65089949 04-JUL-08 /u01/oradata/orcl/magspace01.dbf
11 Full 65089949 04-JUL-08 /u01/oradata/orcl/cmrspace01.dbf
12 Full 65089949 04-JUL-08 /u01/oradata/orcl/MPSPACE_001.dbf
13 Full 65089949 04-JUL-08 /u01/oradata/orcl/pbrspace01.dbf
14 Full 65089949 04-JUL-08 /u01/oradata/orcl/q01_arbspace01.dbf
15 Full 65089949 04-JUL-08 /u01/oradata/orcl/q01_l5mspace01.dbf
16 Full 65089949 04-JUL-08 /u01/oradata/orcl/q01_brdspace01.dbf
17 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace01.dbf
18 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace02.dbf
19 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace03.dbf
20 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace04.dbf
21 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace05.dbf
22 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace06.dbf
23 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace07.dbf
24 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace08.dbf
用crosscheck backup后状态改为AVAILABLE了.
RMAN> crosscheck backup;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/rman_106/ORCL_1_1.bak recid=1 stamp=659179079
Crosschecked 1 objects
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 9.16G DISK 00:07:53 04-JUL-08
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20080704T091759
Piece Name: /u01/backup/rman_106/ORCL_1_1.bak
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 65089949 04-JUL-08 /u01/oradata/orcl/system01.dbf
2 Full 65089949 04-JUL-08 /u01/oradata/orcl/undotbs01.dbf
3 Full 65089949 04-JUL-08 /u01/oradata/orcl/sysaux01.dbf
4 Full 65089949 04-JUL-08 /u01/oradata/orcl/users01.dbf
5 Full 65089949 04-JUL-08 /u01/oradata/orcl/qhtdata01.dbf
6 Full 65089949 04-JUL-08 /u01/oradata/orcl/l5mspace01.dbf
7 Full 65089949 04-JUL-08 /u01/oradata/orcl/clt_stats01.dbf
8 Full 65089949 04-JUL-08 /u01/oradata/orcl/office01.dbf
9 Full 65089949 04-JUL-08 /u01/oradata/orcl/mtrxspace01.dbf
10 Full 65089949 04-JUL-08 /u01/oradata/orcl/magspace01.dbf
11 Full 65089949 04-JUL-08 /u01/oradata/orcl/cmrspace01.dbf
12 Full 65089949 04-JUL-08 /u01/oradata/orcl/MPSPACE_001.dbf
13 Full 65089949 04-JUL-08 /u01/oradata/orcl/pbrspace01.dbf
14 Full 65089949 04-JUL-08 /u01/oradata/orcl/q01_arbspace01.dbf
15 Full 65089949 04-JUL-08 /u01/oradata/orcl/q01_l5mspace01.dbf
16 Full 65089949 04-JUL-08 /u01/oradata/orcl/q01_brdspace01.dbf
17 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace01.dbf
18 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace02.dbf
19 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace03.dbf
20 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace04.dbf
21 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace05.dbf
22 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace06.dbf
23 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace07.dbf
24 Full 65089949 04-JUL-08 /u01/oradata/orcl/c202_vipspace08.dbf
现在再来restore.
RMAN> restore database;
Starting restore at 04-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oradata/orcl/system01.dbf
restoring datafile 00002 to /u01/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /u01/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /u01/oradata/orcl/users01.dbf
restoring datafile 00005 to /u01/oradata/orcl/qhtdata01.dbf
restoring datafile 00006 to /u01/oradata/orcl/l5mspace01.dbf
restoring datafile 00007 to /u01/oradata/orcl/clt_stats01.dbf
restoring datafile 00008 to /u01/oradata/orcl/office01.dbf
restoring datafile 00009 to /u01/oradata/orcl/mtrxspace01.dbf
restoring datafile 00010 to /u01/oradata/orcl/magspace01.dbf
restoring datafile 00011 to /u01/oradata/orcl/cmrspace01.dbf
restoring datafile 00012 to /u01/oradata/orcl/MPSPACE_001.dbf
restoring datafile 00013 to /u01/oradata/orcl/pbrspace01.dbf
restoring datafile 00014 to /u01/oradata/orcl/q01_arbspace01.dbf
restoring datafile 00015 to /u01/oradata/orcl/q01_l5mspace01.dbf
restoring datafile 00016 to /u01/oradata/orcl/q01_brdspace01.dbf
restoring datafile 00017 to /u01/oradata/orcl/c202_vipspace01.dbf
restoring datafile 00018 to /u01/oradata/orcl/c202_vipspace02.dbf
restoring datafile 00019 to /u01/oradata/orcl/c202_vipspace03.dbf
restoring datafile 00020 to /u01/oradata/orcl/c202_vipspace04.dbf
restoring datafile 00021 to /u01/oradata/orcl/c202_vipspace05.dbf
restoring datafile 00022 to /u01/oradata/orcl/c202_vipspace06.dbf
restoring datafile 00023 to /u01/oradata/orcl/c202_vipspace07.dbf
restoring datafile 00024 to /u01/oradata/orcl/c202_vipspace08.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/rman_106/ORCL_1_1.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/rman_106/ORCL_1_1.bak tag=TAG20080704T091759
channel ORA_DISK_1: restore complete, elapsed time: 00:40:53
Finished restore at 04-JUL-08
5.recover database
RMAN> recover database;
Starting recover at 04-JUL-08
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=12
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/04/2008 11:30:16
RMAN-06054: media recovery requesting unknown log: thread 1 seq 12 lowscn 65089949
报错了,但是没关系,并非严重错误,只是提醒你恢复到一个未知的scn号。如果要避免这个错误,
可以在alter database mount之后,通过set until scn或者set until time命令设置恢复到的scn号
或时间。
6.打开数据库
RMAN>alter database open resetlogs;
验证一下:
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- -----------
-- ---------
1 1 1 536870912 1 NO CURRENT
65089950 04-JUL-08
2 1 0 536870912 1 YES UNUSED
0
3 1 0 536870912 1 YES UNUSED
0
4 1 0 536870912 1 YES UNUSED
0
5 1 0 536870912 1 YES UNUSED
0
6 1 0 536870912 1 YES UNUSED
0
6 rows selected.
redo log已重建.
7.最后记得用orapwd重建密码文件,成了.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/87010/viewspace-401642/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/87010/viewspace-401642/