1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
RMAN> backup database plus archivelog;
Starting backup at 09-NOV-21
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=55 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=2 STAMP=1088140117
input archived log thread=1 sequence=9 RECID=1 STAMP=1088140117
input archived log thread=1 sequence=10 RECID=3 STAMP=1088140119
input archived log thread=1 sequence=11 RECID=4 STAMP=1088140119
input archived log thread=1 sequence=12 RECID=5 STAMP=1088140149
input archived log thread=1 sequence=13 RECID=6 STAMP=1088140149
input archived log thread=1 sequence=14 RECID=7 STAMP=1088140149
input archived log thread=1 sequence=15 RECID=8 STAMP=1088140150
input archived log thread=1 sequence=16 RECID=9 STAMP=1088143059
input archived log thread=1 sequence=17 RECID=10 STAMP=1088143061
input archived log thread=1 sequence=18 RECID=11 STAMP=1088143064
input archived log thread=1 sequence=19 RECID=12 STAMP=1088143064
input archived log thread=1 sequence=20 RECID=13 STAMP=1088144664
input archived log thread=1 sequence=21 RECID=14 STAMP=1088145096
input archived log thread=1 sequence=22 RECID=15 STAMP=1088145757
input archived log thread=1 sequence=23 RECID=16 STAMP=1088145772
input archived log thread=1 sequence=24 RECID=17 STAMP=1088148296
input archived log thread=1 sequence=25 RECID=18 STAMP=1088148660
input archived log thread=1 sequence=26 RECID=19 STAMP=1088148675
input archived log thread=1 sequence=27 RECID=20 STAMP=1088148871
input archived log thread=1 sequence=28 RECID=21 STAMP=1088148887
input archived log thread=1 sequence=29 RECID=22 STAMP=1088150482
input archived log thread=1 sequence=30 RECID=23 STAMP=1088150486
input archived log thread=1 sequence=31 RECID=24 STAMP=1088150489
input archived log thread=1 sequence=32 RECID=25 STAMP=1088150490
input archived log thread=1 sequence=33 RECID=26 STAMP=1088150492
input archived log thread=1 sequence=34 RECID=27 STAMP=1088150539
input archived log thread=1 sequence=35 RECID=28 STAMP=1088150562
input archived log thread=1 sequence=36 RECID=29 STAMP=1088150728
input archived log thread=1 sequence=37 RECID=30 STAMP=1088150743
input archived log thread=1 sequence=38 RECID=31 STAMP=1088150800
input archived log thread=1 sequence=39 RECID=32 STAMP=1088152564
input archived log thread=1 sequence=40 RECID=33 STAMP=1088152579
input archived log thread=1 sequence=41 RECID=34 STAMP=1088153341
channel ORA_DISK_1: starting piece 1 at 09-NOV-21
channel ORA_DISK_1: finished piece 1 at 09-NOV-21
piece handle=/data/TESTPDB/backup/180dnpnu_1_1 tag=TAG20211109T084902 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 09-NOV-21
Starting backup at 09-NOV-21
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/app/oracle/oradata/TESTDB/system01.dbf
input datafile file number=00003 name=/data/app/oracle/oradata/TESTDB/sysaux01.dbf
input datafile file number=00004 name=/data/app/oracle/oradata/TESTDB/undotbs01.dbf
input datafile file number=00007 name=/data/app/oracle/oradata/TESTDB/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-NOV-21
channel ORA_DISK_1: finished piece 1 at 09-NOV-21
piece handle=/data/TESTPDB/backup/190dnpnv_1_1 tag=TAG20211109T084903 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/data/app/oracle/oradata/TESTDB/TESTPDB/sysaux01.dbf
input datafile file number=00009 name=/data/app/oracle/oradata/TESTDB/TESTPDB/system01.dbf
input datafile file number=00011 name=/data/app/oracle/oradata/TESTDB/TESTPDB/undotbs01.dbf
input datafile file number=00012 name=/data/app/oracle/oradata/TESTDB/TESTPDB/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-NOV-21
channel ORA_DISK_1: finished piece 1 at 09-NOV-21
piece handle=/data/TESTPDB/backup/1a0dnpo7_1_1 tag=TAG20211109T084903 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/data/app/oracle/oradata/TESTDB/pdbseed/sysaux01.dbf
input datafile file number=00005 name=/data/app/oracle/oradata/TESTDB/pdbseed/system01.dbf
input datafile file number=00008 name=/data/app/oracle/oradata/TESTDB/pdbseed/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 09-NOV-21
channel ORA_DISK_1: finished piece 1 at 09-NOV-21
piece handle=/data/TESTPDB/backup/1b0dnpoa_1_1 tag=TAG20211109T084903 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 09-NOV-21
Starting backup at 09-NOV-21
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=42 RECID=35 STAMP=1088153357
channel ORA_DISK_1: starting piece 1 at 09-NOV-21
channel ORA_DISK_1: finished piece 1 at 09-NOV-21
piece handle=/data/TESTPDB/backup/1c0dnpod_1_1 tag=TAG20211109T084917 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 09-NOV-21
Starting Control File and SPFILE Autobackup at 09-NOV-21
piece handle=/data/app/oracle/product/19C/dbhome_3/dbs/c-2870051281-20211109-04 comment=NONE
Finished Control File and SPFILE Autobackup at 09-NOV-21
[oracle@dba 19C]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Tue Nov 9 08:48:36 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: TESTDB (DBID=2870051281)
[oracle@dba 19C]$ sqlplus NAS2/abc123@TESTPDB
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 9 08:49:45 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Last Successful login time: Tue Nov 09 2021 08:47:14 +05:30
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> alter session set nls_date_format = 'dd/mm/yyyy hh24:mi:ss';
Session altered.
SQL> select sysdate from dual;
SYSDATE
-------------------
09/11/2021 08:50:25
SQL> drop table test;
Table dropped.
RMAN> recover table 'NAS2'.'TEST'of pluggable database TESTPDB until time "to_date('09/11/2021 08:50:25',' dd/mm/yyyy hh24:mi:ss')" AUXILIARY DESTINATION '/data/tempdata/TESTPDB';
SQL> SELECT DBMS_FLASHBACK.get_system_change_number FROM dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
2364401
recover table 'NAS2'.'TEST' of pluggable database TESTPDB UNTIL SCN 2364401 AUXILIARY DESTINATION '/data/tempdata/TESTPDB';
Starting recover at 09-NOV-21
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 42 is already on disk as file /data/app/oracle/product/19C/dbhome _3/dbs/arch/1_42_1086723155.dbf
archived log for thread 1 with sequence 43 is already on disk as file /data/app/oracle/product/19C/dbhome _3/dbs/arch/1_43_1086723155.dbf
archived log file name=/data/app/oracle/product/19C/dbhome_3/dbs/arch/1_42_1086723155.dbf thread=1 sequen ce=42
archived log file name=/data/app/oracle/product/19C/dbhome_3/dbs/arch/1_43_1086723155.dbf thread=1 sequen ce=43
media recovery complete, elapsed time: 00:00:00
Finished recover at 09-NOV-21
sql statement: alter database open read only
contents of Memory Script:
{
sql clone 'alter pluggable database TESTPDB open read only';
}
executing Memory Script
sql statement: alter pluggable database TESTPDB open read only
contents of Memory Script:
{
sql clone "create spfile from memory";
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set control_files =
''/data/tempdata/TESTPDB/TESTDB/controlfile/o1_mf_jrmx5bsg_.ctl'' comment=
''RMAN set'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
# mount database
sql clone 'alter database mount clone database';
}
executing Memory Script
sql statement: create spfile from memory
database closed
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1157627656 bytes
Fixed Size 9133832 bytes
Variable Size 301989888 bytes
Database Buffers 838860800 bytes
Redo Buffers 7643136 bytes
sql statement: alter system set control_files = ''/data/tempdata/TESTPDB/TESTDB/controlfile/o1_mf_jrmx 5bsg_.ctl'' comment= ''RMAN set'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1157627656 bytes
Fixed Size 9133832 bytes
Variable Size 301989888 bytes
Database Buffers 838860800 bytes
Redo Buffers 7643136 bytes
sql statement: alter database mount clone database
contents of Memory Script:
{
# set requested point in time
set until time "to_date('09/11/2021 08:50:25','dd/mm/yyyy hh24:mi:ss')";
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile 12 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 12;
switch clone datafile all;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
Starting restore at 09-NOV-21
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=34 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00012 to /data/tempdata/TESTPDB/EZSF_PITR_TESTPDB_TESTDB/CF06C 16067FD5873E053C500A8C0584B/datafile/o1_mf_users_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /data/TESTPDB/backup/1a0dnpo7_1_1
channel ORA_AUX_DISK_1: piece handle=/data/TESTPDB/backup/1a0dnpo7_1_1 tag=TAG20211109T084903
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 09-NOV-21
datafile 12 switched to datafile copy
input datafile copy RECID=17 STAMP=1088156497 file name=/data/tempdata/TESTPDB/EZSF_PITR_TESTPDB_TESTDB/C F06C16067FD5873E053C500A8C0584B/datafile/o1_mf_users_jrmx7r4o_.dbf
contents of Memory Script:
{
# set requested point in time
set until time "to_date('09/11/2021 08:50:25','dd/mm/yyyy hh24:mi:ss')";
# online the datafiles restored or switched
sql clone 'TESTPDB' "alter database datafile
12 online";
# recover and open resetlogs
recover clone database tablespace "TESTPDB":"USERS", "SYSTEM", "TESTPDB":"SYSTEM", "UNDOTBS1", "TESTPDB" :"UNDOTBS1", "SYSAUX", "TESTPDB":"SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script
executing command: SET until clause
sql statement: alter database datafile 12 online
Starting recover at 09-NOV-21
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 42 is already on disk as file /data/app/oracle/product/19C/dbhome _3/dbs/arch/1_42_1086723155.dbf
archived log for thread 1 with sequence 43 is already on disk as file /data/app/oracle/product/19C/dbhome _3/dbs/arch/1_43_1086723155.dbf
archived log file name=/data/app/oracle/product/19C/dbhome_3/dbs/arch/1_42_1086723155.dbf thread=1 sequen ce=42
archived log file name=/data/app/oracle/product/19C/dbhome_3/dbs/arch/1_43_1086723155.dbf thread=1 sequen ce=43
media recovery complete, elapsed time: 00:00:00
Finished recover at 09-NOV-21
database opened
contents of Memory Script:
{
sql clone 'alter pluggable database TESTPDB open';
}
executing Memory Script
sql statement: alter pluggable database TESTPDB open
contents of Memory Script:
{
# create directory for datapump import
sql 'TESTPDB' "create or replace directory
TSPITR_DIROBJ_DPDIR as ''
/data/tempdata/TESTPDB''";
# create directory for datapump export
sql clone 'TESTPDB' "create or replace directory
TSPITR_DIROBJ_DPDIR as ''
/data/tempdata/TESTPDB''";
}
executing Memory Script
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/data/tempdata/TESTPDB''
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/data/tempdata/TESTPDB''
Performing export of tables...
EXPDP> Starting "SYS"."TSPITR_EXP_Ezsf_qaFb":
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
EXPDP> . . exported "NAS2"."TEST" 5.554 KB 4 rows
EXPDP> Master table "SYS"."TSPITR_EXP_Ezsf_qaFb" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_Ezsf_qaFb is:
EXPDP> /data/tempdata/TESTPDB/tspitr_Ezsf_48446.dmp
EXPDP> Job "SYS"."TSPITR_EXP_Ezsf_qaFb" successfully completed at Tue Nov 9 09:42:13 2021 elapsed 0 00 :00:13
Export completed
contents of Memory Script:
{
# shutdown clone before import
shutdown clone abort
}
executing Memory Script
Oracle instance shut down
Performing import of tables...
IMPDP> Master table "SYS"."TSPITR_IMP_Ezsf_jgje" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_Ezsf_jgje":
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
IMPDP> . . imported "NAS2"."TEST" 5.554 KB 4 rows
IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
IMPDP> Job "SYS"."TSPITR_IMP_Ezsf_jgje" successfully completed at Tue Nov 9 09:42:23 2021 elapsed 0 00 :00:04
Import completed
Removing automatic instance
Automatic instance removed
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/CF06C16067FD5873E053C500A8C0584B/datafile/o1_mf_tem p_jrmx5x4v_.tmp deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/datafile/o1_mf_temp_jrmx5vj0_.tmp deleted
auxiliary instance file /data/tempdata/TESTPDB/EZSF_PITR_TESTPDB_TESTDB/onlinelog/o1_mf_3_jrmx7twd_.log d eleted
auxiliary instance file /data/tempdata/TESTPDB/EZSF_PITR_TESTPDB_TESTDB/onlinelog/o1_mf_2_jrmx7t2k_.log d eleted
auxiliary instance file /data/tempdata/TESTPDB/EZSF_PITR_TESTPDB_TESTDB/onlinelog/o1_mf_1_jrmx7syq_.log d eleted
auxiliary instance file /data/tempdata/TESTPDB/EZSF_PITR_TESTPDB_TESTDB/CF06C16067FD5873E053C500A8C0584B/ datafile/o1_mf_users_jrmx7r4o_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/CF06C16067FD5873E053C500A8C0584B/datafile/o1_mf_sys aux_jrmx5qc6_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/datafile/o1_mf_sysaux_jrmx5j9n_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/CF06C16067FD5873E053C500A8C0584B/datafile/o1_mf_und otbs1_jrmx5qc9_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/datafile/o1_mf_undotbs1_jrmx5j9p_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/CF06C16067FD5873E053C500A8C0584B/datafile/o1_mf_sys tem_jrmx5qc8_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/datafile/o1_mf_system_jrmx5j9k_.dbf deleted
auxiliary instance file /data/tempdata/TESTPDB/TESTDB/controlfile/o1_mf_jrmx5bsg_.ctl deleted
auxiliary instance file tspitr_Ezsf_48446.dmp deleted
Finished recover at 09-NOV-21
RMAN>
[oracle@dba ~]$ sqlplus NAS2/abc123@TESTPDB
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 9 11:33:34 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Last Successful login time: Tue Nov 09 2021 09:02:13 +05:30
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select * from test;
SERIAL NAME
---------- -----
1 One
2 Two
3 Three
4 Four
SQL>
RMAN> recover table'NAS2'.'TEST' of pluggable database TESTPDB UNTIL SCN 2364401 AUXILIARY DESTINATION '/data/tempdata/TESTDB' DATAPUMP DESTINATION '/tempdata/export' DUMP FILE 'TEST_TABLE.dmp' NOTABLEIMPORT;
RMAN> recover table'NAS2'.'TEST' of pluggable database TESTPDB until time "to_date('04/11/2020 22:59:12','dd/mm/yyyy hh24:mi:ss')" AUXILIARY DESTINATION '/data/tempdata/TESTPDB' REMAP TABLE 'NAS2'.'TEST':'TEST_BCK';
RMAN> recover table 'NAS2.'TEST' of pluggable database TESTPDB until time "to_date(''04/11/2020 22:59:12'','dd/mm/yyyy hh24:mi:ss')" AUXILIARY DESTINATION '/data/tempdata/TESTDB' REMAP TABLE 'NAS2'.'TEST':'EXPERT'TEST_BCK' REMAP TABLESPACE 'TS_NAS2':'TS_OTHER';