How to Use RMAN to restore some tablespaces and rman spaces on different machines
During the routine maintenance and use of the oracle database, data may be accidentally deleted (drop, delete, truncate). When we use conventional means (flashback query, flashback drop, we can use the latest logical backup and dmp on different machines to restore the corresponding tables. However, if these logical backups are not available, there is a recent rman full backup, then we can use this backup to restore the accidentally deleted tablespace to restore the data. Here I will take the NBU backup environment as an example to briefly describe how to restore some tablespaces;
------- Restore the control file in nomount status
Run {
Allocate channel t1 type 'sbt _ tape ';
Send 'nb _ ORA_SERV = netbackup, NB_ORA_CLIENT = http://blog.csdn.net/lixora ';
Restore controlfile to '/oracle11/oradata1/control011.ctl' from '/c-2151157071-20141111-00 ';
Release channel t1;
}
------- After restoring the control file, start the instance to the mount state and restore some tablespace data files:
Rman target/nocatalog msglog =/home/oracledb/rman. log <EOF
Run {
Allocate channel t1 type 'sbt _ tape ';
Allocate channel t2 type 'sbt _ tape ';
Send 'nb _ ORA_SERV = netbackup, NB_ORA_CLIENT = http://blog.csdn.net/lixora ';
Set newname for datafile 1 to '/oracle11/oradata/datafile/system.262.762381347 ';
Set newname for datafile 3 to '/oracle11/oradata/datafile/undotbs1.264.762381401 ';
Set newname for datafile 4 to '/oracle11/oradata/datafile/undotbs2.266.762381455 ';
Set newname for datafile 227 to '/oracle11/oradata/datafile/system02.dbf ';
Set newname for datafile 344 to '/oracle11/oradata/datafile/lixora.375.820259689 ';
Set newname for datafile 345 to '/oracle11/oradata/datafile/lixora.414.820949317 ';
Restore tablespace system, undotbs1, undotbs2, lixora;
Switch datafile all;
Release channel t1;
Release channel t2;
}
EOF
--------- [If the table is empty, you can generate the offline drop command for tablespace in batches] to restore the database.
Rman target/msglog = recover. log <EOF
RUN {
Allocate channel ch0 TYPE 'sbt _ TAPE ';
Allocate channel sequence TYPE 'sbt _ TAPE ';
Send 'nb _ ORA_SERV = netbackup, NB_ORA_CLIENT = http://blog.csdn.net/lixora ';
Set until time "to_date ('2017/11 14:00:00 ', 'yyyy/mm/dd hh24: mi: ss ')";
Recover database skip forever tablespace SYSAUX, TEMP, USERS, INDEX_DATA;
Release channel ch0;
Release channel identifier;
}
EOF
--- Open the oracle database in resetlogs Mode
Alter database open resetlogs;