【转】关于Restore Point

本文介绍了Oracle数据库中还原点的两种类型:Normal和Guaranteed,并详细解释了它们的作用及如何使用。此外,还讨论了如何利用Guaranteed还原点确保数据库能够回滚到特定时间点。

还原点(Restore point)是Oracle10gR2配合Flashback database推出的一个新特性。Restore point可以单独使用,也可以和Flashback database联合使用。

我们知道,Flashback database提供了一种将数据库整个的回滚到之前某个时间点的功能,相当于使用之前的某个备份做基于时间点的恢复,但是比基于时间点的恢复更有效率,因为无需执行备份数据文件的复制,只需要使用flashback log执行数据库回滚即可。也就是说,要使用flashback database功能,必须保证所需要的所有flashback log存在。flashback log存放在flashback recovery area中。由于falshback log中需要包含变更的数据块的映象,设置过长的flashback retention target,可能导致flashback recovery area空间不足。

Restore point有两种类型:Normal和Guaranteed。

Normal restore point相当于某个时间点或者SCN的一个别名。restore point的名字和对应的SCN会保存在控制文件中。创建了normal restore point后,如果需要执行flashback database/flashback table/point-in-time recovery等操作时,就可以制定目标时间点为该restore point,而不需要指定当时的SCN了。在很多关于恢复和闪回的试验中,作者都是在试验前查询系统当前的SCN,执行某些操作,然后恢复或者闪回到之前查询到的SCN。有了normal restore point后,就不再需要查询系统当前scn了,只需要创建一个有意思的normal restore point名,以后使用该名字即可。

Guaranteed restore point的功能和normal restore point的功能基本一致,也是作为SCN的一个别名。但是它还有一些和flashback database相关的特性。前面也提到,在执行flashback database到之前的某个时间点时,必须保证所需要的flashback log存在。

创建一个guaranteed restore point,可以保证能将数据库flashback到该点,即使没有系统启用flashback database日志!这是因为,在创建guaranteed restore point之后,对于任何block的第一次变更,都会将其前映象整个的记录下来。

如果系统启用了flashback database日志,那么guaranteed restore point可以保证能将数据库flashback到guaranteed restore point之后的任何时间点。

启用flashback database日志功能,需要使用alter database flashback on并且设置DB_FLASHBACK_RETENTION_TARGET参数(默认为1天)。默认情况下,会启用所有tablespace的flashback日志,也可以针对某个tablespace单独设置,如ALTER TABLESPACE tbs_3 FLASHBACK OFF。

有了Guaranteed restore point,甚至可以将数据库flashback到几天或者几个星期之前,只要flashback recovery area中空间足够。所以创建了guaranteed restore point后,需要对flashback recovery area空间保持密切的监控。

a.创建normal restore point

SQL > CREATE RESTORE POINT before_upgrade ;
Restore point created .

b.创建guaranteed restore point

SQL> CREATE RESTORE POINT before_upgrade GUARANTEE FLASHBACK DATABASE;
Restore point created.

c.列举系统中已经创建的restore point

SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
        
GUARANTEE_FLASHBACK_DATABASE,STORAGE_SIZE
        
FROM V$RESTORE_POINT;

d.列举系统中已经创建的guaranteed restore point

SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
        
GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE
        
FROM V$RESTORE_POINT
      
WHERE GUARANTEE_FLASHBACK_DATABASE='YES';

对于normal retore point,storage_size为0。而guaranteed restore point的storage_size则为保证系统能够flashback到该点所需要的记录前映象的磁盘空间。

e.删除restore point

SQL> DROP RESTORE POINT before_app_upgrade;
Restore point dropped.
--END- -
FROM:NinGoo@Net

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

转载于:http://blog.itpub.net/10714335/viewspace-399603/

### Gold Restore Software or Tool in IT Gold Restore is a software or tool often associated with data recovery and system restoration within the IT field. It primarily focuses on restoring systems to their previous states, ensuring minimal data loss during catastrophic failures or significant changes[^1]. In the context of system recovery, tools like Gold Restore are designed to create snapshots or backups of critical system states. These snapshots can then be used to revert the system back to a stable condition when required. The process involves capturing the current state of the operating system, installed applications, configuration settings, and even specific user data. For instance, in Linux-based environments, restoring system configurations might involve reconfiguring environment variables as demonstrated by exporting paths such as `ANDROID_TOOLCHAIN`[^2]. While this example pertains to Android development, similar principles apply for restoring broader IT systems using dedicated tools like Gold Restore. #### Features of Gold Restore Tools - **System State Backup**: Captures the entire system's state at a given point in time. - **Selective Restoration**: Allows users to restore only specific components rather than the entire system. - **Automated Scheduling**: Supports scheduling regular backups automatically to ensure up-to-date recovery points. - **Cross-Platform Compatibility**: Some versions may support multiple operating systems, including Windows, macOS, and Linux. ```python # Example Python script for automating backup creation import shutil import os def create_backup(source_dir, destination_dir): try: shutil.copytree(source_dir, destination_dir) print(f"Backup created successfully from {source_dir} to {destination_dir}.") except Exception as e: print(f"Error creating backup: {e}") # Usage example create_backup('/path/to/source', '/path/to/backup') ``` The above script demonstrates how one might automate the creation of a backup directory, which aligns with the core functionality of tools like Gold Restore.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值