Oracle数据库RMAN还原和恢复
disaster classification
physical failure
datafile,controfile,redo log
logical mistake
object
physical disaster situation
mount or open
non-system tablespace
undo tbs
nomount
controlfile,all database file
mount
system tablespace
online redo log file
non-system tbs
alter datafile offline
alter tablespace offline
restore&recover
revert datafile online
crosscheck backupset;
list backupset summary;
validate backupset 860,953,1080,1081,1110;
validate backupset 860,953,1080,1081,1110 check logical;
non-system tbs 非系统表空间和数据文件恢复
rm -f users.dbf
alter database datafile 5 online;
run {
allocate channel d1 device type disk;
sql "alter database datafile 4 offline";
restore datafile 4;
recover datafile 4;
sql "alter database datafile 4 online;
}
undo表空间恢复与还原 必要让数据库知道undo不能用了
alter datafile 2 online
alter datafile 2 offline
rman中undo表空间不能offline
run {
allocate channel d1 device type disk;
restore datafile 2;
recover datafile 2;
}
在sqlplus中
select status from v$datafile
recover datafile 2;
alter database datafile 2 online;
system tbs 系统表空间恢复
startup mount
restore datafile 1;
recover datafile 1;
alter database open;
rm -f system01.dbf
startup mount force;
run {
allocate channel d1 device type disk;
restore datafile 1;
recover datafile 1;
sql "alter database open";
}
select open_mode from v$database;
controlfile 控制文件恢复
startup target with nomount
connect to catalog and target
restore controlfile,recover database
alter database open resetlogs or noresetlogs
rm -f control*
startup nomount force;
重新连接的时候有时候不能指目标数据库
还原控制文件只能resetlogs;
rman catalog rmanuser/qkhhfqp@pretty target sys/qkhhfqp
run {
allocate channel d1 devie type disk;
restore controlfile;
sql "alter database mount";
restore database;
recover database ;
sql "alter database open resetlogs";
}
run {
allocate channel d1 devie type disk;
restore database;
sql "alter database mount";
recover database ;
sql "alter database open resetlogs";
}
online redo logfile 在线日志恢复
startup mount force
connect to target and catalog
list backupset of archivelog all
restore database
recover database until sequence
10g之前resetlog之前备份将无效
rm -f redo*
startup mount force
run {
allocate channel d1 device type disk;
restore database;
recover database;
}
alter database open resetlogs;
recover database until logseq=32
alter database open resetlogs;
all database 全部文件文件掉失恢复
nomount
restore database
mount
recover database
recover database until logseq=32(logseq的值)
alter database open resetlogs;
注意删除过期的备份
rm -f *
startup nomount force;
run {
allocate channel d1 device type disk;
restore database;
sql "alter database mount";
recover database;
}
change backupset 121,122 delete;
change archivelog all delete;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11364208/viewspace-310414/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11364208/viewspace-310414/