找到需要恢复的备份集,在备份服务器上执行如下命令:
- bplist -C cy06s -S backupserver -t 4 -R -l /
- 恢复spfile
启动RMAN
rman target /
rman>run {
allocate channel c1 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';
restore spfile from 'c-s436-p1';
release channel c1;
}
启动数据库
启动数据库到nomount 状态:
sqlplus /nolog
conn /as sysdba
sql> startup nomount
恢复控制文件
启动RMAN
rman target /
rman>run {
allocate channel c1 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';
restore controlfile from 'contr-s436-p1';
release channel c1;
}
恢复数据文件
rman>run {
allocate channel c1 type 'sbt_tape';
allocate channel c2 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06';
restore database;
release channel c1;
release channel c2;
日志回滚
rman>run
allocate channel c1 type 'sbt_tape';
allocate channel c2 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';
recover database;
release channel c1;
release channel c2;
启动数据库
alter database open resetlogs;
或者
recover database until cancel using backup controlfile;
OPEN数据库,并重置日志文件
- 异机恢复创建权限
首先在备份服务器,建立文件允许异机恢复
/usr/openv/netbackup/db/altnames/No.Restrictions
创建一个新的参数文件和原机器的配置一致,可以通过拷贝完成。
按照参数文件中的内容创建相应的目录和权限。
主要包audit文件目录
启动数据库到nomount 状态:
sqlplus /nolog
conn /as sysdba
sql> startup nomount
查找备份集
找到需要恢复的备份集,在备份服务器上执行如下命令:
bplist -C cy06s -S backupserver -t 4 -R -l /
恢复spfile
启动RMAN
rman target /
rman>run {
allocate channel c1 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';
restore spfile from 'c-s436-p1';
release channel c1;
}
启动RMAN
rman target /
rman>run {
allocate channel c1 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';
restore controlfile from 'contr-s436-p1';
release channel c1;
}
mount数据库
rman>Alter database mount;
根据控制文件,建立相关目录:数据文件目录、日志文件
SQL> select file#,name from v$datafile;
可以创建数据文件的路径,也可以重定向数据文件
无需重定向
rman>run {
allocate channel c1 type 'sbt_tape';
allocate channel c2 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06';
restore database;
resore archivelog all;
release channel c1;
release channel c2;
}
重定向数据文件
rman>run {
allocate channel c1 type 'sbt_tape';
allocate channel c2 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=ycoracle9';
set newname for datafile 1 to '/home7/oracle10/oradata/ora9i/system01.dbf';
set newname for datafile 2 to '/home7/oracle10/oradata/ora9i/undotbs01.dbf';
set newname for datafile 3 to '/home7/oracle10/oradata/ora9i/sysaux01.dbf';
set newname for datafile 4 to '/home7/oracle10/oradata/ora9i/users01.dbf';
set newname for datafile 5 to '/home7/oracle10/oradata/ora9i/tools01.dbf';
set newname for datafile 6 to '/home7/oracle10/oradata/ora9i/cyrc01.dbf';
set newname for datafile 7 to '/home7/oracle10/oradata/ora9i/zyrj01.dbf';
set newname for datafile 8 to '/home7/oracle10/oradata/ora9i/super01.dbf';
set newname for datafile 9 to '/home7/oracle10/oradata/ora9i/super02.dbf';
set newname for datafile 10 to '/home7/oracle10/oradata/ora9i/gengsy01.dbf';
set newname for datafile 11 to '/home7/oracle10/oradata/ora9i/wangyy01.dbf';
set newname for datafile 12 to '/home7/oracle10/oradata/ora9i/tbs_stream01.dbf';
restore database;
switch datafile all;
release channel c1;
release channel c2;
日志回滚
rman>run {
allocate channel c1 type 'sbt_tape';
allocate channel c2 type 'sbt_tape';
send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';
recover database;
release channel c1;
release channel c2;
}
启动数据库
alter database open resetlogs;
或者
recover database until cancel using backup controlfile;
OPEN数据库,并重置日志文件