ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle10GR2 中的RESTORE POINT

Oracle10GR2 中的RESTORE POINT

原创 Linux操作系统 作者:season0891 时间:2010-05-26 13:36:27 0 删除 编辑
RESTORE POINT

    还原点是10GR2新增加的一个功能,它是建立在数据库层面上的, 跟savepoint不同. 必须在数据库处于ARCHIVELOG模式下才可以使用,主题思想是在数据库的某个时间点创建一个restore point,在随后的某个时间点可以将表或数据库falshback 到这个restore point.那么能否真正的完成flashback,依赖于创建的restore point类型和flashback要操作的对象.flashback database需要SYSDBA权限,flashback table需要 FLASHBACK ANY TABLE的权限.

    guarantee restore point for flashback database  

    guarantee restore point必须在数据库处于flashback on 的状态下,才可以定义的一中restore point,它的主题思想是保证数据库能够准确完整的flashback 到定义的 restore point. 操作依赖于flashback log和archivelog, 如果定义了guarantee restore point,那么flashback logs将不受db_recovery_retention_target参数的限制,oracle不会删除flashback log,只要flashback arae有足够的磁盘空间,oracle就会保存足够的flashback logs,满足flashback database to restore point.

    如果数据库没有处于flashback on,那么定义一个guarantee restore point必须在database mount状态下进行.其实这个也可以理解,oracle根据定义的restore point,可以个保证database open后的归档可以不被删除.但有一点必须明确的是,guarantee restore point是针对flashback database而言的,不对flashback table起作用,为什么呢, 因为flashback table依赖于undo,如果在guarantee时间范围内,undo过期了, 那么flatable table 还是不能还原到定义的guarantee restore point.

    Normal restore point 

    普通的restore point 非常简单, 如果要flashback database,那么数据库必须处于flashback on 状态,但这个时候不一定可以flashback database到定义的restore point,oracle会根据db_recovery_retention_target自动维护创建的restore ponit和flashback logs,如果超过db_recovery_retention_target 定义的restore point,oracle会自动删除 , 无论是flashback table或者flashback database都不能完成.

    简单的流水帐记录,为了试自己更加明确restore point的原理.

    创建一个guarantee restore point

#div_code img{border:0px;}
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->SQL> create restore point a guarantee flashback database;

    创建一个普通的restore point

#div_code img{border:0px;}
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->SQL> create restore point b;

    flashback dtaase to restore point:(必须在guarantee restore point for flashback database的情况)

#div_code img{border:0px;}
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->SQL> startup mount
  ORACLE instance started.

Total System Global Area  
209715200 bytes

Fixed Size                  
1266632 bytes

Variable Size            
134220856 bytes

Database Buffers           71303168 bytes

Redo Buffers                
2924544 bytes

Database mounted.

SQL
> flashback database to restore point a;

Flashback complete.

SQL
> alter database open resetlogs;

Database altered.

    falshback table

#div_code img{border:0px;}
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->SQL> alter table test_histogram enable row movement;

Table altered.

SQL
> flashback table test_histogram to restore point a;

Flashback complete.

 



   

 

相关阅读:
come from : http://publish.itpub.net/a2010/0415/874/000000874104.shtml

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/90618/viewspace-663765/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-10

  • 博文量
    790
  • 访问量
    2098107