关于resetlog的作用是将日志序列重置,这样以前的归档就作废。

首先一定要明白oracle工作的基本原理,归档情况下:大家一定要同步,谁也不能滞后或者超前,也就是SCN号,如果学oracle不懂scn的作用,那oracle就很难学懂了。为什么要resetlog,因为有一些地方不一致了,必须得需要着一个基准点,让大家以这个为起点,一起继续超前走。

alter database open noresetlogs与resetlog的区别:

http://www.oracle.com.cn/viewthread.php?tid=1490

个人理解:
resetlogs,由于不完全恢复导致日志不连续而不能使用恢复点之后的日志进行重做,所以使用resetlogs进行打开数据库。
noresetlogs,由于控制文件的版本是从备份中而来或是手工重建的,并且所有日志是连续的,可以用于重做,所以使用noresetlogs打开数据库,意为使用log进行重做。

目录
1 概述
2 运用场合
3 作用
4 在RMAN中OPEN RESETLOGS与SQLPLUS中OPEN RESETLOGS的区别
5 在重建控制文件的时候使用ResetLog
1、概述

The primary function of resetlogs is to discard the redo that was not applied during incomplete recovery, ensuring that the skipped redo can never be accidentally applied by a subsequent recovery. To accomplish this, resetlogs effectively invalidates all existing redo in all online and archived redo logfiles. This has the side effect of making any existing datafile backups unusable for future recovery operations.Resetlogs also reinitializes the controlfile information about online logs and redo threads, clears the contents of any existing online redo log files, creates the online redo log files if they do not currently exist, and resets the log sequence number in all threads to one.    

resetlogs的主要功能是在不完全恢复过程中忽略不可用的重做日志,确保略过的日志不影响接下来的恢复。resetlogs把所有存在于在线或归档的日志文件中的重做信息都置为不可用。这带来一个副作用,使得已存在的数据文件备份对将来的数据恢复不再是安全可用的了。resetlogs同时还会:重新初使化控件文件中的在线日志信息及重做日志线程、清除已存在的重做日志文件、若重做日志不存在则创建日志文件、重置所有线程中的日志序号为1。

2、运用场合  以下条件需要使用resetlog

1)在不完全恢复(介质恢复)

2)使用备份控制文件(backup的控制文件一般从日志文件和数据库的信息以及SCN的信息,相比目前的状态都已经过期了)

3、ResetLog的作用

(1)将重做日志的序列号设为1

(2)一般以该子句打开数据库后,要立即备份数据库,因为这个子句会使数据库以前的备份不能用.

(3)在重做日志当前日志组出现错误时,要以该子句打开数据库.该子句会重新设置重做日志文件的状态.

(4)让数据库系统归档初始化,重新生成归档文件.

4、在RMAN中OPEN RESETLOGS与SQLPLUS中OPEN RESETLOGS的区别

1) If you run the RMAN command (not the SQL statement) ALTER DATABASE OPEN RESETLOGS, then RMAN automatically creates a new database incarnation record in the recovery catalog. RMAN implicitly and automatically issues a RESET DATABASE command, which specifies that this new incarnation of the database is the current incarnation. RMAN associates all subsequent backups and log archiving done by the target database with the new database incarnation.

2) If you issue the SQL statement (not the RMAN command) ALTER DATABASE OPEN RESETLOGS, then RMAN does not automatically run a RESET DATABASE command. Hence, RMAN cannot access the recovery catalog because it cannot distinguish between a RESETLOGS command and an accidental restore of an old control file. To solve this problem, you must manually run the RESET DATABASE command in RMAN after executing the SQL statement ALTER DATABASE OPEN RESETLOGS.  The RESET DATABASE command updates the repository to indicate that the target database has been opened with the RESETLOGS option. In the rare situation in which you wish to restore backups of a prior incarnation of the database, use the RESET DATABASE TO INCARNATION key command to change the current incarnation to an older incarnation. For example, if you accidentally drop a table immediately after the most recent RESETLOGS, then you may want to  recover the database to just before the time of the most recent RESETLOGS and then open it with the RESETLOGS option, thereby creating a new incarnation.

5、在重建控制文件的时候使用ResetLogs

1.create controlfile resetlogs/noresetlogs    

1)用noresetlogs重建控制文件时,控制文件中datafile Checkpoint SCN来自online logs中的Current log头    

2)用resetlogs重建控制文件时,控制文件中datafile Checkpoint SCN来自各数据文件头(Start SCN)。

2.数据文件检查点scn
当一个检查点动作完成后,Oracle就把每个数据文件的scn单独存放在控制文件中。
select name,checkpoint_change# from v$datafile;
3、启动scn
Oracle把这个检查点的scn存储在每个数据文件的文件头中,这个值称为启动scn,因为它用于在数据库实例启动时,
检查是否需要执行数据库恢复。
select name,checkpoint_change# from v$datafile_header
4、终止scn
每个数据文件的终止scn都存储在控制文件中。
select name,last_change# from v$datafile
以下条件需要使用using backup controlfile 
1)、使用备份控制文件
2)、重建resetlogs控制文件,如果重建立noresetlogs不必要使用using backup controlfile
2、alter database open resetlog 
指定RESETLOGS将重设当前LOG sequence number为1,抛弃所有日志信息。
以下条件需要使用resetlog
1)在不完全恢复(介质恢复)
2)使用备份控制文件
使用resetlogs打开数据库后无必完整地备份一次数据库。
3、create controlfile resetlogs/noresetlogs
1)用Noresetlogs重建控制文件时,控制文件中 datafile Checkpoint来自Online logs中的Current log头
2)用Resetlogs重建控制文件时,控制文件中datafile Checkpoint来自各数据文件头。
当system scn,datafile scn,start scn 不全相等,需要介质恢复,如果stopscn null需要实例恢复,resetlogs抛弃所有在上一次恢复没有用到的日志信息,确保不被重新用与恢复。
1、系统正常关闭:
system scn=datafile scn=start scn=stop scn
1)system scn=datafile scn=start scn,不需要介质恢复
2)stopscn not null,不需要实例恢复
2、系统异常关闭:
system scn=datafile scn=start scn,stop scn null
1)system scn=datafile scn=start scn,不需要介质恢复
2)stopscn null,需要实例恢复
3、旧数据文件
system scn=datafile scn>start scn,stop scn null/notnull
1)system scn=datafile scn>start scn,需要介质恢复成system scn=datafile scn=start scn
2)stopscn null,需要实例恢复,not null 不需要实例恢复
4、备份控制文件
system scn=datafile scn<=start scn(当数据文件为旧的相等),stop scn notnull/null
1)system scn=datafile scn<=start scn,需要使用using backup controlfile介质恢复成system scn=datafile scn=start scn=current log scn(当前日志最大SCN)
2)为保证上一次恢复没有用到log日志不被使用,必须resetlogs
5、重建noresetlogs控制文件
控制文件中 datafile Checkpoint来自Online logs中的Current log头
current log scn=system scn=datafile scn>=start scn,stop scn not null/null
1)current log scn=system scn=datafile scn>=start scn,需要介质恢复成system scn=datafile scn=start scn=redolog scn(当前日志最大SCN),stop scn not null
2)stopscn not null 不需要实例恢复
6、重建resetlogs控制文件
控制文件中datafile Checkpoint来自各数据文件头。 
system scn>=datafile scn=start scn,stop scn not null/null
1)system scn>=datafile scn=start scn,需要使用using backup controlfile介质恢复成system scn=datafile scn=start scn(当前日志最大SCN),stop scn not null

2)stop notnull,因为SCN已经为redolog scn,log已经不能使用,必须resetlogs

《FROM:http://blog.csdn.net/zhjxixi/article/details/7739199》

转载于:https://www.cnblogs.com/rusking/p/4371911.html

oracle resetlog与noresetlog的作用(转载)相关推荐

  1. 资源放送丨《Oracle聚簇因子的作用 - 2020云和恩墨大讲堂》PPT视频

    前段时间,墨天轮分享了直播<Oracle聚簇因子的作用 - 2020云和恩墨大讲堂>,在这里我们共享一下PPT和视频,供大家参考学习. 本分享从索引的结构和特点入题,引出聚簇因子的作用,并 ...

  2. oracle中exist什么意思,oracle中not exists 是什么意思 , oracle数据库中exists的作用

    导航:网站首页 > oracle中not exists 是什么意思 , oracle数据库中exists的作用 oracle中not exists 是什么意思 , oracle数据库中exist ...

  3. AutoEventWireup 属性的作用(转载)

    AutoEventWireup 属性的作用(转载) 一.Page指令中的AutoEventWireup="true",该指令默认值为true. 指示页的事件是否自动绑定.如果启用了 ...

  4. 删除某一个字段oracle,oracle添加字段或者删除字段-转载

    添加字段的语法:alter table tablename add (column datatype [default value][null/not null],-.); 修改字段的语法:alter ...

  5. Oracle数据库:oracle 11g安装教程,已安装好的oracle各个文件夹的作用,oracle用户权限怎么样

    Oracle数据库:oracle 11g安装教程,已安装好的oracle各个文件夹的作用,oracle用户权限怎么样 2022找工作是学历.能力和运气的超强结合体,遇到寒冬,大厂不招人,可能很多算法学 ...

  6. Oracle同义词创建及其作用(转载)

    Oracle的同义词(synonyms)从字面上理解就是别名的意思,和试图的功能类似,就是一种映射关系.本文介绍如何创建同义词语句,删除同义词以及查看同义词语句.  oracle的同义词总结:  从字 ...

  7. Oracle 同义词的创建及其作用

    在Oracle中对用户管理是使用权限的方式来管理.也就是说,我们想使用数据库,就必须的有权限.但是如果别人将权限授予我们, 我们也能对数据库进行操作,但是我们必须要在已授权的表前键入该表owner的名 ...

  8. Oracle 11gR2 Patchset 不同文件作用 说明

    在Oracle 10g 版本的Patchset里面,只有一个文件Disk1.  到了Oracle 11.2.0.2和11.2.0.3 的Patchset 大小是剧增.11.2.0.2 和 11.2.0 ...

  9. Oracle 存储过程 无法编译 解决方法(转载)

    声明:本文为转载,如果有侵犯知识版本,请通知本人,本人将即刻停止侵权行为: http://blog.csdn.net/tianlesoftware/article/details/7412555 Or ...

最新文章

  1. Cocos 物理系统
  2. 客观地认识程序员心中的恐惧
  3. WinXP中鲜为人知的28项隐藏功能
  4. [GAN学习系列2] GAN的起源
  5. “BindingNavigator”如何在删除前弹出确认框?
  6. 混合样本数据增强(Mixed Sample Data Augmentation,MSDA)
  7. bartlett方差齐性检验_方差齐性检验
  8. centos+gitlab+mysql_centos7安装配置gitlab(使用外部nginx)
  9. 摘抄和总结--确保搞砸人工智能项目的十种方法
  10. 智慧城市的宠儿 大数据为城市建设添彩
  11. 向日葵android客户端,向日葵安卓3.1客户端教程
  12. Android蓝牙传给iPad,无需越狱通过蓝牙让 iPod touch/iPad 连接 Android 手机共享上网...
  13. 排列序列(第k个排列)
  14. 【wireshark】如何获取一个设备的IP地址
  15. 数据结构哈夫曼树实现26个英文字符的编码和译码
  16. zz:Android APP Monkey信息自动收集脚本
  17. 城市信息area.js
  18. 单片机与ARM嵌入式区别
  19. 如何去掉a标签的下划线
  20. wps怎么把字缩到最小_wps文字怎么把空行缩小

热门文章

  1. 未能加载文件或程序集 CrystalDecisions.Web Version=10.2.3600解决方法
  2. python异常(概念、捕获、传递、抛出)
  3. xShell终端中文乱码完全解决方法
  4. Command ‘ifconfig‘ not found, but can be installed with: sudo apt install net-tools VM Ubuntu 解决方案
  5. 如何在Visual Studio 2012中撤消“范围到此”?
  6. 有没有更好的写v =(v == 0?1:0)的方法; [关闭]
  7. 用argparse解析布尔值
  8. 为什么C预处理程序将单词“ linux”解释为常量“ 1”?
  9. Django可扩展吗? [关闭]
  10. 电脑自动关机什么原因?