C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 6月 14 15:29:05 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
15:29:05 idle>conn /as sysdba
已连接。
15:29:11 sys@LEE>desc test_recover
名称 是否为空? 类型
----------------------------------------------------------------------------------- -------- ------
--------------------------------------------------
ID NUMBER
(38)
15:29:17 sys@LEE>select *from test_recover;
ID
----------
1
2
3
31
32
33
已选择6行。
// 原表~~~~~~~没有用rman 做备份
已用时间: 00: 00: 00.11
15:29:25 sys@LEE>shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
// 删除 表空间sping 的O1_MF_SPRING_44QPLLLK_.DBF 文件
15:31:03 sys@LEE>startup force
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE 例程已经启动。
Total System Global Area 440401920 bytes
Fixed Size 1249440 bytes
Variable Size 113250144 bytes
Database Buffers 318767104 bytes
Redo Buffers 7135232 bytes
数据库装载完毕。
ORA-01157: 无法标识/锁定数据文件 6 - 请参阅 DBWR 跟踪文件
ORA-01110: 数据文件 6: 'E:\TEST_DEST\LEE\DATAFILE\O1_MF_SPRING_44QPLLLK_.DBF'
15:31:43 sys@LEE>exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:\Documents and Settings\Administrator>rman
恢复管理器: Release 10.2.0.1.0 - Production on 星期六 6月 14 15:31:48 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target/
已连接到目标数据库: LEE (DBID=490429669, 未打开)
RMAN> report schema;
使用目标数据库控制文件替代恢复目录
数据库方案报表
永久数据文件列表
===========================
文件大小 (MB) 表空间 回退段数据文件名称
---- -------- -------------------- ------- ------------------------
1 800 SYSTEM *** E:\ORACLE\PRODUCT\10.2.0\ORADATA\LEE\SYSTEM01.DBF
2 35 UNDOTBS1 *** E:\ORACLE\PRODUCT\10.2.0\ORADATA\LEE\UNDOTBS01.DBF
3 600 SYSAUX *** E:\ORACLE\PRODUCT\10.2.0\ORADATA\LEE\SYSAUX01.DBF
4 1500 USERS *** E:\ORACLE\PRODUCT\10.2.0\ORADATA\LEE\USERS01.DBF
5 100 EXAMPLE *** E:\ORACLE\PRODUCT\10.2.0\ORADATA\LEE\EXAMPLE01.DBF
6 0 SPRING *** E:\TEST_DEST\LEE\DATAFILE\O1_MF_SPRING_44QPLLLK_.DBF
7 300 TEST_DATA_16K *** E:\TEST_DEST\LEE\DATAFILE\TEST_DATA_16K.DBF
临时文件列表
=======================
文件大小 (MB) 表空间 最大大小 (MB) 临时文件名称
---- -------- -------------------- ----------- --------------------
1 106 TEMP 32767 E:\ORACLE\PRODUCT\10.2.0\ORADATA\LEE\TEMP01.DBF
RMAN> restore datafile 6 validate;
启动 restore 于 14-6月 -08
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=155 devtype=DISK
通道 ORA_DISK_1: 正在启动数据文件备份集验证
通道 ORA_DISK_1: 正在读取备份段 E:\BACKUP\LEE\LEE_BACK_0HJIMGOD_1_1
通道 ORA_DISK_1: 已恢复备份段 1
段句柄 = E:\BACKUP\LEE\LEE_BACK_0HJIMGOD_1_1 标记 = FULL_LEE
通道 ORA_DISK_1: 验证完成, 用时: 00:00:36
完成 restore 于 14-6月 -08
RMAN> recover datafile 6;
启动 recover 于 14-6月 -08
使用通道 ORA_DISK_1
// 不能recover
RMAN-03002: recover 命令 (在 06/14/2008 15:34:49 上) 失败
RMAN-06094: 数据文件6必须重新存储
RMAN> restore datafile 6;
启动 restore 于 14-6月 -08
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在开始恢复数据文件备份集
通道 ORA_DISK_1: 正在指定从备份集恢复的数据文件
正将数据文件00006恢复到E:\TEST_DEST\LEE\DATAFILE\O1_MF_SPRING_44QPLLLK_.DBF
通道 ORA_DISK_1: 正在读取备份段 E:\BACKUP\LEE\LEE_BACK_0HJIMGOD_1_1
通道 ORA_DISK_1: 已恢复备份段 1
段句柄 = E:\BACKUP\LEE\LEE_BACK_0HJIMGOD_1_1 标记 = FULL_LEE
通道 ORA_DISK_1: 恢复完成, 用时: 00:04:08
完成 restore 于 14-6月 -08
RMAN> recover datafile 6;
启动 recover 于 14-6月 -08
使用通道 ORA_DISK_1
正在开始介质的恢复
存档日志线程 1 序列 54 已作为文件 E:\ARCHIVE\ARCHIVE_1\ARC00054_0655762857.001 存在于磁盘上
存档日志线程 1 序列 55 已作为文件 E:\ARCHIVE\ARCHIVE_1\ARC00055_0655762857.001 存在于磁盘上
存档日志线程 1 序列 56 已作为文件 E:\ARCHIVE\ARCHIVE_1\ARC00056_0655762857.001 存在于磁盘上
存档日志线程 1 序列 57 已作为文件 E:\ARCHIVE\ARCHIVE_1\ARC00057_0655762857.001 存在于磁盘上
存档日志线程 1 序列 58 已作为文件 E:\ARCHIVE\ARC00058_0655762857.001 存在于磁盘上
存档日志线程 1 序列 59 已作为文件 E:\ARCHIVE\ARC00059_0655762857.001 存在于磁盘上
存档日志线程 1 序列 60 已作为文件 E:\ARCHIVE\ARC00060_0655762857.001 存在于磁盘上
存档日志线程 1 序列 1 已作为文件 E:\ARCHIVE\ARC00001_0657239997.001 存在于磁盘上
存档日志线程 1 序列 2 已作为文件 E:\ARCHIVE\ARC00002_0657239997.001 存在于磁盘上
存档日志线程 1 序列 1 已作为文件 E:\ARCHIVE\ARC00001_0657281613.001 存在于磁盘上
存档日志线程 1 序列 1 已作为文件 E:\ARCHIVE\ARC00001_0657282439.001 存在于磁盘上
存档日志线程 1 序列 1 已作为文件 E:\ARCHIVE\ARC00001_0657324733.001 存在于磁盘上
存档日志线程 1 序列 2 已作为文件 E:\ARCHIVE\ARC00002_0657324733.001 存在于磁盘上
存档日志线程 1 序列 3 已作为文件 E:\ARCHIVE\ARC00003_0657324733.001 存在于磁盘上
存档日志文件名 =E:\ARCHIVE\ARCHIVE_1\ARC00054_0655762857.001 线程 =1 序列 =54
存档日志文件名 =E:\ARCHIVE\ARCHIVE_1\ARC00055_0655762857.001 线程 =1 序列 =55
存档日志文件名 =E:\ARCHIVE\ARCHIVE_1\ARC00056_0655762857.001 线程 =1 序列 =56
存档日志文件名 =E:\ARCHIVE\ARCHIVE_1\ARC00057_0655762857.001 线程 =1 序列 =57
存档日志文件名 =E:\ARCHIVE\ARC00058_0655762857.001 线程 =1 序列 =58
存档日志文件名 =E:\ARCHIVE\ARC00059_0655762857.001 线程 =1 序列 =59
存档日志文件名 =E:\ARCHIVE\ARC00060_0655762857.001 线程 =1 序列 =60
存档日志文件名 =E:\ARCHIVE\ARC00001_0657239997.001 线程 =1 序列 =1
存档日志文件名 =E:\ARCHIVE\ARC00002_0657239997.001 线程 =1 序列 =2
存档日志文件名 =E:\ARCHIVE\ARC00001_0657281613.001 线程 =1 序列 =1
存档日志文件名 =E:\ARCHIVE\ARC00001_0657282439.001 线程 =1 序列 =1
// recover 失败~~~~~~~~~~~~~·
RMAN-03002: recover 命令 (在 06/14/2008 15:39:31 上) 失败
ORA-00283: recovery session canceled due to errors
RMAN-11003: 在分析/执行 SQL 语句期间失败: alter database recover logfile 'E:\ARCHIVE\ARC00001_065728
2439.001'
ORA-00283: 恢复会话因错误而取消
ORA-00600: 内部错误代码, 参数: [krhpfh_03-1209], [6], [657324733], [657327569], [41291533], [0], [0]
, [0]
ORA-01110: 数据文件 6: 'E:\TEST_DEST\LEE\DATAFILE\O1_MF_SPRING_456X57DP_.DBF'
// 再来一次!!!
RMAN> recover datafile 6;
启动 recover 于 14-6月 -08
使用通道 ORA_DISK_1
正在开始介质的恢复
介质恢复完成, 用时: 00:00:03
完成 recover 于 14-6月 -08
RMAN> alter database open;
数据库已打开
RMAN> exit
恢复管理器完成。
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 6月 14 15:40:48 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
15:40:48 idle>conn /as sysdba
已连接。
15:40:52 sys@LEE>select * from test_recover;
// 恢复成功
ID
----------
1
2
3
31
32
33
已选择6行。
已用时间: 00: 00: 00.11
15:41:03 sys@LEE>
小结: 可见 rman做恢复recover的时候是利用重做日志或增量备份来重建丢失的数据
文档解析:
Complete Recovery
Complete recovery involves using redo data or incremental backups combined with a backup of a database, tablespace, or datafile to update it to the most current point in time. It is called complete because Oracle applies all of the redo changes contained in the archived and online logs to the backup. Typically, you perform. complete media recovery after a media failure damages datafiles or the control file.
You can perform. complete recovery on a database, tablespace, or datafile. If you are performing complete recovery on the whole database, then you must:
*
Mount the database
*
Ensure that all datafiles you want to recover are online
*
Restore a backup of the whole database or the files you want to recover
*
Apply online or archived redo logs, or a combination of the two
If you are performing complete recovery on a tablespace or datafile, then you must:
*
Take the tablespace or datafile to be recovered offline if the database is open
*
Restore a backup of the datafiles you want to recover
*
Apply online or archived redo logs, or a combination of the two
Incomplete Recovery
Incomplete recovery, or point-in-time recovery, uses a backup to produce a noncurrent version of the database. In other words, you do not apply all of the redo records generated after the most recent backup. You usually perform. incomplete recovery of the whole database in the following situations:
*
Media failure destroys some or all of the online redo logs.
*
A user error causes data loss, for example, a user inadvertently drops a table.
*
You cannot perform. complete recovery because an archived redo log is missing.
*
You lose your current control file and must use a backup control file to open the database.
To perform. incomplete media recovery, you must restore all datafiles from backups created prior to the time to which you want to recover and then open the database with the RESETLOGS option when recovery completes. The RESETLOGS operation creates a new incarnation of the database—in other words, a database with a new stream of log sequence numbers starting with log sequence 1.
Before using the OPEN RESETLOGS command to open the database in read/write mode after an incomplete recovery, it is a good idea to first open the database in read-only mode, and inspect the data to make sure that the database was recovered to the correct point. If the recovery was done to the wrong point, then it is easier to re-run the recovery if no OPEN RESETLOGS has been done. If you open the database read-only and discover that not enough recovery was done, then just run the recovery again to the desired time. If you discover that too much recovery was done, then you must restore the database again and re-run the recovery.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11134734/viewspace-346818/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11134734/viewspace-346818/