您的位置:首页 > 其它

RMAN备份与恢复之不完全恢复

2015-10-15 14:49 288 查看
要点:对于RMAN的不完全恢复,有如下步骤:

1)加载数据到mount状态(建议恢复前先做备份)

2)为高并发分配多个通道

3)还原所有(所需)的数据文件

4)使用until time,until sequence,until scn来恢复数据库

5)使用resetlogs打开数据库

6)全备数据库

RMAN> startup nomount force;

Oracle instance started

Total System Global Area    1937457152 bytes

Fixed Size                     2229584 bytes
Variable Size               1241516720 bytes
Database Buffers             687865856 bytes
Redo Buffers                   5844992 bytes

RMAN> alter database mount;

database mounted

RMAN> run{
2>  allocate channel ch1 type disk;
3>  allocate channel ch2 type disk;
4>  set until time "to_date('2015-10-15 14:12:10','yyyy-mm-dd hh24:mi:ss')";
5>  restore database;
6>  recover database;
7>  alter database open resetlogs;
8>  release channel ch1;
9>  release channel ch2;}

allocated channel: ch1
channel ch1: SID=129 device type=DISK

allocated channel: ch2
channel ch2: SID=193 device type=DISK

executing command: SET until clause

Starting restore at 15-OCT-15

channel ch1: starting datafile backup set restore
channel ch1: specifying datafile(s) to restore from backup set
channel ch1: restoring datafile 00002 to /data2/orcl/sysaux01.dbf
channel ch1: restoring datafile 00004 to /data2/orcl/user01.dbf
channel ch1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_10_15/o1_mf_nnndf_TAG20151015T141014_c1yjt962_.bkp
channel ch2: starting datafile backup set restore
channel ch2: specifying datafile(s) to restore from backup set
channel ch2: restoring datafile 00001 to /data2/orcl/system01.dbf
channel ch2: restoring datafile 00003 to /data2/orcl/undotbs01.dbf
channel ch2: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_10_15/o1_mf_nnndf_TAG20151015T141014_c1yjt92v_.bkp
channel ch1: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_10_15/o1_mf_nnndf_TAG20151015T141014_c1yjt962_.bkp tag=TAG20151015T141014
channel ch1: restored backup piece 1
channel ch1: restore complete, elapsed time: 00:00:45
channel ch2: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_10_15/o1_mf_nnndf_TAG20151015T141014_c1yjt92v_.bkp tag=TAG20151015T141014
channel ch2: restored backup piece 1
channel ch2: restore complete, elapsed time: 00:01:05
Finished restore at 15-OCT-15

Starting recover at 15-OCT-15

starting media recovery
media recovery complete, elapsed time: 00:00:03

Finished recover at 15-OCT-15

database opened

released channel: ch1

released channel: ch2
SQL> conn scott/Sina.2015@study
Connected.
SQL> select * from tb1;

ID NAME
---------- ----------
1 Test


2.4切换数据库状态,重新恢复

另:rman debug trace 诊 rman问题

rman target / debug trace=/tmp/rman_debug
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: