Oracle RMAN 备份及不完全恢复(删除archievelog)
RMAN备份命令
|
backup Database format='/home/oracle/backup/bak_full_%U_%T' tag='bak_full'; |
备份完后插入测试数据
insert into zz values(2); commit;
insert into qq values(2); commit;
然后通过alter system switch logfile多切几次归档,切出多个归档文件
o1_mf_1_12_cpb2xhg8_.arc o1_mf_1_14_cpb36dbo_.arc
o1_mf_1_13_cpb35zgs_.arc o1_mf_1_15_cpb37ff2_.arc
删除12和14文件
[oracle@ocp 2016_06_18]$ rm o1_mf_1_12_cpb2xhg8_.arc
[oracle@ocp 2016_06_18]$ rm o1_mf_1_14_cpb36dbo_.arc
通过在RMAN中运行处理使得报错
run {
sql'alter database datafile 6 offline';
restore datafile 6;
recover datafile 6;
sql'alter database datafile 6 online';
}
错误为
|
RMAN> recover datafile 6; Starting recover at 18-JUN-16 starting media recovery archived log for thread 1 with sequence 13 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_13_cpb35zgs_.arc |
查看archieve目录,发现确实只有
o1_mf_1_13_cpb35zgs_.arc o1_mf_1_15_cpb37ff2_.arc
查看v$log,得到最后需要应用的日志文件应该是16
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- ----------------
1 16 CURRENT
2 14 INACTIVE
3 15 INACTIVE
被还原的6号文件的scn为
SQL> select file#,change# from v$recover_file;
FILE# CHANGE#
---------- ----------
6 1080514
查看v$log_history得知需要从10号文件开始恢复
SQL> select sequence# from v$log_history where 1080514 between first_change# and next_change#-1;
SEQUENCE#
----------
10
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
3 61.04M DISK 00:00:03 16-JUN-16
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20160616T165323
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_annnn_TAG20160616T165323_cp4t83nk_.bkp
List of Archived Logs in backup set 3
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 6 1022418 08-JUN-16 1033516 16-JUN-16
1 7 1033516 16-JUN-16 1047305 16-JUN-16
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
4 61.05M DISK 00:00:02 16-JUN-16
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20160616T165445
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_annnn_TAG20160616T165445_cp4tbogp_.bkp
List of Archived Logs in backup set 4
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 6 1022418 08-JUN-16 1033516 16-JUN-16
1 7 1033516 16-JUN-16 1047305 16-JUN-16
1 8 1047305 16-JUN-16 1047358 16-JUN-16
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7 61.02M DISK 00:00:03 18-JUN-16
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: ARC_BACK
Piece Name: /home/oracle/backup/arch_07r8fcti_1_1_20160618
List of Archived Logs in backup set 7
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 9 1047358 16-JUN-16 1071119 16-JUN-16
1 10 1071119 16-JUN-16 1080684 18-JUN-16
1 11 1080684 18-JUN-16 1080714 18-JUN-16
备份级里面有6,7,8,9,10,11,6号文件test01.dbf需要的是从10号archivelog开始,但需要恢复到16号文件,目前缺少12,14文件.
查找一下12-14文件的位置,进行确认.
RMAN> list archivelog low sequence 12 high sequence 14
2> ;
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
7 1 12 A 18-JUN-16
Name: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_12_cpb2xhg8_.arc
8 1 13 A 18-JUN-16
Name: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_13_cpb35zgs_.arc
9 1 14 A 18-JUN-16
Name: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_14_cpb36dbo_.arc
只能不完全恢复到12
shutdown abort;
starup force mount;
|
RMAN> run { executing command: SET until clause Starting restore at 18-JUN-16 channel ORA_DISK_1: starting datafile backup set restore RMAN> run { executing command: SET until clause Starting recover at 18-JUN-16 starting media recovery channel ORA_DISK_1: starting archived log restore to default destination RMAN> alter database open resetlogs; database opened |
用scott/tiger登录后查看,发现插入的数据不在了.
打开后,需要重新备份数据库,备份前需要删除原有多余的backup set及archivelog
RMAN> configure retention policy to redundancy 1;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
new RMAN configuration parameters are successfully stored
RMAN> crosscheck backup;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_nnndf_TAG20160616T164736_cp4sx8fp_.bkp RECID=1 STAMP=914690856
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_ncsnf_TAG20160616T164736_cp4sznlh_.bkp RECID=2 STAMP=914690932
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_annnn_TAG20160616T165323_cp4t83nk_.bkp RECID=3 STAMP=914691203
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_annnn_TAG20160616T165445_cp4tbogp_.bkp RECID=4 STAMP=914691285
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/back_full_05r8fcon_1_1_20160618 RECID=5 STAMP=914862871
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/back_full_06r8fcr2_1_1_20160618 RECID=6 STAMP=914862947
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/arch_07r8fcti_1_1_20160618 RECID=7 STAMP=914863026
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/back_ctl_08r8fd2c_1_1_20160618 RECID=8 STAMP=914863181
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/back_spfile_09r8fd3n_1_1_20160618 RECID=9 STAMP=914863223
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/bak_ctl_0ar8i7jh_1_1_20160619 RECID=10 STAMP=914955890
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/bak_full_0br8i7kj_1_1_20160619 RECID=11 STAMP=914955923
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/backup/bak_full_0cr8i7mk_1_1_20160619 RECID=12 STAMP=914955989
Crosschecked 12 objects
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 1 16-JUN-16
Backup Piece 1 16-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_nnndf_TAG20160616T164736_cp4sx8fp_.bkp
Backup Set 2 16-JUN-16
Backup Piece 2 16-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_ncsnf_TAG20160616T164736_cp4sznlh_.bkp
Backup Set 3 16-JUN-16
Backup Piece 3 16-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_annnn_TAG20160616T165323_cp4t83nk_.bkp
Backup Set 4 16-JUN-16
Backup Piece 4 16-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/backupset/2016_06_16/o1_mf_annnn_TAG20160616T165445_cp4tbogp_.bkp
Backup Set 5 18-JUN-16
Backup Piece 5 18-JUN-16 /home/oracle/backup/back_full_05r8fcon_1_1_20160618
Backup Set 6 18-JUN-16
Backup Piece 6 18-JUN-16 /home/oracle/backup/back_full_06r8fcr2_1_1_20160618
Backup Set 7 18-JUN-16
Backup Piece 7 18-JUN-16 /home/oracle/backup/arch_07r8fcti_1_1_20160618
Backup Set 8 18-JUN-16
Backup Piece 8 18-JUN-16 /home/oracle/backup/back_ctl_08r8fd2c_1_1_20160618
Archive Log 7 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_12_cpb2xhg8_.arc
Backup Set 9 18-JUN-16
Backup Piece 9 18-JUN-16 /home/oracle/backup/back_spfile_09r8fd3n_1_1_20160618
Archive Log 8 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_13_cpb35zgs_.arc
Archive Log 9 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_14_cpb36dbo_.arc
Archive Log 10 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_15_cpb37ff2_.arc
Archive Log 21 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_16_cpb4d2gl_.arc
Archive Log 23 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_15_cpb4d2jt_.arc
Archive Log 22 18-JUN-16 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_18/o1_mf_1_14_cpb4d2jn_.arc
Backup Set 10 19-JUN-16
Backup Piece 10 19-JUN-16 /home/oracle/backup/bak_ctl_0ar8i7jh_1_1_20160619
RMAN> delete obsolete
crosscheck archivelog all;
delete noprompt expired archivelog all;
Oracle RMAN 备份及不完全恢复(删除archievelog)的更多相关文章
- Rman备份及不完全恢复操作
最后更新时间:2018/12/18 启用归档 --检查是否为归档 SQL> archive log list; Database log mode No Archive ...
- Oracle RMAN 备份一例
Oracle RMAN备份一例: Solaris 10 + Oracle 11.2.0.3 Shell:csh,安装有bash,脚本调用bash 备份策略:周日0级备份,周一~周六1级备份,每6小时备 ...
- Oracle—RMAN备份(三)
一.增量备份的相关概念 1. 在前面说明了RMAN的完整备份,完整备份是备份所用使用过的块,不备份没有使用的过的块:增量备份只备份自上次备份以来更改过的块. 2.即使RMAN的默认操作是在增量备份时扫 ...
- ORACLE RMAN备份及还原 RMAN能够进行增量备份:数据库,表空间,数据文件
ORACLE RMAN备份及还原 RMAN能够进行增量备份:数据库.表空间.数据文件 仅仅有使用过的block能够被备份成backup set 表空间与数据文件相应关系:dba_data_file ...
- Oracle—RMAN备份(一)
一.RMAN备份相关概念 1.RMAN备份中表空间不需要处于backup模式下,它备份数据文件,归档日志文件,控制文件,spfile和备份集片,但不备份联机重做日志文件,临时文件和口令文件. 2.备份 ...
- Oracle—RMAN备份(二)
在Oracle RMAN备份(一)中,对各种文件在RMAN中备份进行了说明, 一.备份集的复制 在RMAN 备份中,可以备份其自己的备份,即备份一个文件放在多个目录下,oralce支持最多备份四个. ...
- ORACLE RMAN备份--差异增量与累积增量的策略实例图
转自原文 ORACLE RMAN备份--差异增量与累积增量的策略实例图
- Oracle RMAN备份恢复指导书
目 录 1 目的与范围... 1 2 术语和定义... 1 3 角色和职责... 2 4 使用RMAN备份数据库... 2 4.1.1 检查数据库模式... 2 4.1.2 连接到target数据库. ...
- Oracle RMAN备份与还原
RMAN在数据库服务器的帮助下实现数据库文件.控制文件.数据库文件与控制文件的映像副本.归档日志文件.数据库服务器参数文件的备份. RMAN的特点: (1) 支持增量备份:传统的exp与expdp备份 ...
随机推荐
- [BZOJ3238][Ahoi2013]差异解题报告|后缀数组
Description 先分析一下题目,我们显然可以直接算出sigma(len[Ti]+len[Tj])的值=(n-1)*n*(n+1)/2 接着就要去算这个字符串中所有后缀的两两最长公共前缀总和 首 ...
- MySql binlog(理论篇)
1.什么是binlog? binlog日志用于记录所有更新了数据的sql语句或保存被修改的记录Row: 有了binlog,可以用于实时备份,master/slave主从同步: 在5.0版本前支持文本格 ...
- 2017年上海金马五校程序设计竞赛:Problem E : Find Palindrome (字符串处理)
Description Given a string S, which consists of lowercase characters, you need to find the longest p ...
- jquery with ajax
with session storage: 1.ajax请求可以放在 $(document).ready(function (){...}); 里. 2. $.ajax({ url: "/a ...
- 10款最新CSS3/jQuery菜单导航插件
这是我们在2014年收集的10款最新的CSS3 / jQuery菜单导航插件,不论从外观样式,还是功能扩展性,这些jQuery菜单一定可以满足大家的设计需求.这次我们收集的jQuery菜单,有水平 菜 ...
- Linux 开机自动挂载windows分区
blkid 查看 uuid如下ps:或者使用uuidgen <设备>查看具体设备的uuidreddusty@reddusty-X550JK:~$ sudo blkid[sudo] pass ...
- DDCTF - evil 一个伪装成docx的exe
0x01 题目描述 题目比较简单,不过这种题感觉比单纯的逆向算法来有意思的多,所以记录一下~ 0x02 脱壳 先拖到IDA瞅一眼,发现加壳了 用PEID查一下是什么壳,但是没有查出来.使用String ...
- HDU1068 (二分图最大匹配匈牙利算法)
Girls and Boys Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- eclipse断点调试时不能进入断点调试
页面JavaScript代码有错误!!!F12调试.
- HDU 6335.Problem D. Nothing is Impossible-思维题 (2018 Multi-University Training Contest 4 1004)
6335.Problem D. Nothing is Impossible 题意:给你n道题目,m个人,每题有x个正确选项,y个错误选项,问你做对题数量最多的人做对了多少道题目. 如果一道题有y个错误 ...