温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

flashback闪回技术的分析

发布时间:2021-11-12 15:44:22 来源:亿速云 阅读:104 作者:柒染 栏目:关系型数据库

这篇文章将为大家详细讲解有关flashback闪回技术的分析,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

##开启flasbback
SQL> alter system set db_recovery_file_dest_size=80g scope=spfile;

设置闪回区位置:

SQL> alter system set db_recovery_file_dest='/workdb/account_flashback_area' scope=spfile;

设置闪回目标为5天,以分钟为单位,每天为1440分钟:

SQL> alter system set db_flashback_retention_target=7200 scope=spfile;

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

Total System Global Area 1056411648 bytes

Fixed Size                  2257584 bytes

Variable Size             612371792 bytes

Database Buffers          436207616 bytes

Redo Buffers                5574656 bytes

Database mounted.

SQL> alter database flashback on;  #关闭alter database flashback off;

Database altered.

SQL> alter database open;


##查询当前的scn号

SQL> select CURRENT_SCN from v$database;

CURRENT_SCN

-----------

     724633

##查询当前的log sequence号

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            +ARCH1

Oldest online log sequence     30

Next log sequence to archive   32

Current log sequence           32

####通过flashback恢复数据库

startup mount

##恢复到指定的时间点

flashback database to timestamp(to_date('2010-01-01 20:00:00','YYYY-MM-DD HH24:MI:SS'));

flashback database to timestamp(sysdate-1/24); ##恢复到一小时前

##恢复到指定的SCN

flashback database to scn ********;

##恢复到某个log sequence

flashback database to sequence=**** thread=1;

alter database open resetlogs;

####通过flashback恢复表

##通过flashback恢复被删除的表,如果cyclebin已经被开启

flashback table <table_name> to before drop [rename to <net_name>];

##回退到一小时前

flashback table <table_name> to timestamp(system-1/24);

##多表同时回退到指定的时间点

flashback table <table_name,table_name> to timestamp(system-1/24/60);  ##回退到1分钟前

##回退到指定的scn

flashback table <table_name> to scn ******;

##回退是启动出发起

flashback table <table_name> to scn ****** enable triggers;

关于flashback闪回技术的分析就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI