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