重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6147|回复: 0
打印 上一主题 下一主题

非归档模式下增量备份后的恢复

[复制链接]
跳转到指定楼层
楼主
发表于 2012-8-20 21:05:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

非归档模式下增量备份后的恢复

   已经使用增量备份对数据库进行备份后,数据库出现问题,某些文件不存在了,那么这时只能恢复到上次备份的时刻
1.关闭数据库
SQL> connect / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

2.删除数据文件
[oracle@dbserver sztech1]$ ls -ltr /oracle/app/oracle/oradata/sztech1/*.dbf
-rw-r----- 1 oracle dba  52436992 Aug 20 18:34 /oracle/app/oracle/oradata/sztech1/temp02.dbf
-rw-r----- 1 oracle dba  13115392 Aug 20 19:09 /oracle/app/oracle/oradata/sztech1/users01.dbf
-rw-r----- 1 oracle dba 110108672 Aug 20 19:09 /oracle/app/oracle/oradata/sztech1/undotbs01.dbf
-rw-r----- 1 oracle dba 922755072 Aug 20 19:09 /oracle/app/oracle/oradata/sztech1/system01.dbf
-rw-r----- 1 oracle dba 692068352 Aug 20 19:09 /oracle/app/oracle/oradata/sztech1/sysaux01.dbf
-rw-r----- 1 oracle dba  20979712 Aug 20 19:09 /oracle/app/oracle/oradata/sztech1/idx01.dbf
-rw-r----- 1 oracle dba 471867392 Aug 20 19:09 /oracle/app/oracle/oradata/sztech1/example01.dbf

[oracle@dbserver sztech1]$ rm -fr system01.dbf
[oracle@dbserver sztech1]$ rm -fr undotbs01.dbf
[oracle@dbserver sztech1]$ ls -ltr
total 1335532
-rw-r----- 1 oracle dba  52436992 Aug 20 18:34 temp02.dbf
-rw-r----- 1 oracle dba  52429312 Aug 20 19:04 redo03.log
-rw-r----- 1 oracle dba  52429312 Aug 20 19:04 redo02.log
-rw-r----- 1 oracle dba  13115392 Aug 20 19:09 users01.dbf
-rw-r----- 1 oracle dba 692068352 Aug 20 19:09 sysaux01.dbf
-rw-r----- 1 oracle dba  52429312 Aug 20 19:09 redo01.log
-rw-r----- 1 oracle dba  20979712 Aug 20 19:09 idx01.dbf
-rw-r----- 1 oracle dba 471867392 Aug 20 19:09 example01.dbf
-rw-r----- 1 oracle dba   9748480 Aug 20 19:09 control01.ctl
[oracle@dbserver sztech1]$

3.启动到mount

oracle@dbserver sztech1]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 20 19:11:43 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup mount; 
ORACLE instance started.

Total System Global Area  619360256 bytes
Fixed Size                  1346700 bytes
Variable Size             411042676 bytes
Database Buffers          201326592 bytes
Redo Buffers                5644288 bytes
Database mounted.


4.使用rman 登陆到数据库
oracle@dbserver sztech1]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Aug 20 19:13:09 2012

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: SZTECH1 (DBID=3206860853, not open)

RMAN>

5.还原数据库

RMAN> restore database;

Starting restore at 20-AUG-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /oracle/app/oracle/oradata/sztech1/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /oracle/app/oracle/oradata/sztech1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /oracle/app/oracle/oradata/sztech1/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /oracle/app/oracle/oradata/sztech1/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oracle/app/oracle/oradata/sztech1/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oracle/app/oracle/oradata/sztech1/idx01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/app/oracle/fast_recovery_area/SZTECH1/backupset/2012_08_20/o1_mf_nnnd0_TAG20120820T185705_834601rt_.bkp
channel ORA_DISK_1: piece handle=/oracle/app/oracle/fast_recovery_area/SZTECH1/backupset/2012_08_20/o1_mf_nnnd0_TAG20120820T185705_834601rt_.bkp tag=TAG20120820T185705
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
Finished restore at 20-AUG-12

 

6.进行介质恢复

RMAN> recover database;

Starting recover at 20-AUG-12
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /oracle/app/oracle/oradata/sztech1/redo01.log
archived log file name=/oracle/app/oracle/oradata/sztech1/redo01.log thread=1 sequence=1
media recovery complete, elapsed time: 00:00:02
Finished recover at 20-AUG-12


7.打开数据库

RMAN> alter database open resetlogs;

database opened


 

必须使用resetlogs方式打开数据库.

 

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-12-1 11:00 , Processed in 0.129500 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表