设为首页 收藏本站
查看: 565|回复: 0

[经验分享] 再次测试Oracle 10g支持跨resetlogs恢复

[复制链接]
YunVN网友  发表于 2016-8-13 07:24:28 |阅读模式
虽然很早以前就做过测试,Oracle 10g已经支持跨resetlogs恢复,但如果遇到离线备份+resetlogs,恢复不是很智能。
现在再做一下Oracle 10g rman跨resetlogs恢复。
首先对数据库做一个全备
RMAN> backup database format '/oradata/ora10r2_bak/database_full%t';

Starting backup at 19-DEC-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=153 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradata/ora10r2/system01.dbf
input datafile fno=00003 name=/oradata/ora10r2/sysaux01.dbf
input datafile fno=00005 name=/oradata/ora10r2/zhou01.dbf
input datafile fno=00002 name=/oradata/ora10r2/undotbs01.dbf
input datafile fno=00004 name=/oradata/ora10r2/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-DEC-10
channel ORA_DISK_1: finished piece 1 at 19-DEC-10
piece handle=/oradata/ora10r2_bak/database_full738175416 tag=TAG20101219T164336 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 19-DEC-10
channel ORA_DISK_1: finished piece 1 at 19-DEC-10
piece handle=/oradata/ora10r2_bak/database_full738175472 tag=TAG20101219T164336 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 19-DEC-10

做几个归档切换
16:36:30 SQL> alter system switch logfile;

System altered.

16:45:29 SQL> /

System altered.

16:45:29 SQL> /

System altered.

16:45:37 SQL> /

System altered.

16:45:37 SQL> /

System altered.

16:45:38 SQL> /

System altered.

将其reselogs打开
16:45:39 SQL> shutdown abort
ORACLE instance shut down.
16:46:04 SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size              88082024 bytes
Database Buffers          188743680 bytes
Redo Buffers                7168000 bytes
Database mounted.
16:46:28 SQL> recover database until cancel;
ORA-00279: change 588711 generated at 12/19/2010 16:45:39 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_28_738173171.dbf
ORA-00280: change 588711 for thread 1 is in sequence #28


16:46:37 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oradata/ora10r2/redo02.log
Log applied.
Media recovery complete.
16:47:09 SQL> alter database open resetlogs;

Database altered.

再做几个归档切换

16:47:28 SQL> alter system switch logfile;

System altered.

16:47:55 SQL> /

System altered.

16:47:55 SQL> /

System altered.

16:48:02 SQL> /

System altered.

16:48:03 SQL> /

System altered.

16:48:11 SQL> /

System altered.

现在就做一下跨resetlogs恢复
16:48:14 SQL> shutdown abort
ORACLE instance shut down.
16:48:31 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@linuxsvr ora10r2]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 19 16:48:55 2010

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

Connected to an idle instance.

16:48:55 SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size              88082024 bytes
Database Buffers          188743680 bytes
Redo Buffers                7168000 bytes
Database mounted.
16:49:05 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@linuxsvr ora10r2]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Dec 19 16:49:14 2010

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

connected to target database: ORA10R2 (DBID=2053467729, not open)

RMAN> restore database;

Starting restore at 19-DEC-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oradata/ora10r2/system01.dbf
restoring datafile 00002 to /oradata/ora10r2/undotbs01.dbf
restoring datafile 00003 to /oradata/ora10r2/sysaux01.dbf
restoring datafile 00004 to /oradata/ora10r2/users01.dbf
restoring datafile 00005 to /oradata/ora10r2/zhou01.dbf
channel ORA_DISK_1: reading from backup piece /oradata/ora10r2_bak/database_full738175416
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/ora10r2_bak/database_full738175416 tag=TAG20101219T164336
channel ORA_DISK_1: restore complete, elapsed time: 00:00:47
Finished restore at 19-DEC-10

查看incarnation,可以看到incarnation不变。
RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORA10R2  2053467729       PARENT  1          30-JUN-05
2       2       ORA10R2  2053467729       PARENT  446075     31-AUG-10
3       3       ORA10R2  2053467729       ORPHAN  526664     19-DEC-10
4       4       ORA10R2  2053467729       PARENT  527413     19-DEC-10
5       5       ORA10R2  2053467729       CURRENT 588713     19-DEC-10

归档信息显示如下:
---------- ------------- ------------ -----------------
        10        548077       548079            527413
        11        548079       548081            527413
        12        548081       548083            527413
        13        548083       548086            527413
        14        548086       548088            527413
        15        548088       568090            527413
        16        568090       568274            527413
        17        568274       568276            527413
        18        568276       568279            527413
        19        568279       568282            527413
        20        568282       568284            527413

SEQUENCE# FIRST_CHANGE# NEXT_CHANGE# RESETLOGS_CHANGE#
---------- ------------- ------------ -----------------
        21        568284       588294            527413
        22        588294       588700            527413
        23        588700       588702            527413
        24        588702       588705            527413
        25        588705       588707            527413
        26        588707       588709            527413
        27        588709       588711            527413
        28        588711       588713            527413
         1        588713       588814            588713
         2        588814       588816            588713
         3        588816       588819            588713

SEQUENCE# FIRST_CHANGE# NEXT_CHANGE# RESETLOGS_CHANGE#
---------- ------------- ------------ -----------------
         4        588819       588821            588713
         5        588821       588824            588713
         6        588824       588826            588713

58 rows selected.
再次查看resetlogs_change
04:50:08 SQL> select checkpoint_change#,resetlogs_change# from v$datafile_header;

CHECKPOINT_CHANGE# RESETLOGS_CHANGE#
------------------ -----------------
            588633            527413
            588633            527413
            588633            527413
            588633            527413
            588633            527413


可以看到成功跨越!
16:50:45 SQL> recover database;
ORA-00279: change 588633 generated at 12/19/2010 16:43:36 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_22_738173171.dbf
ORA-00280: change 588633 for thread 1 is in sequence #22


16:51:21 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 588700 generated at 12/19/2010 16:45:28 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_23_738173171.dbf
ORA-00280: change 588700 for thread 1 is in sequence #23
ORA-00278: log file '/oradata/archlog/1_22_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588702 generated at 12/19/2010 16:45:29 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_24_738173171.dbf
ORA-00280: change 588702 for thread 1 is in sequence #24
ORA-00278: log file '/oradata/archlog/1_23_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588705 generated at 12/19/2010 16:45:37 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_25_738173171.dbf
ORA-00280: change 588705 for thread 1 is in sequence #25
ORA-00278: log file '/oradata/archlog/1_24_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588707 generated at 12/19/2010 16:45:37 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_26_738173171.dbf
ORA-00280: change 588707 for thread 1 is in sequence #26
ORA-00278: log file '/oradata/archlog/1_25_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588709 generated at 12/19/2010 16:45:38 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_27_738173171.dbf
ORA-00280: change 588709 for thread 1 is in sequence #27
ORA-00278: log file '/oradata/archlog/1_26_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588711 generated at 12/19/2010 16:45:39 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_28_738173171.dbf
ORA-00280: change 588711 for thread 1 is in sequence #28
ORA-00278: log file '/oradata/archlog/1_27_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588713 generated at 12/19/2010 16:47:17 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_1_738175637.dbf
ORA-00280: change 588713 for thread 1 is in sequence #1
ORA-00278: log file '/oradata/archlog/1_28_738173171.dbf' no longer needed for
this recovery


ORA-00279: change 588814 generated at 12/19/2010 16:47:55 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_2_738175637.dbf
ORA-00280: change 588814 for thread 1 is in sequence #2
ORA-00278: log file '/oradata/archlog/1_1_738175637.dbf' no longer needed for
this recovery


ORA-00279: change 588816 generated at 12/19/2010 16:47:55 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_3_738175637.dbf
ORA-00280: change 588816 for thread 1 is in sequence #3
ORA-00278: log file '/oradata/archlog/1_2_738175637.dbf' no longer needed for
this recovery


ORA-00279: change 588819 generated at 12/19/2010 16:48:01 needed for thread 1
ORA-00289: suggestion : /oradata/archlog/1_4_738175637.dbf
ORA-00280: change 588819 for thread 1 is in sequence #4
ORA-00278: log file '/oradata/archlog/1_3_738175637.dbf' no longer needed for
this recovery


Log applied.
Media recovery complete.

resetlogs_change#已经发生变化
04:52:16 SQL> select checkpoint_change#,resetlogs_change# from v$datafile_header;

CHECKPOINT_CHANGE# RESETLOGS_CHANGE#
------------------ -----------------
            588827            588713
            588827            588713
            588827            588713
            588827            588713
            588827            588713

04:52:21 SQL> select resetlogs_change# from v$database;

RESETLOGS_CHANGE#
-----------------
           588713

04:52:34 SQL> alter database open;

Database altered.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-257116-1-1.html 上篇帖子: 在Java中执行Oracle分页的存储过程 下篇帖子: 使用spring调用oracle 的存储过程procedure实践
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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