Home > Database > Mysql Tutorial > 如何使用RMAN异机恢复部分表空间

如何使用RMAN异机恢复部分表空间

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:12:27
Original
1396 people have browsed it

在oracle 数据库的日常维护和使用期间难免会遇到误删数据(drop,delete, truncate)当我们使用常规手段(flashback query ,flashback drop)也无法恢复数据时,我们可以使用最近的逻辑备份,在异机使用dmp 来恢复相应的表,但是如果没有这些逻辑备份,但

在oracle 数据库的日常维护和使用期间难免会遇到误删数据(drop,delete, truncate)当我们使用常规手段(flashback query ,flashback drop)也无法恢复数据时,我们可以使用最近的逻辑备份,在异机使用dmp 来恢复相应的表,但是如果没有这些逻辑备份,但是有一个最近的rman 全备,那么我们就可以利用这个备份来恢复被误删的表空间,从而实现数据的恢复,这里我以NBU 的备份环境为例简单描述下如何来回复部分 表空间;

-------在nomount 状态 ,恢复控制文件
 

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 ;
}
Copy after login

-------在还原好控制文件后,将实例启动到mount状态,然后开始还原部分表空间数据文件:

rman target / nocatalog msglog=/home/oracledb/rman.log <<EOF
run {
allocate channel t1 type &#39;sbt_tape&#39;;
allocate channel t2 type &#39;sbt_tape&#39;;
send &#39;NB_ORA_SERV=netbackup,NB_ORA_CLIENT=http://blog.csdn.net/lixora&#39;;
Copy after login
set newname for datafile 1 to &#39;/oracle11/oradata/datafile/system.262.762381347&#39; ;
set newname for datafile 3 to &#39;/oracle11/oradata/datafile/undotbs1.264.762381401&#39;;
set newname for datafile 4 to &#39;/oracle11/oradata/datafile/undotbs2.266.762381455&#39;;
set newname for datafile 227 to &#39;/oracle11/oradata/datafile/system02.dbf&#39;;
set newname for datafile 344 to &#39;/oracle11/oradata/datafile/lixora.375.820259689&#39;;
set newname for datafile 345 to &#39;/oracle11/oradata/datafile/lixora.414.820949317&#39;;
Copy after login

restore tablespace system,undotbs1,undotbs2,lixora ;
switch datafile all;

release channel t1;
release channel t2;
}
EOF
Copy after login

---------【如果表空比较多,可以先批量生成表空间的 offline drop 命令】开始恢复数据库

rman target / msglog=recover.log << EOF
RUN{
ALLOCATE CHANNEL ch0 TYPE &#39;SBT_TAPE&#39; ;
ALLOCATE CHANNEL ch1 TYPE &#39;SBT_TAPE&#39; ;
send &#39;NB_ORA_SERV=netbackup,NB_ORA_CLIENT=http://blog.csdn.net/lixora&#39;;
set until time "to_date(&#39;2014/11/11 14:00:00&#39;,&#39;yyyy/mm/dd hh24:mi:ss&#39;)";


recover database skip forever tablespace SYSAUX,TEMP,USERS,INDEX_DATA;


release channel ch0;
release channel ch1;
}
EOF
Copy after login



---以resetlogs 方式打开oracle数据库
alter database open resetlogs;

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template