flashback to timestamp 耗时

 flashback pluggable database XX to timestamp to_date('2024-02-26 13:11:56','yyyy-mm-dd hh24:mi:ss');

1TB 花费2小时,如果做了还原点好像很快

select   trunc( a.FIRST_TIME,'HH24'),count(*) from v$flashback_database_logfile a  group by trunc( a.FIRST_TIME,'HH24') order by 1;

TRUNC(A.FIRST_TIME,'HH24')   COUNT(*) 

26/02/2024 11:00:00 AM            117
26/02/2024 12:00:00 PM            119
26/02/2024 1:00:00 PM             117
26/02/2024 2:00:00 PM             143
26/02/2024 3:00:00 PM             166
26/02/2024 4:00:00 PM              48
26/02/2024 5:00:00 PM              25
26/02/2024 6:00:00 PM              29
26/02/2024 7:00:00 PM              17
26/02/2024 8:00:00 PM               1

69 rows selected


SQL> 

SQL> select distinct bytes from v$log ;

     BYTES
----------
2097152000

SQL> select distinct bytes from v$flashback_database_logfile ;

     BYTES
----------
2097152000

SELECT SID, decode(totalwork, 0, 0, round(100 * sofar/totalwork, 2)) "Percent", message "Message", start_time, elapsed_seconds, context, Time_remaining, inst_id 
from GV$session_longops
where  (SID = :sid  AND INST_ID = :inst_id AND SERIAL# = :SERIAL#)
ORDER BY SID

61.95    Flashback Database: Flashback Data Applied : 639419 out of 1032074 Megabytes done    26/02/2024 6:39:21 PM    4781    1    2936    1

----ALERT.LOG

flashback pluggable database PDB to timestamp to_date('2024-02-26 13:11:56','yyyy-mm-dd hh24:mi:ss')
2024-02-26T18:38:51.708082+08:00

--
Flashback Restore Start
2024-02-26T18:39:36.826902+08:00

--
Restore Flashback Pluggable Database PDB (4) until change 14687995287
Flashback Restore Complete
2024-02-26T20:51:48.339124+08:00


Flashback Media Recovery Start
2024-02-26T20:51:48.342610+08:00
Serial Media Recovery started
--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13504.55200.1161954227
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8517.35702.1161954223
2024-02-26T20:52:48.414607+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8518.39200.1161954255
2024-02-26T20:52:51.490107+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13505.17093.1161954353
2024-02-26T20:53:26.904154+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8519.54815.1161954283
2024-02-26T20:53:39.383717+08:00
Thread 1 advanced to log sequence 13915 (LGWR switch),  current SCN: 14705377679
--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8520.20688.1161954349
2024-02-26T20:54:35.053371+08:00
ARC1 (PID:26011): Archived Log entry 305637 added for T-1.S-13914 ID 0xe314bddd LAD:1
--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8521.52144.1161954371
2024-02-26T20:55:35.686146+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13506.3643.1161954495
2024-02-26T20:56:26.048895+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8522.24341.1161954421
2024-02-26T20:57:11.591965+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8523.21024.1161954493
2024-02-26T20:58:11.393814+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8524.15057.1161954549
2024-02-26T20:58:18.992720+08:00

--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13507.21890.1161954627
2024-02-26T20:58:53.672950+08:00

--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8525.16652.1161954595
2024-02-26T20:59:33.530424+08:00
Thread 1 advanced to log sequence 13916 (LGWR switch),  current SCN: 14705383076
--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8526.20148.1161954625
2024-02-26T21:00:25.702412+08:00
ARC2 (PID:26014): Archived Log entry 305639 added for T-1.S-13915 ID 0xe314bddd LAD:1
--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8527.5533.1161954653
2024-02-26T21:01:41.970995+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13508.21427.1161954661
2024-02-26T21:02:47.222020+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8528.44889.1161954679
2024-02-26T21:03:12.815217+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13509.12098.1161954693
2024-02-26T21:04:02.899066+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8529.36994.1161954707
2024-02-26T21:04:08.285176+08:00
Thread 1 advanced to log sequence 13917 (LGWR switch),  current SCN: 14705389678
--
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_1_seq_13510.25097.1161954729
2024-02-26T21:04:52.634305+08:00
Flashback Media Recovery Log +RECO01//ARCHIVELOG/2024_02_26/thread_2_seq_8530.37542.1161954733
2024-02-26T21:05:09.131946+08:00
ARC3 (PID:26017): Archived Log entry 305641 added for T-1.S-13916 ID 0xe314bddd LAD:1
--
Flashback Media Recovery Complete
2024-02-26T21:05:18.369174+08:00
Flashback Pluggable Database PDB (4) recovered until change 14688014921, at 02/26/2024 13:11:57
Completed:  flashback pluggable database PDB to timestamp to_date('2024-02-26 13:11:56','yyyy-mm-dd hh24:mi:ss')
2024-02-26T21:06:35.825426+08:00
alter  pluggable database PDB  open read only
[oracle@n2pdblinu0001 trace]$

---------------------------------------------------------

-----------------------------

According to Oracle® Database Backup and Recovery Basics 10g Release 2 (10.2), chapter 5.1.4.2
using restore points without flashback logging should cause each modified block to only be saved one time. Yet tests show that updating the SAME data blocks each time causes more flashback logs to be generated and the flash recovery area usage grows.

 

SOLUTION

The flashback data being generated is related to generation of UNDO and some changes to
SYSAUX due to AWR stats collection. Each update will generate REDO and UNDO and each block in the UNDO tablespace that is used for the first time, will require flashback data to be written. The
guideline figure is:

if your database is 1Gb then potentially, the flashback data where only a guaranteed restore point is used, should be at most 1Gb.-----保证还原点才是1:1,好像又不太对

---

After issuing any FLASHBACK DATABASE command, is there a way to monitor the progress of the flashback database? There is no entry in v$session_longops and nothing showing any progress in the alert.log.
 

SOLUTION

As with media recovery, flashback database will change the checkpoint_change# and checkpoint_time of the database files. So you should be able to query those two columns from v$datafile_header;

The first part of the flashback database uses the flashback logs to roughly get close to the SCN or time of the until clause. The last part uses the archivelogs to fine-grained get to the exact SCN or time. This means that the checkpoint_change# and checkpoint_time values should go backwards in time when working with the flashback logs, then go forward as redo is applied during the fine-grained media recovery of the last part.

SQL> select distinct checkpoint_change# , checkpoint_time     from v$datafile_header a where CON_ID=1;

CHECKPOINT_CHANGE# CHECKPOINT_TIME
------------------ ---------------
       14705316905 26/02/2024 8:13
       14705313228 26/02/2024 8:09
       14705326036 26/02/2024 8:13

 
SQL> select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=4;

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
       14687969687 26/02/2024 1:03 YES     YES

SQL>  select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=5;

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
       14705316905 26/02/2024 8:13 NO      YES

SQL> 
SQL> select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=2;

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
        5946401139 27/09/2023 9:42         NO

SQL> 

-----read write

SQL> select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=4;

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
       14705417495 26/02/2024 9:18 NO      YES
       14705414228 26/02/2024 9:17         NO

SQL>  select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=4;

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
       14705434827 26/02/2024 9:22 NO      YES

SQL> 

-----------------rollforward

SQL> select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=4;

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
       14688009767 26/02/2024 1:10 YES     YES

SQL>  select distinct checkpoint_change# , checkpoint_time, recover,fuzzy  from v$datafile_header a where CON_ID=4;
 
 

CHECKPOINT_CHANGE# CHECKPOINT_TIME RECOVER FUZZY
------------------ --------------- ------- -----
       14688014921 26/02/2024 1:11         NO

SQL> 

----flashback 第一步估算准确,第二步 估算了30000s!!!!实际 800s
100    Media Recovery: Log Files : 806 out of 806 Files done    26/02/2024 8:51:47 PM    802    4    0    1

100    Flashback Database: Flashback Data Applied : 1032074 out of 1032074 Megabytes done    26/02/2024 6:39:21 PM    7913    1    0    1
100    Media Recovery: Log Files : 806 out of 806 Files done    26/02/2024 8:51:47 PM    802    4    0    1
100    Media Recovery: Average Apply Rate : 33321 out of 33321 KB/sec done    26/02/2024 8:51:47 PM    803    2    0    1
100    Media Recovery: Redo Applied : 26129 out of 26129 Megabytes done    26/02/2024 8:51:47 PM    802    3    0    1
100    Media Recovery: Recovery ID : 1 out of 1 RCVID done    26/02/2024 8:51:47 PM    784    11    0    1
100    Media Recovery: Apply Time per Log : 34 out of 34 Seconds done    26/02/2024 8:51:47 PM    803    8    0    1
0    Media Recovery: Standby Apply Lag : 0 out of 0 Seconds done    26/02/2024 8:51:47 PM    803    10        1
100    Media Recovery: Elapsed Time : 803 out of 803 Seconds done    26/02/2024 8:51:47 PM    803    7    0    1
100    Media Recovery: Maximum Apply Rate : 59065 out of 59065 KB/sec done    26/02/2024 8:51:47 PM    803    2    0    1
100    Media Recovery: Active Apply Rate : 55715 out of 55715 KB/sec done    26/02/2024 8:51:47 PM    803    1    0    1
100    Media Recovery: Active Time : 751 out of 751 Seconds done    26/02/2024 8:51:47 PM    803    6    0    1
100    Media Recovery: Checkpoint Time per Log : 1 out of 1 Seconds done    26/02/2024 8:51:47 PM    803    9    0    1
100    Media Recovery: Last Applied Redo : 1 out of 1 SCN+Time done    26/02/2024 8:51:47 PM    802    5    0    1
0    Serial Media Recovery: Buffer Ping Time : 0 out of 0 Microseconds done    26/02/2024 8:51:59 PM    789    0        1
0    Serial Media Recovery: CV Applied Reapplied : 0 out of 0 Vectors done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: Total CV Processed Size : 385920 out of 385920 Bytes done    26/02/2024 8:51:59 PM    789    0    0    1
0    Serial Media Recovery: CV Applied Corrupt : 0 out of 0 Vectors done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: CV Applied Repair : 0 out of 0 Vectors done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Number of Redo Cache Full : 0 out of 0 Times done    26/02/2024 8:51:59 PM    790    0        1
0    Serial Media Recovery: Apply Delay Range (4,8] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Apply Delay Range (256, 1000] us : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Number of Reap Wait IO : 0 out of 0 Times done    26/02/2024 8:51:59 PM    789    0        1
0    Serial Media Recovery: Apply Delay Range (0,16] us : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: CV Applied OK : 2074 out of 2074 Vectors done    26/02/2024 8:51:59 PM    789    0    0    1
0    Serial Media Recovery: Apply Delay Range (64,256] us : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Number of Buffer Cache Full : 0 out of 0 Times done    26/02/2024 8:51:59 PM    789    0        1
100    Serial Media Recovery: Total CV Parsed : 2091 out of 2091 Times done    26/02/2024 8:51:59 PM    790    0    0    1
100    Serial Media Recovery: Number of Wait All Read : 13 out of 13 Times done    26/02/2024 8:51:59 PM    789    0    0    1
100    Serial Media Recovery: Total CV Applied : 2074 out of 2074 Vectors done    26/02/2024 8:51:59 PM    789    0    0    1
0    Serial Media Recovery: Apply Delay Range (64,128] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Apply Delay Range Unkown : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: Number of Redo Cache Copy : 408 out of 408 Entries done    26/02/2024 8:51:59 PM    790    0    0    1
0    Serial Media Recovery: Read Issue Time : 0 out of 0 Microseconds done    26/02/2024 8:51:59 PM    789    0        1
0    Serial Media Recovery: Apply Delay Range (2,4] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: Recovery ID : 1 out of 1 RCVID done    26/02/2024 8:51:59 PM    772    0    0    1
0    Serial Media Recovery: Apply Delay Range (1,2] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: CV Applied Ckpt : 0 out of 0 Vectors done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Apply Delay Range (128,1000] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Apply Delay Range (1,inf) s : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: Process ID : 1 out of 1 PID done    26/02/2024 8:51:59 PM    772    0    0    1
0    Serial Media Recovery: Number of Buffer Retries : 0 out of 0 Times done    26/02/2024 8:51:59 PM    789    0        1
0    Serial Media Recovery: Apply Delay Range (8,16] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Apply Delay Range (16,32] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: CV Applied Stuck : 0 out of 0 Vectors done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: Number of Read Request Issued : 14 out of 14 Times done    26/02/2024 8:51:59 PM    789    0    0    1
100    Serial Media Recovery: Number of Reap No Buffer : 1 out of 1 Times done    26/02/2024 8:51:59 PM    789    0    0    1
100    Serial Media Recovery: Number of Reap Request : 1 out of 1 Times done    26/02/2024 8:51:59 PM    789    0    0    1
0    Serial Media Recovery: Number of Unrcv Condition : 0 out of 0 Times done    26/02/2024 8:51:59 PM    789    0        1
0    Serial Media Recovery: Apply Delay Range (32,64] ms : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
100    Serial Media Recovery: Total Redo Read Bytes : 27404811776 out of 27404811776 Bytes done    26/02/2024 8:51:59 PM    790    0    0    1
0    Serial Media Recovery: Apply Delay Range (16,64] us : 0 out of 0 Counts done    26/02/2024 8:51:59 PM    791    0        1
0    Serial Media Recovery: Number of Buffer Pinged : 0 out of 0 Times done    26/02/2024 8:51:59 PM    789    0        1
100    Serial Media Recovery: Number of CV Cached : 408 out of 408 Entries done    26/02/2024 8:51:59 PM    790    0    0    1
100    Serial Media Recovery: Number of Influx Buffer Flushed : 40 out of 40 Times done    26/02/2024 8:51:59 PM    789    0    0    1
0    Serial Media Recovery: Number of Max Reads Issued : 0 out of 0 Times done    26/02/2024 8:51:59 PM    789    0        1
 


 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/493490.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

图形系统开发实战课程:进阶篇(上)——7.图形交互操作: 视点控制与动画

图形开发学院|GraphAnyWhere 课程名称:图形系统开发实战课程:进阶篇(上)课程章节:“图形交互操作: 视点控制与动画”原文地址:https://www.graphanywhere.com/graph/advanced/2-7.html 第七章 图形交互操作: 视点控制与…

【精品】OnlyOffice 8.0 版本深度测评

引言 官网链接: ONLYOFFICE 官方网址 OnlyOffice 是一套全面的开源办公协作软件,旨在为用户提供强大、便捷和安全的文档处理和协作环境。最新发布的 OnlyOffice 8.0 版本带来了一系列引人瞩目的新特性和功能改进,进一步提升了其在功能丰富性…

BIO实战、NIO编程与直接内存、零拷贝深入辨析

BIO实战、NIO编程与直接内存、零拷贝深入辨析 长连接、短连接 长连接 socket连接后不管是否使用都会保持连接状态多用于操作频繁,点对点的通讯,避免频繁socket创建造成资源浪费,比如TCP 短连接 socket连接后发送完数据后就断开早期的http服…

prometheus+grafana监控nginx的简单实现

1.编译安装NGINX 加入编译安装nginx-module-vts模块,目的是为了获取更多的监控数据(虚拟主机,upstream等) nginx下载 http://nginx.org/download/nginx-1.20.2.tar.gz nginx-module-vts下载 https://github.com/vozlt/nginx-module-vts/archive/refs/tags/v0.2…

自动驾驶---行业发展及就业环境杂谈

进入21世纪以来,自动驾驶行业有着飞速的发展,自动驾驶技术(L2---L3)也逐渐落地量产到寻常百姓家。虽然最早期量产FSD的特斯拉有着深厚的技术积累,但是进入2010年以后,国内的公司也逐渐发展起来自己的自动驾…

WebSocket实现聊天

基于webSocket通信的库主要有 socket.io,SockJS,这次用的是 SockJS。 这里我们使用sockjs-client、stomjs这两个模块,要实现webSocket通信,需要后台配合,也使用相应的模块。 WebSocket 1、http:http超文…

2024-2-26-进程线程通信作业

课上代码&#xff1a; sem.h #ifndef _SEM_H_ #define _SEM_H_int open_sem(int semcount); int P(int semid,int semno); int V(int semid,int semno); int del_sem(int semid);#endif sem.c #include <myhead.h> union semun {int val;struct semid_ds *buf;unsign…

【web APIs】1、(学习笔记)有案例!

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、概念二、使用步骤1.获取DOM对象2.操作元素内容3.属性修改3.1.常用属性修改3.2.控制样式属性3.3.操作类名(className) 操作CSS3.4.操作表单元素属性3.5.自定…

【深入理解设计模式】建造者设计模式

建造者设计模式 建造者设计模式&#xff08;Builder Pattern&#xff09;是一种创建型设计模式&#xff0c;旨在通过将复杂对象的构建过程拆分成多个简单的步骤&#xff0c;使得相同的构建过程可以创建不同的表示。该模式允许您使用相同的构建过程来创建不同的对象表示。 概述…

Leetcode刷题笔记题解(C++):6. Z 字形变换

思路&#xff1a;遍历时候需要更新步进长度 到达0行的时候步进长度为1&#xff1b;到达最后一行numRows-1行的时候步进长度为-1&#xff1b;代码如下所示&#xff1a; class Solution { public:string convert(string s, int numRows) {//如果字符串长度为1或者所给行数为1 …

[c++] char * 和 std::string

1 char * 和 std::string 的区别 char * 字符串是常量字符串&#xff0c;不能修改&#xff1b;std::string 指向的字符串可以修改 实例代码如下图所示&#xff0c;s1 和 s2 均是常量字符串&#xff0c;字符串常量保存在只读数据区&#xff0c;是只读的&#xff0c;不能写&…

Unity类银河恶魔城学习记录7-9 P75 Saw spin sword源代码

Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释&#xff0c;可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili Sword_Skill_Controller.cs using System.Collections; using System.Col…