rman备份前, 先归档。 alter system switch logfile;或者直接在rman中加入 ALTER SYSTEM ARCHIVE LOG CURRENT ; CURRENT Clause SpecifyCURRENTto manually archive the current redo log file group of the specified thread, forcing a log switch. If you omit theTHREADparameter, then Oracle archives all redo log file groups from all enabled threads, including logs previous to current logs. You can specifyCURRENTonly when the database is open. 否则 restore之后 recover, 备份之前 联机日志里未归档的内容无法恢复。
按照1楼的方法先归档 在做备份 再删除一些表后 发现还是没有恢复相关删除的表 不知道为什么 操作如下: 1 设置归档 SQL> alter system switch logfile; System altered. 2 全库备份 [oracle@oracle10test u01]$ rman target sys/123456 Recovery Manager: Release 10.2.0.1.0 - Production on Thu Mar 26 15:09:24 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: ARJTEST (DBID=422933310) RMAN> connect catalog rman/rman connected to recovery catalog database RMAN> backup format '/u01/10g/full_%T' database; 3 随便删除一些测试数据 4 恢复文件 RMAN> shutdown immediate; database closed database dismounted Oracle instance shut down quit [oracle@oracle10test u01]$ rman target sys/123456 Recovery Manager: Release 10.2.0.1.0 - Production on Thu Mar 26 15:20:39 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database (not started) RMAN> startup mount; Oracle instance started RMAN> restore database;Starting restore at 26-MAR-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=157 devtype=DISKchannel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/10g/oradata/arjtest/system01.dbf restoring datafile 00002 to /u01/10g/oradata/arjtest/undotbs01.dbf restoring datafile 00003 to /u01/10g/oradata/arjtest/sysaux01.dbf restoring datafile 00004 to /u01/10g/oradata/arjtest/users01.dbf restoring datafile 00005 to /u01/10g/oradata/arjtest/arjserver_tabledb.dbf restoring datafile 00006 to /u01/10g/oradata/arjtest/arjserver_object.dbf restoring datafile 00007 to /u01/10g/oradata/arjtest/rman_test.dbf channel ORA_DISK_1: reading from backup piece /u01/10g/full_20090326 channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/10g/full_20090326 tag=TAG20090326T151025 channel ORA_DISK_1: restore complete, elapsed time: 00:02:19 Finished restore at 26-MAR-09RMAN> recover database;Starting recover at 26-MAR-09 using channel ORA_DISK_1starting media recovery media recovery complete, elapsed time: 00:00:03Finished recover at 26-MAR-09 RMAN> alter database open; 打开查看数据发现删除数据还是没恢复 求解
backup device type disk filesperset = 10 tag '%TAG' database include current controlfile; backup device type disk filesperset = 10 tag '%TAG' archivelog all not backed up delete all input; allocate channel for maintenance type disk; delete noprompt obsolete device type disk; release channel;
先归档。
alter system switch logfile;或者直接在rman中加入
ALTER SYSTEM ARCHIVE LOG CURRENT ;
CURRENT Clause
SpecifyCURRENTto manually archive the current redo log file group of the specified thread, forcing a log switch. If you omit theTHREADparameter, then Oracle archives all redo log file groups from all enabled threads, including logs previous to current logs. You can specifyCURRENTonly when the database is open.
否则
restore之后 recover,
备份之前 联机日志里未归档的内容无法恢复。
操作如下:
1 设置归档
SQL> alter system switch logfile;
System altered.
2 全库备份
[oracle@oracle10test u01]$ rman target sys/123456
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Mar 26 15:09:24 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ARJTEST (DBID=422933310)
RMAN> connect catalog rman/rman
connected to recovery catalog database
RMAN> backup format '/u01/10g/full_%T' database;
3 随便删除一些测试数据
4 恢复文件
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
quit
[oracle@oracle10test u01]$ rman target sys/123456
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Mar 26 15:20:39 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
RMAN> restore database;Starting restore at 26-MAR-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISKchannel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/10g/oradata/arjtest/system01.dbf
restoring datafile 00002 to /u01/10g/oradata/arjtest/undotbs01.dbf
restoring datafile 00003 to /u01/10g/oradata/arjtest/sysaux01.dbf
restoring datafile 00004 to /u01/10g/oradata/arjtest/users01.dbf
restoring datafile 00005 to /u01/10g/oradata/arjtest/arjserver_tabledb.dbf
restoring datafile 00006 to /u01/10g/oradata/arjtest/arjserver_object.dbf
restoring datafile 00007 to /u01/10g/oradata/arjtest/rman_test.dbf
channel ORA_DISK_1: reading from backup piece /u01/10g/full_20090326
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/10g/full_20090326 tag=TAG20090326T151025
channel ORA_DISK_1: restore complete, elapsed time: 00:02:19
Finished restore at 26-MAR-09RMAN> recover database;Starting recover at 26-MAR-09
using channel ORA_DISK_1starting media recovery
media recovery complete, elapsed time: 00:00:03Finished recover at 26-MAR-09
RMAN> alter database open; 打开查看数据发现删除数据还是没恢复 求解
在进行恢复的时候,你是不是一直用的是最新的归档,
(就是说你的归档日志没有用你恢复的而是最新的,)
那么恢复总是恢复到最近的状态,
而最近的状态是你删除数据后的状态了!
mount状态
recover 的时候是需要做这个操作的,
drop 掉联机日志文件(新的 redo)
那楼上的意思是不是把重做日志文件DROP掉?
删除两个东西,
归档,redo,
再restore ,recover
backup device type disk filesperset = 10 tag '%TAG' archivelog all not backed up delete all input;
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
release channel;