create controlfile重建控制文件报 ORA-01503 ORA-01565 restore resetlogs cdb 后还可以继续recover pdb

重建控制文件需要数据文件已在目标位置,控制文件中的数据文件可以少,但不能多(之前写过少了数据文件后重新添加的办法)。

这样如果备份的时候没有备份spfile和控制文件,spfile可以完全新建,controlfile不能完全重建,因为这时候还没有恢复数据文件。

所以一定要有一个控制文件的备份才可以恢复。否则就要用dbms包先恢复数据文件。



在重建控制文件
CREATE CONTROLFILE REUSE DATABASE "DBTEST" NORESETLOGS  ARCHIVELOG
...
时报以下错误:
ORA-01503: CREATE CONTROLFILE failed
ORA-01565: error in identifying file '/data/u02/oradata/dbtest/system01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

这个报错的信息告诉你,create controlfile的时候要去读数据文件的信息,而此时如果数据文件不存在,或不可访问就会报这个错.
刚开始不确定create controlfile时会去读数据文件信息,所以怀疑是报错信息不准确,一直以为是create controlfile语句的语法错误.
最后查create controlfile的说明,http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_5003.htm#SQLRF01203,看到
DATAFILE Clause
Specify the data files of the database. You must list all data files. These files must all exist, although they may be restored backups that require media recovery.
Do not include in the DATAFILE clause any data files in read-only tablespaces. You can add these types of files to the database later. Also, do not include in this clause any temporary data files (temp files).
才发现,原来create controlfile时数据文件就要存在了,而且是可访问的.

------数据文件在的时候新建controlfile

 SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS;

[oracle@rac1 ~]$ cd /u01/app/oracle/diag/rdbms/cdb/cdb1/trace
[oracle@rac1 trace]$ vi cdb1_dia0_7315_base_1.trc
[oracle@rac1 trace]$ vi cdb1_ora_3351.trc
[oracle@rac1 trace]$ s
SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO

----恢复很久之前删除的pdb----
SQL> recover pluggable database pdb  until time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';
ORA-00905: missing keyword


[oracle@rac1 trace]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 01:21:59 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> recover pluggable database pdb  until time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';

Starting recover at 01-JUL-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=435 instance=cdb1 device type=DISK
RMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1
Tablespace UNDOTBS2
Tablespace UNDOTBS3

Creating automatic instance, with SID='bavB'

initialization parameters used for automatic instance:
db_name=CDB
db_unique_name=bavB_pitr_pdb_CDB
compatible=19.0.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_pdb_name_case_sensitive=false
_system_trig_enabled=FALSE
db_domain=cj.com
sga_target=580M
processes=200
db_create_file_dest=+data1
log_archive_dest_1='location=+data1'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance CDB

Oracle instance started

Total System Global Area     608173368 bytes

Fixed Size                     9166136 bytes
Variable Size                213909504 bytes
Database Buffers             377487360 bytes
Redo Buffers                   7610368 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# restore the controlfile
restore clone controlfile;
 
# mount the controlfile
sql clone 'alter database mount clone database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 01-JUL-24
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=187 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093 tag=TAG20240616T123452
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA1/CDB/CONTROLFILE/current.278.1173014533
Finished restore at 01-JUL-24

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  4 to new;
set newname for clone datafile  9 to new;
set newname for clone datafile  10 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  7 to new;
set newname for datafile  11 to new;
set newname for datafile  12 to new;
set newname for datafile  13 to new;
set newname for datafile  14 to new;
set newname for datafile  15 to new;
set newname for datafile  16 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 4, 9, 10, 3, 7, 11, 12, 13, 14, 15, 16;
 
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 01-JUL-24
using channel ORA_AUX_DISK_1

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 00001 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00004 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00009 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00010 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00003 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00007 to +data1
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
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 00011 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00012 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00013 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00014 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00015 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00016 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 01-JUL-24

datafile 11 switched to datafile copy
input datafile copy RECID=37 STAMP=1173144220 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585
datafile 12 switched to datafile copy
input datafile copy RECID=38 STAMP=1173144220 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585
datafile 13 switched to datafile copy
input datafile copy RECID=39 STAMP=1173144220 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585
datafile 14 switched to datafile copy
input datafile copy RECID=40 STAMP=1173144220 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585
datafile 15 switched to datafile copy
input datafile copy RECID=41 STAMP=1173144220 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585
datafile 16 switched to datafile copy
input datafile copy RECID=42 STAMP=1173144220 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585
datafile 1 switched to datafile copy
input datafile copy RECID=43 STAMP=1173144220 file name=+DATA1/CDB/DATAFILE/system.267.1173014541
datafile 4 switched to datafile copy
input datafile copy RECID=44 STAMP=1173144220 file name=+DATA1/CDB/DATAFILE/undotbs1.308.1173014541
datafile 9 switched to datafile copy
input datafile copy RECID=45 STAMP=1173144220 file name=+DATA1/CDB/DATAFILE/undotbs2.324.1173014541
datafile 10 switched to datafile copy
input datafile copy RECID=46 STAMP=1173144220 file name=+DATA1/CDB/DATAFILE/undotbs3.322.1173014541
datafile 3 switched to datafile copy
input datafile copy RECID=47 STAMP=1173144220 file name=+DATA1/CDB/DATAFILE/sysaux.321.1173014541
datafile 7 switched to datafile copy
input datafile copy RECID=48 STAMP=1173144220 file name=+DATA1/CDB/DATAFILE/users.309.1173014541

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  4 online";
sql clone "alter database datafile  9 online";
sql clone "alter database datafile  10 online";
sql clone "alter database datafile  3 online";
sql clone "alter database datafile  7 online";
sql clone 'PDB' "alter database datafile 
 11 online";
sql clone 'PDB' "alter database datafile 
 12 online";
sql clone 'PDB' "alter database datafile 
 13 online";
sql clone 'PDB' "alter database datafile 
 14 online";
sql clone 'PDB' "alter database datafile 
 15 online";
sql clone 'PDB' "alter database datafile 
 16 online";
#recover pdb
recover clone database tablespace  "SYSTEM", "UNDOTBS1", "UNDOTBS2", "UNDOTBS3", "SYSAUX", "USERS" pluggable database 
 'PDB'  delete archivelog;
#open in read write mode
sql clone 'alter database open resetlogs';
#unplug dropped pdb into temp file
sql clone "alter pluggable database PDB unplug into ''
/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_6_bavB.xml''";
#create pdb using temp file of recovered pdb
sql "create pluggable database PDB using ''
/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_6_bavB.xml'' nocopy tempfile reuse";
alter pluggable database PDB open;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  4 online

sql statement: alter database datafile  9 online

sql statement: alter database datafile  10 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  7 online

sql statement: alter database datafile  11 online

sql statement: alter database datafile  12 online

sql statement: alter database datafile  13 online

sql statement: alter database datafile  14 online

sql statement: alter database datafile  15 online

sql statement: alter database datafile  16 online

Starting recover at 01-JUL-24
using channel ORA_AUX_DISK_1

Executing: alter database datafile 5, 6, 8 offline
starting media recovery

archived log for thread 3 with sequence 6 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091
archived log for thread 3 with sequence 7 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091 thread=3 sequence=6
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027 thread=3 sequence=7
media recovery complete, elapsed time: 00:00:01
Finished recover at 01-JUL-24

sql statement: alter database open resetlogs

sql statement: alter pluggable database PDB unplug into ''/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_6_bavB.xml''

sql statement: create pluggable database PDB using ''/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_6_bavB.xml'' nocopy tempfile reuse

Statement processed

Removing automatic instance
shutting down automatic instance 
Oracle instance shut down
Automatic instance removed
auxiliary instance file /u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_6_bavB.xml deleted
auxiliary instance file +DATA1/CDB/DATAFILE/sysaux.321.1173014541 deleted
auxiliary instance file +DATA1/CDB/CONTROLFILE/current.278.1173014533 deleted
Finished recover at 01-JUL-24

RMAN> exit


Recovery Manager complete.
[oracle@rac1 trace]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 01:24:23 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE NO
SQL> alter session set container=pdb; 

Session altered.

SQL> select *From abc;

DT
---------
16-JUN-24

----重建空间文件

SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS;

Database altered. 

SQL> col value for a50
SQL> set lines 9999
SQL> select *from v$diag_info;
rows will be truncated

    INST_ID NAME                                                             VALUE                                                  CON_ID
---------- ---------------------------------------------------------------- -------------------------------------------------- ----------
         3 Diag Enabled                                                     TRUE                                                        0
         3 ADR Base                                                         /u01/app/oracle                                             0
         3 ADR Home                                                         /u01/app/oracle/diag/rdbms/cdb/cdb1                         0
         3 Diag Trace                                                       /u01/app/oracle/diag/rdbms/cdb/cdb1/trace                   0
         3 Diag Alert                                                       /u01/app/oracle/diag/rdbms/cdb/cdb1/alert                   0
         3 Diag Incident                                                    /u01/app/oracle/diag/rdbms/cdb/cdb1/incident                0
         3 Diag Cdump                                                       /u01/app/oracle/diag/rdbms/cdb/cdb3/cdump                   0
         3 Health Monitor                                                   /u01/app/oracle/diag/rdbms/cdb/cdb1/hm                      0
         3 Default Trace File                                               /u01/app/oracle/diag/rdbms/cdb/cdb1/trace/cdb1_ora          0
         3 Active Problem Count                                             5                                                           0
         3 Active Incident Count                                            359                                                         0

   INST_ID NAME                                                             VALUE                                                  CON_ID
---------- ---------------------------------------------------------------- -------------------------------------------------- ----------
         3 ORACLE_HOME                                                      /u01/app/oracle/product/19.0.0/db_1                         0

12 rows selected.

[oracle@rac1 trace]$ vi cdb1_ora_13070.trc
[oracle@rac1 trace]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 01:27:48 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> startup force mount;
ORACLE instance started.

Total System Global Area  608170680 bytes
Fixed Size                  9167544 bytes
Variable Size             557842432 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes
Database mounted.
SQL> startup nomount force;
ORACLE instance started.

Total System Global Area  608170680 bytes
Fixed Size                  9167544 bytes
Variable Size             557842432 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/CDB/ONLINELOG/group_1.331.1171775239',
 10      '+DATA1/CDB/ONLINELOG/group_1.361.1171775241'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/CDB/ONLINELOG/group_2.338.1171775239',
 14      '+DATA1/CDB/ONLINELOG/group_2.365.1171775241'
 15    ) SIZE 50M BLOCKSIZE 512
 16  -- STANDBY LOGFILE
 17  DATAFILE
 18    '+DATA/CDB/DATAFILE/system.258.1171797291',
 19    '+DATA/CDB/DATAFILE/sysaux.287.1171797291',
 20    '+DATA/CDB/DATAFILE/undotbs1.302.1171797291',
 21    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313',
 22    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313',
 23    '+DATA/CDB/DATAFILE/users.259.1171797291',
 24    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313',
 25    '+DATA/CDB/DATAFILE/undotbs2.290.1171797291',
 26    '+DATA/CDB/DATAFILE/undotbs3.276.1171797291',
 27    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585',
 28    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585',
 29    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585',
 30    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585',
 31    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585',
 32    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585'
 33  CHARACTER SET AL32UTF8
 34  ;
CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-12720: operation requires database is in EXCLUSIVE mode


SQL>  alter system set cluster_database=false scope=spfile;

System altered.

SQL> startup nomount force;
ORACLE instance started.

Total System Global Area  574615864 bytes
Fixed Size                  9167160 bytes
Variable Size             524288000 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes
SQL> 
SQL> CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/CDB/ONLINELOG/group_1.331.1171775239',
 10      '+DATA1/CDB/ONLINELOG/group_1.361.1171775241'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/CDB/ONLINELOG/group_2.338.1171775239',
 14      '+DATA1/CDB/ONLINELOG/group_2.365.1171775241'
 15    ) SIZE 50M BLOCKSIZE 512
 16  -- STANDBY LOGFILE
 17  DATAFILE
 18    '+DATA/CDB/DATAFILE/system.258.1171797291',
 19    '+DATA/CDB/DATAFILE/sysaux.287.1171797291',
 20    '+DATA/CDB/DATAFILE/undotbs1.302.1171797291',
 21    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313',
 22    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313',
 23    '+DATA/CDB/DATAFILE/users.259.1171797291',
 24    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313',
 25    '+DATA/CDB/DATAFILE/undotbs2.290.1171797291',
 26    '+DATA/CDB/DATAFILE/undotbs3.276.1171797291',
 27    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585',
 28    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585',
 29    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585',
 30    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585',
 31    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585',
 32    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585'
 33  CHARACTER SET AL32UTF8
 34  ;

Control file created.

SQL> startup force ;
ORACLE instance started.

Total System Global Area  574615864 bytes
Fixed Size                  9167160 bytes
Variable Size             524288000 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '+DATA/CDB/DATAFILE/system.258.1171797291'

-----上面是shutdown abort关闭的,需要在线redo恢复
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done


SQL>  recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00308: cannot open archived log '+DATA1'
ORA-17503: ksfdopn:2 Failed to open file +DATA1
ORA-15045: ASM file name '+DATA1' is not in reference form


ORA-00308: cannot open archived log '+DATA1'
ORA-17503: ksfdopn:2 Failed to open file +DATA1
ORA-15045: ASM file name '+DATA1' is not in reference form


SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '+DATA/CDB/DATAFILE/system.258.1171797291'


SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done


SQL>  recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00308: cannot open archived log '+DATA1'
ORA-17503: ksfdopn:2 Failed to open file +DATA1
ORA-15045: ASM file name '+DATA1' is not in reference form


SQL> exit      
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 trace]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 01:31:47 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> recover database;

Starting recover at 01-JUL-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1184 device type=DISK

starting media recovery

unable to find archived log
archived log thread=3 sequence=43
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 01:31:55
RMAN-06054: media recovery requesting unknown archived log for thread 3 with sequence 43 and starting SCN of 9047619

RMAN> exit

------常规方法恢复不了---------------------------------------------online redo的重要性---
Recovery Manager complete.
[oracle@rac1 trace]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 01:32:43 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_1.331.1171775239
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_1.331.1171775239'


SQL>  recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_2.338.1171775239
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_2.338.1171775239'


SQL> recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_3.341.1171775239
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_3.341.1171775239'


SQL> recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_4.349.1171775241
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_4.349.1171775241'


SQL>  recover database using backup controlfile;
ORA-00279: change 9047619 generated at 06/30/2024 13:00:47 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9047619 for thread 3 is in sequence #43


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_5.359.1171775243
Log applied.
Media recovery complete.

-----所有redo都试一遍


SQL> alter database open resetlogs;

Database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
SQL> alter pluggable database pdb open;


SQL> alter session set container=pdb;

Session altered.

SQL> select *from abc;

DT
---------
16-JUN-24

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 trace]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 01:35:31 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0


SQL> startup nomount force;
ORACLE instance started.

Total System Global Area  574615864 bytes
Fixed Size                  9167160 bytes
Variable Size             524288000 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes

CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG

set 有没有都可以的

SQL>  CREATE CONTROLFILE REUSE set DATABASE "CDB" RESETLOGS
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/CDB/ONLINELOG/group_1.302.1148478739',
 10      '+DATA/CDB/ONLINELOG/group_1.266.1148478739'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/CDB/ONLINELOG/group_2.301.1148478739',
 14      '+DATA/CDB/ONLINELOG/group_2.274.1148478739'
 15    ) SIZE 50M BLOCKSIZE 512,
 16    GROUP 3 (
 17      '+DATA/CDB/ONLINELOG/group_3.270.1148481315',
 18      '+DATA/CDB/ONLINELOG/group_3.261.1148481315'
 19    ) SIZE 50M BLOCKSIZE 512,
 20    GROUP 4 (
 21      '+DATA/CDB/ONLINELOG/group_4.260.1148481315',
 22      '+DATA/CDB/ONLINELOG/group_4.298.1148481315'
 23    ) SIZE 50M BLOCKSIZE 512,
 24    GROUP 5 (
 25      '+DATA/CDB/ONLINELOG/group_5.259.1148481315',
 26      '+DATA/CDB/ONLINELOG/group_5.276.1148481317'
 27    ) SIZE 50M BLOCKSIZE 512,
 28    GROUP 6 (
 29      '+DATA/CDB/ONLINELOG/group_6.294.1148481317',
 30      '+DATA/CDB/ONLINELOG/group_6.287.1148481317'
 31    ) SIZE 50M BLOCKSIZE 512
 32  -- STANDBY LOGFILE
 33  DATAFILE
 34  '+DATA/CDB/DATAFILE/system.258.1171797291',
 35    '+DATA/CDB/DATAFILE/sysaux.287.1171797291',
 36    '+DATA/CDB/DATAFILE/undotbs1.302.1171797291',
 37    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313',
 38    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313',
 39    '+DATA/CDB/DATAFILE/users.259.1171797291',
 40    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313',
 41    '+DATA/CDB/DATAFILE/undotbs2.290.1171797291',
 42    '+DATA/CDB/DATAFILE/undotbs3.276.1171797291',
 43    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585',
 44    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585',
 45    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585',
 46    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585',
 47    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585',
 48    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585'
 49  CHARACTER SET AL32UTF8
 50  ;

Control file created.

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '+DATA/CDB/DATAFILE/system.258.1171797291'


SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done


SQL> recover database using backup controfile;
ORA-00905: missing keyword


SQL> recover database using backup controlfile;
ORA-00279: change 9051787 generated at 07/01/2024 01:34:17 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9051787 for thread 3 is in sequence #1


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00308: cannot open archived log '+DATA1'
ORA-17503: ksfdopn:2 Failed to open file +DATA1
ORA-15045: ASM file name '+DATA1' is not in reference form


SQL> recover database using backup controlfile;
ORA-00279: change 9051787 generated at 07/01/2024 01:34:17 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9051787 for thread 3 is in sequence #1


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_5.359.1171775243
ORA-00342: archived log does not have expected resetlogs SCN 9051784
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_5.359.1171775243'


SQL>  recover database using backup controlfile;
ORA-00279: change 9051787 generated at 07/01/2024 01:34:17 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9051787 for thread 3 is in sequence #1


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_6.346.1171775243
ORA-00342: archived log does not have expected resetlogs SCN 9051784
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_6.346.1171775243'


SQL> recover database using backup controlfile;
ORA-00279: change 9051787 generated at 07/01/2024 01:34:17 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9051787 for thread 3 is in sequence #1


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_1.331.1171775239
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_1.331.1171775239'


SQL> recover database using backup controlfile;
ORA-00279: change 9051787 generated at 07/01/2024 01:34:17 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9051787 for thread 3 is in sequence #1


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_2.338.1171775239
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '+DATA/cdb/ONLINELOG/group_2.338.1171775239'


SQL> recover database using backup controlfile;
ORA-00279: change 9051787 generated at 07/01/2024 01:34:17 needed for thread 3
ORA-00289: suggestion : +DATA1
ORA-00280: change 9051787 for thread 3 is in sequence #1


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+data/cdb/ONLINELOG/group_3.263.1173015257
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
SQL> alter pluggable database pdb open resetlogs;
alter pluggable database pdb open resetlogs
*
ERROR at line 1:
ORA-39862: RESETLOGS option only valid after a Pluggable Database incomplete
recovery


SQL> alter pluggable database pdb open;

Pluggable database altered.

SQL> alter session set container=pdb;

Session altered.

SQL>  select *from abc;

DT
---------
16-JUN-24

SQL> exit


Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 trace]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 01:41:54 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN>  recover pluggable database pdb  until time "to_date('16-JUN-2024 11:01:00','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';

Starting recover at 01-JUL-24
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 01:42:07
RMAN-05004: target database log mode is NOARCHIVELOG

RMAN> exit           


Recovery Manager complete.
[oracle@rac1 trace]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 01:42:56 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> shutdown immediate;
startup mount
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 
ORACLE instance started.

Total System Global Area  574615864 bytes
Fixed Size                  9167160 bytes
Variable Size             524288000 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes
Database mounted.
SQL> SQL> alter database archivelog; 

Database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
         3 PDB                            MOUNTED
SQL> alter database open;

Database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
SQL> exit      
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 trace]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 01:45:19 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> recover pluggable database pdb  until time "to_date('16-JUN-2024 11:01:00','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';

Starting recover at 01-JUL-24
using target database control file instead of recovery catalog
current log archived
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 01:45:29
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database incarnation is not allowed.

----resetlog 后不能recover 过去的pdb---是否切换incarnation就可以呢?

---------------------数据文件全部删了试试------------------
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 01:47:31 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> shutdown abort
ORACLE instance shut down.

[root@rac1 ~]# su - grid
Last login: Mon Jul  1 01:46:35 CST 2024 on pts/0
[grid@rac1 ~]$ asmcmd
lASMCMD> s
DATA/
DATA1/
ASMCMD> cd D*a
ASMCMD> ls
ASM/
CDB/
orapwasm
orapwasm_backup
rac-cluster/
ASMCMD> cd CDB
ASMCMD> ls
0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
ASMCMD> cd D*E       
ASMCMD> ls
SYSAUX.287.1171797291
SYSTEM.258.1171797291
UNDOTBS1.302.1171797291
UNDOTBS2.290.1171797291
UNDOTBS3.276.1171797291
USERS.259.1171797291
ASMCMD> cd ../
ASMCMD> ls
0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
ASMCMD> rm -rf DATAFILE
ASMCMD> cd 0633F844101D69CBE0636401A8C09D55
ASMCMD> ls
DATAFILE/
TEMPFILE/
ASMCMD> rm -rf DATAFILE
ASMCMD> cd ../
ASMCMD> ls
0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
CONTROLFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
ASMCMD> cd 06344F62B8C65A17E0636401A8C0F073
ASMCMD> ls
DATAFILE/
ASMCMD> rm -rf D*E
ASMCMD> exit
[grid@rac1 ~]$ exit
logout
[root@rac1 ~]# su - oracle
Last login: Mon Jul  1 01:47:31 CST 2024 on pts/0
[oracle@rac1 ~]$ s
SQL>  startup nomount;
ORACLE instance started.

Total System Global Area  574615864 bytes
Fixed Size                  9167160 bytes
Variable Size             524288000 bytes
Database Buffers           33554432 bytes
Redo Buffers                7606272 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/CDB/ONLINELOG/group_1.331.1171775239',
 10      '+DATA1/CDB/ONLINELOG/group_1.361.1171775241'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/CDB/ONLINELOG/group_2.338.1171775239',
 14      '+DATA1/CDB/ONLINELOG/group_2.365.1171775241'
 15    ) SIZE 50M BLOCKSIZE 512
 16  -- STANDBY LOGFILE
 17  DATAFILE
 18    '+DATA/CDB/DATAFILE/system.258.1171797291',
 19    '+DATA/CDB/DATAFILE/sysaux.287.1171797291',
 20    '+DATA/CDB/DATAFILE/undotbs1.302.1171797291',
 21    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313',
 22    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313',
 23    '+DATA/CDB/DATAFILE/users.259.1171797291',
 24    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313',
 25    '+DATA/CDB/DATAFILE/undotbs2.290.1171797291',
 26    '+DATA/CDB/DATAFILE/undotbs3.276.1171797291',
 27    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585',
 28    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585',
 29    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585',
 30    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585',
 31    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585',
 32    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585'
 33  CHARACTER SET AL32UTF8
 34  ;
CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01565: error in identifying file '+DATA/CDB/DATAFILE/system.258.1171797291'
ORA-17503: ksfdopn:2 Failed to open file
+DATA/CDB/DATAFILE/system.258.1171797291
ORA-15012: ASM file '+DATA/CDB/DATAFILE/system.258.1171797291' does not exist


SQL> 
SQL>  
SQL>  CREATE CONTROLFILE REUSE set DATABASE "CDB" RESETLOGS ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/CDB/ONLINELOG/group_1.302.1148478739',
 10      '+DATA/CDB/ONLINELOG/group_1.266.1148478739'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/CDB/ONLINELOG/group_2.301.1148478739',
 14      '+DATA/CDB/ONLINELOG/group_2.274.1148478739'
 15    ) SIZE 50M BLOCKSIZE 512,
 16    GROUP 3 (
 17      '+DATA/CDB/ONLINELOG/group_3.270.1148481315',
 18      '+DATA/CDB/ONLINELOG/group_3.261.1148481315'
 19    ) SIZE 50M BLOCKSIZE 512,
 20    GROUP 4 (
 21      '+DATA/CDB/ONLINELOG/group_4.260.1148481315',
 22      '+DATA/CDB/ONLINELOG/group_4.298.1148481315'
 23    ) SIZE 50M BLOCKSIZE 512,
 24    GROUP 5 (
 25      '+DATA/CDB/ONLINELOG/group_5.259.1148481315',
 26      '+DATA/CDB/ONLINELOG/group_5.276.1148481317'
 27    ) SIZE 50M BLOCKSIZE 512,
 28    GROUP 6 (
 29      '+DATA/CDB/ONLINELOG/group_6.294.1148481317',
 30      '+DATA/CDB/ONLINELOG/group_6.287.1148481317'
 31    ) SIZE 50M BLOCKSIZE 512
 32  -- STANDBY LOGFILE
 33  DATAFILE
 34  '+DATA/CDB/DATAFILE/system.258.1171797291',
 35    '+DATA/CDB/DATAFILE/sysaux.287.1171797291',
 36    '+DATA/CDB/DATAFILE/undotbs1.302.1171797291',
 37    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313',
 38    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313',
 39    '+DATA/CDB/DATAFILE/users.259.1171797291',
 40    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313',
 41    '+DATA/CDB/DATAFILE/undotbs2.290.1171797291',
 42    '+DATA/CDB/DATAFILE/undotbs3.276.1171797291',
 43    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585',
 44    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585',
 45    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585',
 46    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585',
 47    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585',
 48    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585'
 49  CHARACTER SET AL32UTF8
 50  ;
 CREATE CONTROLFILE REUSE set DATABASE "CDB" RESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01565: error in identifying file '+DATA/CDB/DATAFILE/system.258.1171797291'
ORA-17503: ksfdopn:2 Failed to open file
+DATA/CDB/DATAFILE/system.258.1171797291
ORA-15012: ASM file '+DATA/CDB/DATAFILE/system.258.1171797291' does not exist


SQL> 
SQL>  
SQL>  CREATE CONTROLFILE   set DATABASE "CDB" RESETLOGS ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/CDB/ONLINELOG/group_1.302.1148478739',
 10      '+DATA/CDB/ONLINELOG/group_1.266.1148478739'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/CDB/ONLINELOG/group_2.301.1148478739',
 14      '+DATA/CDB/ONLINELOG/group_2.274.1148478739'
 15    ) SIZE 50M BLOCKSIZE 512,
 16    GROUP 3 (
 17      '+DATA/CDB/ONLINELOG/group_3.270.1148481315',
 18      '+DATA/CDB/ONLINELOG/group_3.261.1148481315'
 19    ) SIZE 50M BLOCKSIZE 512,
 20    GROUP 4 (
 21      '+DATA/CDB/ONLINELOG/group_4.260.1148481315',
 22      '+DATA/CDB/ONLINELOG/group_4.298.1148481315'
 23    ) SIZE 50M BLOCKSIZE 512,
 24    GROUP 5 (
 25      '+DATA/CDB/ONLINELOG/group_5.259.1148481315',
 26      '+DATA/CDB/ONLINELOG/group_5.276.1148481317'
 27    ) SIZE 50M BLOCKSIZE 512,
 28    GROUP 6 (
 29      '+DATA/CDB/ONLINELOG/group_6.294.1148481317',
 30      '+DATA/CDB/ONLINELOG/group_6.287.1148481317'
 31    ) SIZE 50M BLOCKSIZE 512
 32  -- STANDBY LOGFILE
 33  DATAFILE
 34  '+DATA/CDB/DATAFILE/system.258.1171797291',
 35    '+DATA/CDB/DATAFILE/sysaux.287.1171797291',
 36    '+DATA/CDB/DATAFILE/undotbs1.302.1171797291',
 37    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313',
 38    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313',
 39    '+DATA/CDB/DATAFILE/users.259.1171797291',
 40    '+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313',
 41    '+DATA/CDB/DATAFILE/undotbs2.290.1171797291',
 42    '+DATA/CDB/DATAFILE/undotbs3.276.1171797291',
 43    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173014585',
 44    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.286.1173014585',
 45    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1173014585',
 46    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.261.1173014585',
 47    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.282.1173014585',
 48    '+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.267.1173014585'
 49  CHARACTER SET AL32UTF8
 50  ;
 CREATE CONTROLFILE   set DATABASE "CDB" RESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01565: error in identifying file '+DATA/CDB/DATAFILE/system.258.1171797291'
ORA-17503: ksfdopn:2 Failed to open file
+DATA/CDB/DATAFILE/system.258.1171797291
ORA-15012: ASM file '+DATA/CDB/DATAFILE/system.258.1171797291' does not exist

------没有数据文件不能重建控制文件的

-----sqlplus rman 切换真烦
SQL> restore controlfile from autobackup;
SP2-0734: unknown command beginning "restore co..." - rest of line ignored.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 01:58:43 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (not mounted)

RMAN> restore controlfile from autobackup;

Starting restore at 01-JUL-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=417 device type=DISK

recovery area destination: +DATA1
database name (or database unique name) used for search: CDB
channel ORA_DISK_1: AUTOBACKUP +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263 found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 01-JUL-24

RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN> restore database;

Starting restore at 01-JUL-24
Starting implicit crosscheck backup at 01-JUL-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK
Finished implicit crosscheck backup at 01-JUL-24

Starting implicit crosscheck copy at 01-JUL-24
using channel ORA_DISK_1
Finished implicit crosscheck copy at 01-JUL-24

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/DATAFILE/system.345.1171803163
File Name: +DATA1/CDB/DATAFILE/system.347.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs1.270.1171803163
File Name: +DATA1/CDB/DATAFILE/undotbs2.257.1171803163
File Name: +DATA1/CDB/DATAFILE/undotbs3.291.1171803163
File Name: +DATA1/CDB/DATAFILE/users.264.1171803163
File Name: +DATA1/CDB/DATAFILE/system.267.1173014541
File Name: +DATA1/CDB/DATAFILE/undotbs1.303.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs2.304.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs3.392.1171803475
File Name: +DATA1/CDB/DATAFILE/users.276.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs1.308.1173014541
File Name: +DATA1/CDB/DATAFILE/undotbs2.324.1173014541
File Name: +DATA1/CDB/DATAFILE/undotbs3.322.1173014541
File Name: +DATA1/CDB/DATAFILE/users.309.1173014541
File Name: +DATA1/CDB/CONTROLFILE/current.333.1171762815
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.385.1171793743
File Name: +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.386.1171793743
File Name: +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.387.1171793743
File Name: +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.262.1171725771
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.369.1171783055
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.274.1171783353
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.305.1171783701
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.277.1171785421
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
File Name: +DATA1/CDB/BACKUPSET/2024_06_16/annnf0_fulldbbackup0617_0.315.1171802005
File Name: +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
File Name: +DATA1/CDB/BACKUPSET/2024_06_16/annnf0_fulldbbackup0617_0.384.1171802091
File Name: +DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_2.409.1173015929

using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 01:59:20
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       ORPHAN  1920977    26-SEP-23
2       2       CDB      2265125454       PARENT  7500404    16-JUN-24
6       6       CDB      2265125454       ORPHAN  7607144    01-JUL-24
5       5       CDB      2265125454       ORPHAN  7607175    16-JUN-24
4       4       CDB      2265125454       ORPHAN  7607202    16-JUN-24
3       3       CDB      2265125454       PARENT  9051784    01-JUL-24
7       7       CDB      2265125454       CURRENT 9053141    01-JUL-24

RMAN> reset database to incarnation 4;

database reset to incarnation 4

RMAN>  restore database;

Starting restore at 01-JUL-24
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 02:01:07
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> reset database to incarnation 5;

RMAN> reset database to incarnation 6;

database reset to incarnation 6

RMAN> reset database to incarnation 2;

database reset to incarnation 2

RMAN> reset database to incarnation 1;

database reset to incarnation 1

RMAN> reset database to incarnation 7;

database reset to incarnation 7

RMAN> restore database;

Starting restore at 01-JUL-24
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 02:02:44
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> catalog recovery area          
2> ;

searching for all files in the recovery area

List of Files Unknown to the Database
=====================================
File Name: +DATA1/CDB/ONLINELOG/group_1.286.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_2.285.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_3.282.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_4.279.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_6.406.1173015623
File Name: +DATA1/CDB/ONLINELOG/group_7.407.1173015625
File Name: +DATA1/CDB/ONLINELOG/group_8.408.1173015625
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.262.1171725771
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.369.1171783055
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.274.1171783353
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.305.1171783701
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.277.1171785421

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.262.1171725771
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.369.1171783055
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.274.1171783353
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.305.1171783701
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.277.1171785421

List of Files Which Were Not Cataloged
=======================================
File Name: +DATA1/CDB/ONLINELOG/group_1.286.1171725765
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: +DATA1/CDB/ONLINELOG/group_2.285.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_7.407.1173015625
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: +DATA1/CDB/ONLINELOG/group_8.408.1173015625
  RMAN-07529: Reason: catalog is not supported for this file type

RMAN> restore database;

Starting restore at 01-JUL-24
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 02:04:58
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> switch database to copy;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 07/01/2024 02:05:15
RMAN-06571: datafile 1 does not have recoverable copy

---上面的这些文件认不到-----

List of Cataloged Files
=======================
File Name: +DATA1/CDB/DATAFILE/system.345.1171803163
File Name: +DATA1/CDB/DATAFILE/system.347.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs1.270.1171803163
File Name: +DATA1/CDB/DATAFILE/undotbs2.257.1171803163

RMAN> catalog start with '+data1';

searching for all files that match the pattern +data1

List of Files Unknown to the Database
=====================================
File Name: +DATA1/CDB/ONLINELOG/group_1.286.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_2.285.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_7.407.1173015625
File Name: +DATA1/CDB/ONLINELOG/group_8.408.1173015625
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.262.1171725771
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.369.1171783055
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.274.1171783353
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.305.1171783701
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.277.1171785421

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.262.1171725771
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.369.1171783055
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.274.1171783353
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.305.1171783701
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.277.1171785421

List of Files Which Were Not Cataloged
=======================================
File Name: +DATA1/CDB/ONLINELOG/group_1.286.1171725765
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: +DATA1/CDB/ONLINELOG/group_2.285.1171725765
File Name: +DATA1/CDB/ONLINELOG/group_7.407.1173015625
  RMAN-07529: Reason: catalog is not supported for this file type
File Name: +DATA1/CDB/ONLINELOG/group_8.408.1173015625
  RMAN-07529: Reason: catalog is not supported for this file type

RMAN> switch database to copy;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 07/01/2024 02:06:21
RMAN-06571: datafile 1 does not have recoverable copy

RMAN> restore database;

Starting restore at 01-JUL-24
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 02:06:34
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       ORPHAN  1920977    26-SEP-23
2       2       CDB      2265125454       PARENT  7500404    16-JUN-24
6       6       CDB      2265125454       ORPHAN  7607144    01-JUL-24
5       5       CDB      2265125454       ORPHAN  7607175    16-JUN-24
4       4       CDB      2265125454       ORPHAN  7607202    16-JUN-24
3       3       CDB      2265125454       PARENT  9051784    01-JUL-24
7       7       CDB      2265125454       CURRENT 9053141    01-JUL-24

RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  F  A DISK        01-JUL-24       1       1       NO         TAG20240701T013422
2       B  F  A DISK        16-JUN-24       1       1       NO         TAG20240616T123452
3       B  F  A DISK        16-JUN-24       1       1       NO         TAG20240616T130648
4       B  F  A DISK        16-JUN-24       1       1       YES        FULLDBBACKUP0617
5       B  F  A DISK        16-JUN-24       1       1       YES        FULLDBBACKUP0617
6       B  A  A DISK        16-JUN-24       1       1       YES        FULLDBBACKUP0617
7       B  F  A DISK        16-JUN-24       1       1       YES        FULLDBBACKUP0617
8       B  A  A DISK        16-JUN-24       1       1       YES        FULLDBBACKUP0617

RMAN> restore database from tag FULLDBBACKUP0617;

Starting restore at 01-JUL-24
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 02:07:46
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> reset database to incarnation 4;

database reset to incarnation 4

RMAN> restore database from tag FULLDBBACKUP0617;

Starting restore at 01-JUL-24
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 02:08:48
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 34 found to restore
RMAN-06023: no backup or copy of datafile 33 found to restore
RMAN-06023: no backup or copy of datafile 32 found to restore
RMAN-06023: no backup or copy of datafile 31 found to restore
RMAN-06023: no backup or copy of datafile 30 found to restore
RMAN-06023: no backup or copy of datafile 29 found to restore

RMAN> list backup of controlfile;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    19.20M     DISK        00:00:00     01-JUL-24      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20240701T013422
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
  Control File Included: Ckp SCN: 9052183      Ckp time: 01-JUL-24

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    19.45M     DISK        00:00:00     16-JUN-24      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T123452
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
  Control File Included: Ckp SCN: 7607081      Ckp time: 16-JUN-24

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    19.45M     DISK        00:00:00     16-JUN-24      
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T130648
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
  Control File Included: Ckp SCN: 7817829      Ckp time: 16-JUN-24

RMAN> startup nomount force;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';---用旧的才能恢复

Starting restore at 01-JUL-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 01-JUL-24

RMAN> alter database mount;

RMAN> restore database;

Starting restore at 01-JUL-24
Starting implicit crosscheck backup at 01-JUL-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 01-JUL-24

Starting implicit crosscheck copy at 01-JUL-24
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 01-JUL-24

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/DATAFILE/system.345.1171803163
File Name: +DATA1/CDB/DATAFILE/system.347.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs1.270.1171803163
File Name: +DATA1/CDB/DATAFILE/undotbs2.257.1171803163
File Name: +DATA1/CDB/DATAFILE/undotbs3.291.1171803163
File Name: +DATA1/CDB/DATAFILE/users.264.1171803163
File Name: +DATA1/CDB/DATAFILE/system.267.1173014541
File Name: +DATA1/CDB/DATAFILE/undotbs1.303.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs2.304.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs3.392.1171803475
File Name: +DATA1/CDB/DATAFILE/users.276.1171803475
File Name: +DATA1/CDB/DATAFILE/undotbs1.308.1173014541
File Name: +DATA1/CDB/DATAFILE/undotbs2.324.1173014541
File Name: +DATA1/CDB/DATAFILE/undotbs3.322.1173014541
File Name: +DATA1/CDB/DATAFILE/users.309.1173014541
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.262.1171725771
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.369.1171783055
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.274.1171783353
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.305.1171783701
File Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.277.1171785421
File Name: +DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_2.409.1173015929
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_38.380.1172973633

.

.

.


File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

using channel ORA_DISK_1

channel ORA_DISK_1: restoring datafile 00005
input datafile copy RECID=10 STAMP=1171797291 file name=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.385.1171793743
destination for restore of datafile 00005: +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
channel ORA_DISK_1: copied datafile copy of datafile 00005, elapsed time: 00:00:01
output file--为什么不全部从NN中恢复name=+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.267.1173017419 RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00006
input datafile copy RECID=11 STAMP=1171797291 file name=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.386.1171793743
destination for restore of datafile 00006: +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
channel ORA_DISK_1: copied datafile copy of datafile 00006, elapsed time: 00:00:01
output file name=+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.282.1173017419 RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00008
input datafile copy RECID=12 STAMP=1171797291 file name=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.387.1171793743
destination for restore of datafile 00008: +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
channel ORA_DISK_1: copied datafile copy of datafile 00008, elapsed time: 00:00:01
output file name=+DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.261.1173017421 RECID=0 STAMP=0
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.258.1171797291
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.287.1171797291
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.302.1171797291
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.259.1171797291
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.290.1171797291
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.276.1171797291
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
channel ORA_DISK_1: restoring datafile 00012 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
channel ORA_DISK_1: restoring datafile 00013 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
channel ORA_DISK_1: restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
channel ORA_DISK_1: restoring datafile 00015 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
channel ORA_DISK_1: restoring datafile 00016 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 01-JUL-24

-----------如果delete obsolete copy 就可以了

RMAN> recover database;

Starting recover at 01-JUL-24
using channel ORA_DISK_1

starting media recovery

archived log for thread 3 with sequence 6 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091
archived log for thread 3 with sequence 7 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
archived log for thread 3 with sequence 8 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
archived log for thread 3 with sequence 9 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489
archived log for thread 3 with sequence 10 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_17/thread_3_seq_10.299.1171886345
archived log for thread 3 with sequence 11 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_18/thread_3_seq_11.390.1171958419
archived log for thread 3 with sequence 12 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_18/thread_3_seq_12.379.1171965613
archived log for thread 3 with sequence 13 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_19/thread_3_seq_13.275.1172095187
archived log for thread 3 with sequence 14 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_20/thread_3_seq_14.273.1172127661
archived log for thread 3 with sequence 15 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_20/thread_3_seq_15.307.1172138413
archived log for thread 3 with sequence 16 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_23/thread_3_seq_16.271.1172447813
archived log for thread 3 with sequence 17 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_17.335.1172455739
archived log for thread 3 with sequence 18 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_18.272.1172484011
archived log for thread 3 with sequence 19 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_19.319.1172487613
archived log for thread 3 with sequence 20 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_20.349.1172520061
archived log for thread 3 with sequence 21 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_21.332.1172529667
archived log for thread 3 with sequence 22 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_22.260.1172530491
archived log for thread 3 with sequence 23 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_23.354.1172538015
archived log for thread 3 with sequence 24 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_24.355.1172543217
archived log for thread 3 with sequence 25 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_25.352.1172550871
archived log for thread 3 with sequence 26 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_27/thread_3_seq_26.362.1172719509
archived log for thread 3 with sequence 27 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_27/thread_3_seq_27.357.1172721017
archived log for thread 3 with sequence 28 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_28.348.1172793815
archived log for thread 3 with sequence 29 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_29.350.1172806573
archived log for thread 3 with sequence 30 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_30.359.1172818825
archived log for thread 3 with sequence 31 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_31.358.1172888995
archived log for thread 3 with sequence 32 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_32.343.1172890829
archived log for thread 3 with sequence 33 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_33.320.1172903381
archived log for thread 3 with sequence 34 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_34.310.1172916049
archived log for thread 3 with sequence 35 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_35.256.1172923209
archived log for thread 3 with sequence 36 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_36.265.1172944811
archived log for thread 3 with sequence 37 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_37.393.1172959245
archived log for thread 3 with sequence 38 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_38.380.1172973633
archived log for thread 3 with sequence 39 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_39.297.1172973717
archived log for thread 3 with sequence 40 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_40.261.1172988137
archived log for thread 3 with sequence 41 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_41.368.1173002577
archived log for thread 3 with sequence 42 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_42.266.1173013247
archived log for thread 3 with sequence 2 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_2.409.1173015929
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091 thread=3 sequence=6
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027 thread=3 sequence=7
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111 thread=3 sequence=8
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 17 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.301.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 17
Executing: alter database datafile 17 offline
Segmentation fault

不能恢复会退出,继续还可以恢复
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 02:11:48 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> recover database;

Starting recover at 01-JUL-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK

starting media recovery

archived log for thread 3 with sequence 9 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489
archived log for thread 3 with sequence 10 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_17/thread_3_seq_10.299.1171886345
archived log for thread 3 with sequence 11 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_18/thread_3_seq_11.390.1171958419
archived log for thread 3 with sequence 12 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_18/thread_3_seq_12.379.1171965613
archived log for thread 3 with sequence 13 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_19/thread_3_seq_13.275.1172095187
archived log for thread 3 with sequence 14 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_20/thread_3_seq_14.273.1172127661
archived log for thread 3 with sequence 15 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_20/thread_3_seq_15.307.1172138413
archived log for thread 3 with sequence 16 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_23/thread_3_seq_16.271.1172447813
archived log for thread 3 with sequence 17 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_17.335.1172455739
archived log for thread 3 with sequence 18 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_18.272.1172484011
archived log for thread 3 with sequence 19 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_19.319.1172487613
archived log for thread 3 with sequence 20 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_20.349.1172520061
archived log for thread 3 with sequence 21 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_21.332.1172529667
archived log for thread 3 with sequence 22 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_22.260.1172530491
archived log for thread 3 with sequence 23 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_23.354.1172538015
archived log for thread 3 with sequence 24 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_24.355.1172543217
archived log for thread 3 with sequence 25 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_25.352.1172550871
archived log for thread 3 with sequence 26 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_27/thread_3_seq_26.362.1172719509
archived log for thread 3 with sequence 27 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_27/thread_3_seq_27.357.1172721017
archived log for thread 3 with sequence 28 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_28.348.1172793815
archived log for thread 3 with sequence 29 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_29.350.1172806573
archived log for thread 3 with sequence 30 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_30.359.1172818825
archived log for thread 3 with sequence 31 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_31.358.1172888995
archived log for thread 3 with sequence 32 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_32.343.1172890829
archived log for thread 3 with sequence 33 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_33.320.1172903381
archived log for thread 3 with sequence 34 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_34.310.1172916049
archived log for thread 3 with sequence 35 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_35.256.1172923209
archived log for thread 3 with sequence 36 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_36.265.1172944811
archived log for thread 3 with sequence 37 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_37.393.1172959245
archived log for thread 3 with sequence 38 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_38.380.1172973633
archived log for thread 3 with sequence 39 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_39.297.1172973717
archived log for thread 3 with sequence 40 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_40.261.1172988137
archived log for thread 3 with sequence 41 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_41.368.1173002577
archived log for thread 3 with sequence 42 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_42.266.1173013247
archived log for thread 3 with sequence 2 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_2.409.1173015929
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 17 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.301.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 17
Executing: alter database datafile 17 offline

Plugin datafile 18 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.266.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 18
Executing: alter database datafile 18 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 19 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.274.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 19
Executing: alter database datafile 19 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 20 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.286.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 20
Executing: alter database datafile 20 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 21 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.270.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 21
Executing: alter database datafile 21 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 22 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.261.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 22
Executing: alter database datafile 22 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 23 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.301.1171803521) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 23
Executing: alter database datafile 23 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 24 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.266.1171803521) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 24
Executing: alter database datafile 24 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 25 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.274.1171803521) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 25
Executing: alter database datafile 25 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 26 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.286.1171803521) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 26
Executing: alter database datafile 26 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 27 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.270.1171803521) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 27
Executing: alter database datafile 27 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 28 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.261.1171803521) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 28
Executing: alter database datafile 28 offline
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_17/thread_3_seq_10.299.1171886345 thread=3 sequence=10
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_18/thread_3_seq_11.390.1171958419 thread=3 sequence=11
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_18/thread_3_seq_12.379.1171965613 thread=3 sequence=12
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_19/thread_3_seq_13.275.1172095187 thread=3 sequence=13
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_20/thread_3_seq_14.273.1172127661 thread=3 sequence=14
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_20/thread_3_seq_15.307.1172138413 thread=3 sequence=15
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_23/thread_3_seq_16.271.1172447813 thread=3 sequence=16
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_17.335.1172455739 thread=3 sequence=17
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_18.272.1172484011 thread=3 sequence=18
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_19.319.1172487613 thread=3 sequence=19
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_20.349.1172520061 thread=3 sequence=20
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_21.332.1172529667 thread=3 sequence=21
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_24/thread_3_seq_22.260.1172530491 thread=3 sequence=22
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_23.354.1172538015 thread=3 sequence=23
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_24.355.1172543217 thread=3 sequence=24
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_25/thread_3_seq_25.352.1172550871 thread=3 sequence=25
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_27/thread_3_seq_26.362.1172719509 thread=3 sequence=26
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_27/thread_3_seq_27.357.1172721017 thread=3 sequence=27
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_28.348.1172793815 thread=3 sequence=28
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_29.350.1172806573 thread=3 sequence=29
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_28/thread_3_seq_30.359.1172818825 thread=3 sequence=30
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_31.358.1172888995 thread=3 sequence=31
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_32.343.1172890829 thread=3 sequence=32
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_33.320.1172903381 thread=3 sequence=33
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_34.310.1172916049 thread=3 sequence=34
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_35.256.1172923209 thread=3 sequence=35
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_36.265.1172944811 thread=3 sequence=36
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_29/thread_3_seq_37.393.1172959245 thread=3 sequence=37
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_38.380.1172973633 thread=3 sequence=38
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_39.297.1172973717 thread=3 sequence=39
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_40.261.1172988137 thread=3 sequence=40
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_41.368.1173002577 thread=3 sequence=41
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_30/thread_3_seq_42.266.1173013247 thread=3 sequence=42
unable to find archived log
archived log thread=3 sequence=43
Segmentation fault

上面去掉了不能恢复的PDB,上面如果进入到pdb中,进行alter datafile online也可以恢复的
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 02:12:27 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> recover database;

Starting recover at 01-JUL-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK

starting media recovery

archived log for thread 3 with sequence 2 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_2.409.1173015929
unable to find archived log
archived log thread=3 sequence=43
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 02:12:32
RMAN-06054: media recovery requesting unknown archived log for thread 3 with sequence 43 and starting SCN of 9047619

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 02:12:35 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
SQL>  recover pluggable database pdb  until time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';
ORA-00905: missing keyword


SQL>  exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 02:13:00 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> recover pluggable database pdb  until time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';

Starting recover at 01-JUL-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=421 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 02:13:02
RMAN-05101: Point-in-Time Recovery without CATALOG and TARGET not open requires that UNDO TABLESPACE is specified

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 07/01/2024 02:13:08
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;  CDB resetlogs后还可以恢复旧的pdb

Statement processed

RMAN> recover pluggable database pdb  until time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';

Starting recover at 01-JUL-24
current log archived
using channel ORA_DISK_1
RMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1
Tablespace UNDOTBS2
Tablespace UNDOTBS3

Creating automatic instance, with SID='pjes'

initialization parameters used for automatic instance:
db_name=CDB
db_unique_name=pjes_pitr_pdb_CDB
compatible=19.0.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_pdb_name_case_sensitive=false
_system_trig_enabled=FALSE
db_domain=cj.com
sga_target=548M
processes=200
db_create_file_dest=+data1
log_archive_dest_1='location=+data1'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance CDB

Oracle instance started

Total System Global Area     574618552 bytes

Fixed Size                     9165752 bytes
Variable Size                213909504 bytes
Database Buffers             343932928 bytes
Redo Buffers                   7610368 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# restore the controlfile
restore clone controlfile;
 
# mount the controlfile
sql clone 'alter database mount clone database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 01-JUL-24
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=186 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093 tag=TAG20240616T123452
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA1/CDB/CONTROLFILE/current.325.1173017613
Finished restore at 01-JUL-24

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  4 to new;
set newname for clone datafile  9 to new;
set newname for clone datafile  10 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  7 to new;
set newname for datafile  11 to new;
set newname for datafile  12 to new;
set newname for datafile  13 to new;
set newname for datafile  14 to new;
set newname for datafile  15 to new;
set newname for datafile  16 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 4, 9, 10, 3, 7, 11, 12, 13, 14, 15, 16;
 
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 01-JUL-24
using channel ORA_AUX_DISK_1

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 00001 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00004 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00009 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00010 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00003 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00007 to +data1
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
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 00011 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00012 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00013 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00014 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00015 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00016 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 01-JUL-24

datafile 11 switched to datafile copy
input datafile copy RECID=37 STAMP=1173147299 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.302.1173017665
datafile 12 switched to datafile copy
input datafile copy RECID=38 STAMP=1173147299 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.287.1173017665
datafile 13 switched to datafile copy
input datafile copy RECID=39 STAMP=1173147299 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.258.1173017665
datafile 14 switched to datafile copy
input datafile copy RECID=40 STAMP=1173147299 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.275.1173017665
datafile 15 switched to datafile copy
input datafile copy RECID=41 STAMP=1173147299 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.350.1173017665
datafile 16 switched to datafile copy
input datafile copy RECID=42 STAMP=1173147299 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.269.1173017665
datafile 1 switched to datafile copy
input datafile copy RECID=43 STAMP=1173147299 file name=+DATA1/CDB/DATAFILE/system.341.1173017619
datafile 4 switched to datafile copy
input datafile copy RECID=44 STAMP=1173147299 file name=+DATA1/CDB/DATAFILE/undotbs1.312.1173017619
datafile 9 switched to datafile copy
input datafile copy RECID=45 STAMP=1173147299 file name=+DATA1/CDB/DATAFILE/undotbs2.389.1173017619
datafile 10 switched to datafile copy
input datafile copy RECID=46 STAMP=1173147299 file name=+DATA1/CDB/DATAFILE/undotbs3.410.1173017619
datafile 3 switched to datafile copy
input datafile copy RECID=47 STAMP=1173147299 file name=+DATA1/CDB/DATAFILE/sysaux.301.1173017619
datafile 7 switched to datafile copy
input datafile copy RECID=48 STAMP=1173147299 file name=+DATA1/CDB/DATAFILE/users.411.1173017619

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  4 online";
sql clone "alter database datafile  9 online";
sql clone "alter database datafile  10 online";
sql clone "alter database datafile  3 online";
sql clone "alter database datafile  7 online";
sql clone 'PDB' "alter database datafile 
 11 online";
sql clone 'PDB' "alter database datafile 
 12 online";
sql clone 'PDB' "alter database datafile 
 13 online";
sql clone 'PDB' "alter database datafile 
 14 online";
sql clone 'PDB' "alter database datafile 
 15 online";
sql clone 'PDB' "alter database datafile 
 16 online";
#recover pdb
recover clone database tablespace  "SYSTEM", "UNDOTBS1", "UNDOTBS2", "UNDOTBS3", "SYSAUX", "USERS" pluggable database 
 'PDB'  delete archivelog;
#open in read write mode
sql clone 'alter database open resetlogs';
#unplug dropped pdb into temp file
sql clone "alter pluggable database PDB unplug into ''
/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_pjes.xml''";
#create pdb using temp file of recovered pdb
sql "create pluggable database PDB using ''
/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_pjes.xml'' nocopy tempfile reuse";
alter pluggable database PDB open;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  4 online

sql statement: alter database datafile  9 online

sql statement: alter database datafile  10 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  7 online

sql statement: alter database datafile  11 online

sql statement: alter database datafile  12 online

sql statement: alter database datafile  13 online

sql statement: alter database datafile  14 online

sql statement: alter database datafile  15 online

sql statement: alter database datafile  16 online

Starting recover at 01-JUL-24
using channel ORA_AUX_DISK_1

Executing: alter database datafile 5, 6, 8 offline
starting media recovery

archived log for thread 3 with sequence 6 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091
archived log for thread 3 with sequence 7 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091 thread=3 sequence=6
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027 thread=3 sequence=7
media recovery complete, elapsed time: 00:00:02
Finished recover at 01-JUL-24

sql statement: alter database open resetlogs

sql statement: alter pluggable database PDB unplug into ''/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_pjes.xml''

sql statement: create pluggable database PDB using ''/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_pjes.xml'' nocopy tempfile reuse

Statement processed

Removing automatic instance
shutting down automatic instance 
Oracle instance shut down
Automatic instance removed
auxiliary instance file /u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_pjes.xml deleted
auxiliary instance file +DATA1/CDB/DATAFILE/sysaux.301.1173017619 deleted
auxiliary instance file +DATA1/CDB/CONTROLFILE/current.325.1173017613 deleted
Finished recover at 01-JUL-24

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 02:15:34 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE NO
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 02:15:45 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1180     SYSTEM               YES     +DATA/CDB/DATAFILE/system.270.1173017421
3    1040     SYSAUX               NO      +DATA/CDB/DATAFILE/sysaux.286.1173017421
4    615      UNDOTBS1             YES     +DATA/CDB/DATAFILE/undotbs1.284.1173017421
5    510      PDB$SEED:SYSTEM      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.267.1173017419
6    480      PDB$SEED:SYSAUX      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.282.1173017419
7    5        USERS                NO      +DATA/CDB/DATAFILE/users.280.1173017421
8    215      PDB$SEED:UNDOTBS1    NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.261.1173017421
9    250      UNDOTBS2             YES     +DATA/CDB/DATAFILE/undotbs2.293.1173017421
10   75       UNDOTBS3             YES     +DATA/CDB/DATAFILE/undotbs3.285.1173017421
29   510      PDB:SYSTEM           YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.302.1173017665
30   490      PDB:SYSAUX           NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.287.1173017665
31   215      PDB:UNDOTBS1         YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.258.1173017665
32   215      PDB:UNDO_3           YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.275.1173017665
33   215      PDB:UNDO_4           YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.350.1173017665
34   5        PDB:USERS            NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.269.1173017665

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> 

-------resetlogs后不能flashback了, 已经recover pdb 是plug上去的---

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
SQL>  flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');
  flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS')
*
ERROR at line 1:
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database
incarnation is not allowed.

 
[oracle@rac1 ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'

RMAN> list incarnation;

using target database control file instead of recovery catalog

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11
5       5       CDB      2265125454       PARENT  7326604    2024-06-16 02:21:34
10      10      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:06:17
14      14      CDB      2265125454       PARENT  7326605    2024-06-16 05:07:19
11      11      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:12:40
4       4       CDB      2265125454       ORPHAN  7326802    2024-06-16 02:12:57
3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
20      20      CDB      2265125454       ORPHAN  7607144    2024-07-01 01:23:43
19      19      CDB      2265125454       ORPHAN  7607175    2024-06-16 12:59:18
18      18      CDB      2265125454       ORPHAN  7607202    2024-06-16 12:53:55
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42
23      23      CDB      2265125454       CURRENT 9047620    2024-07-01 02:13:13
21      21      CDB      2265125454       ORPHAN  9051784    2024-07-01 01:34:17
22      22      CDB      2265125454       ORPHAN  9053141    2024-07-01 01:40:22

RMAN> flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "before, scn, sequence, time"
RMAN-01008: the bad identifier was: timestamp
RMAN-01007: at line 1 column 37 file: standard input

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 13:18:26 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');
flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS')
*
ERROR at line 1:
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database
incarnation is not allowed.


SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 13:18:32 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> reset database to incarnation 3;

using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of reset database command on default channel at 07/01/2024 13:18:51
ORA-19910: can not change recovery target incarnation in control file

RMAN> reset database to incarnation 8;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of reset database command on default channel at 07/01/2024 13:19:07
ORA-19910: can not change recovery target incarnation in control file

open的情况下不可能reset incarnation

RMAN> startup force mount;

Oracle instance started
database mounted

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN>  reset database to incarnation 3;

database reset to incarnation 3

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 13:19:36 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');
flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS')
*
ERROR at line 1:
ORA-39870: container database is not open in read/write mode


SQL> alter database open;

Database altered.

SQL>  flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');
 flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS')
*
ERROR at line 1:
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database
incarnation is not allowed.

RMAN> startup mount force;
 reset database to incarnation 2;

RMAN> alter database open;

SQL> flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');
flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS')
*
ERROR at line 1:
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database
incarnation is not allowed.

RMAN>  startup force mount;

 reset database to incarnation 20;
database reset to incarnation 20

[oracle@rac1 ~]$ s

SQL> alter database open; 

SQL>  flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS');
 flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:34:46','DD-MON-YYYY HH24:MI:SS')
*
ERROR at line 1:
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database
incarnation is not allowed.

----------------------------------如何去除多余的incarnation------------------

RMAN> delete datafilecopy all;

---不在控制文件的全部都是copy,如果想要直接switch database to copy, 如果不想要,清理掉

 ---ASM 下删除不要的文件------------------

 
[root@rac1 ~]# su - grid
Last login: Mon Jul  1 16:05:37 CST 2024
[grid@rac1 ~]$ asmcmd
ASMCMD> ls
DATA/
DATA1/
ASMCMD> cd *1
ASMCMD> ls
CDB/
ASMCMD> cd *
ASMCMD> ls
0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
ARCHIVELOG/
AUTOBACKUP/
BACKUPSET/
CONTROLFILE/
FLASHBACK/
ONLINELOG/
ASMCMD> cd ONLINELOG*
ASMCMD> ls
group_1.284.1171785417


group_8.408.1173015625
ASMCMD> rm *
 
ASMCMD> ls
ASMCMD-8002: entry 'ONLINELOG' does not exist in directory '+DATA1/CDB/'
ASMCMD> cd ../
ASMCMD> ls
0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
ARCHIVELOG/
AUTOBACKUP/
BACKUPSET/
CONTROLFILE/
FLASHBACK/
ASMCMD> cd B*T
ASMCMD> ls
2024_06_16/
ASMCMD> cd *
ASMCMD> ls
annnf0_FULLDBBACKUP0617_0.315.1171802005
annnf0_FULLDBBACKUP0617_0.384.1171802091
nnndf0_FULLDBBACKUP0617_0.377.1171802007
ASMCMD> cd ../
ASMCMD> ls
2024_06_16/

0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/

group_8.288.1173015625
ASMCMD> rm *
You may delete multiple files and/or directories. 
Are you sure? (y/n) y
ASMCMD> cd ../
ASMCMD> ls
0633F844101D69CBE0636401A8C09D55/
06344F62B8C65A17E0636401A8C0F073/
CONTROLFILE/
DATAFILE/
PARAMETERFILE/
TEMPFILE/
ASMCMD> rm -rf DATAFILE 0633F844101D69CBE0636401A8C09D55 06344F62B8C65A17E0636401A8C0F073
ASMCMD> exit

[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 16:13:15 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> startup nomount force;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';

RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN>  delete datafilecopy all;

Starting implicit crosscheck backup at 01-JUL-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=413 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 01-JUL-24

Starting implicit crosscheck copy at 01-JUL-24
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 01-JUL-24

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147199.317.1173017599
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147879.301.1173018279
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009


File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=413 device type=DISK
specification does not match any datafile copy in the repository

RMAN> exit                            


Recovery Manager complete.
[oracle@rac1 ~]$ exit
logout
[root@rac1 ~]# su - grid
Last login: Mon Jul  1 16:11:08 CST 2024 on pts/0
[grid@rac1 ~]$ asmcmd
ASMCMD> cd +DATA1/CDB/ARCHIVELOG/          
ASMCMD> ls
2024_06_16/
2024_06_17/
2024_06_18/
2024_06_19/
2024_06_20/
2024_06_23/
2024_06_24/
2024_06_25/
2024_06_27/
2024_06_28/
2024_06_29/
2024_06_30/
2024_07_01/
ASMCMD> rm -rf 2024_06_17/ 2024_06_18/ 2024_06_19/ 2024_06_20/ 2024_06_23/ 2024_06_24/ 2024_06_25/ 
ASMCMD> rm -rf 2024_06_27 2024_06_28 2024_06_29 2024_06_30 2024_07_01
ASMCMD> exit
[grid@rac1 ~]$ exit
logout
[root@rac1 ~]# su - oracle
Last login: Mon Jul  1 16:13:11 CST 2024 on pts/0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 16:15:48 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> list incarnation;

using target database control file instead of recovery catalog

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          17-APR-19
2       2       CDB      2265125454       PARENT  1920977    26-SEP-23

12      12      CDB      2265125454       ORPHAN  7329708    16-JUN-24
13      13      CDB      2265125454       ORPHAN  7329708    16-JUN-24
15      15      CDB      2265125454       PARENT  7496028    16-JUN-24
16      16      CDB      2265125454       ORPHAN  7500404    16-JUN-24
17      17      CDB      2265125454       PARENT  7500404    16-JUN-24
8       8       CDB      2265125454       ORPHAN  7512942    16-JUN-24
9       9       CDB      2265125454       ORPHAN  7620289    16-JUN-24

19      19      CDB      2265125454       CURRENT 9047620    01-JUL-24
18      18      CDB      2265125454       ORPHAN  9051784    01-JUL-24
20      20      CDB      2265125454       ORPHAN  9053141    01-JUL-24

RMAN> startup force mount; 

Oracle instance started
restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';database mounted

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> 

Starting restore at 01-JUL-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1180 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:16:23
RMAN-06496: must use the TO clause when the database is mounted or open

RMAN> startup force nomount;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';

Starting restore at 01-JUL-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=415 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 01-JUL-24

RMAN> alter database mount;

list incarnation;released channel: ORA_DISK_1
Statement processed

Recovery Manager complete.
[oracle@rac1 ~]$  export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
[oracle@rac1 ~]$ rman target /

RMAN> list incarnation;

using target database control file instead of recovery catalog

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18

13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> restore database;    

Starting restore at 2024-07-01 16:17:58
Starting implicit crosscheck backup at 2024-07-01 16:17:58
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1182 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 2024-07-01 16:17:59

Starting implicit crosscheck copy at 2024-07-01 16:17:59
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 2024-07-01 16:17:59

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================

File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147199.317.1173017599
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147879.301.1173018279

File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.258.1171797291
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.287.1171797291
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.302.1171797291
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.259.1171797291
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.290.1171797291
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.276.1171797291
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
channel ORA_DISK_1: restoring datafile 00012 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
channel ORA_DISK_1: restoring datafile 00013 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
channel ORA_DISK_1: restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
channel ORA_DISK_1: restoring datafile 00015 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
channel ORA_DISK_1: restoring datafile 00016 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
channel ORA_DISK_1: restoring datafile 00006 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
channel ORA_DISK_1: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 2024-07-01 16:19:55

RMAN> report schema;

RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1170     SYSTEM               ***     +DATA/CDB/DATAFILE/system.275.1173154681
3    910      SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.258.1173154681
4    615      UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.287.1173154681
5    510      PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.267.1173154761
6    480      PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.269.1173154761
7    5        USERS                ***     +DATA/CDB/DATAFILE/users.276.1173154681
8    215      PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.350.1173154761
9    250      UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.302.1173154681
10   75       UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.290.1173154681
11   510      PDB:SYSTEM           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.284.1173154725
12   490      PDB:SYSAUX           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.293.1173154725
13   215      PDB:UNDOTBS1         ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.282.1173154725
14   215      PDB:UNDO_3           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.279.1173154725
15   215      PDB:UNDO_4           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.270.1173154725
16   5        PDB:USERS            ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.261.1173154725

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11

12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

19      19      CDB      2265125454       CURRENT 9047620    2024-07-01 02:13:13
18      18      CDB      2265125454       ORPHAN  9051784    2024-07-01 01:34:17

RMAN> recover database;

Starting recover at 2024-07-01 16:22:11
using channel ORA_DISK_1

starting media recovery

archived log for thread 3 with sequence 6 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091
archived log for thread 3 with sequence 7 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
archived log for thread 3 with sequence 8 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
archived log for thread 3 with sequence 9 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091 thread=3 sequence=6
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027 thread=3 sequence=7
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111 thread=3 sequence=8
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
Plugin datafile 17 (+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.301.1171803207) cannot be created during recovery and will be offlined.
PDB PDB created during recovery, offlining file 17
Executing: alter database datafile 17 offline
Segmentation fault

-------------这个控制区recover后,要删除pdb,不行  
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 16:22:26 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454, not open)

RMAN> report schema;

using target database control file instead of recovery catalog
RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1170     SYSTEM               ***     +DATA/CDB/DATAFILE/system.275.1173154681
3    910      SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.258.1173154681
4    615      UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.287.1173154681
5    510      PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.267.1173154761
6    480      PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.269.1173154761
7    5        USERS                ***     +DATA/CDB/DATAFILE/users.276.1173154681
8    215      PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.350.1173154761
9    250      UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.302.1173154681
10   75       UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.290.1173154681

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> startup nomount force;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';

Starting restore at 2024-07-01 16:25:10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=413 device type=DISK


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 2024-07-01 16:25:12

RMAN> 
RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN> report schema;

Starting implicit crosscheck backup at 2024-07-01 16:25:25
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=411 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 2024-07-01 16:25:25

Starting implicit crosscheck copy at 2024-07-01 16:25:25
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 2024-07-01 16:25:25

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147199.317.1173017599
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147879.301.1173018279
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     +DATA/CDB/DATAFILE/system.258.1171797291
3    0        SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.287.1171797291
4    0        UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.302.1171797291
5    0        PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
6    0        PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
7    0        USERS                ***     +DATA/CDB/DATAFILE/users.259.1171797291
8    0        PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
9    0        UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.290.1171797291
10   0        UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.276.1171797291
11   0        PDB:SYSTEM           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
12   0        PDB:SYSAUX           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
13   0        PDB:UNDOTBS1         ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
14   0        PDB:UNDO_3           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
15   0        PDB:UNDO_4           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
16   0        PDB:USERS            ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11
5       5       CDB      2265125454       PARENT  7326604    2024-06-16 02:21:34
10      10      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:06:17
14      14      CDB      2265125454       PARENT  7326605    2024-06-16 05:07:19
11      11      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:12:40
4       4       CDB      2265125454       ORPHAN  7326802    2024-06-16 02:12:57
3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

19      19      CDB      2265125454       CURRENT 9047620    2024-07-01 02:13:13
18      18      CDB      2265125454       ORPHAN  9051784    2024-07-01 01:34:17

RMAN> startup nomount force;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> 
RMAN>  
RMAN>  restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';

Starting restore at 2024-07-01 16:26:04
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 2024-07-01 16:26:06

RMAN>  alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18

7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN>  report schema;

Starting implicit crosscheck backup at 2024-07-01 16:26:34
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1183 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 2024-07-01 16:26:34

Starting implicit crosscheck copy at 2024-07-01 16:26:34
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 2024-07-01 16:26:34

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173144862.400.1173015263
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147199.317.1173017599
File Name: +DATA1/CDB/AUTOBACKUP/2024_07_01/s_1173147879.301.1173018279
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     +DATA/CDB/DATAFILE/system.258.1171797291
3    0        SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.287.1171797291
4    0        UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.302.1171797291
5    0        PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
6    0        PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
7    0        USERS                ***     +DATA/CDB/DATAFILE/users.259.1171797291
8    0        PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
9    0        UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.290.1171797291
10   0        UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.276.1171797291
11   0        PDB:SYSTEM           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
12   0        PDB:SYSAUX           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
13   0        PDB:UNDOTBS1         ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
14   0        PDB:UNDO_3           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
15   0        PDB:UNDO_4           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
16   0        PDB:USERS            ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN>  list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18

3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

19      19      CDB      2265125454       CURRENT 9047620    2024-07-01 02:13:13
18      18      CDB      2265125454       ORPHAN  9051784    2024-07-01 01:34:17

RMAN> 

RMAN> 

RMAN> run{
2> set until sequence 6 thread 3;
3> restore database;
4> recover database;
5> }

executing command: SET until clause

Starting restore at 2024-07-01 16:28:04
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.258.1171797291
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.287.1171797291
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.302.1171797291
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.259.1171797291
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.290.1171797291
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.276.1171797291
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
channel ORA_DISK_1: restoring datafile 00012 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
channel ORA_DISK_1: restoring datafile 00013 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
channel ORA_DISK_1: restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
channel ORA_DISK_1: restoring datafile 00015 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
channel ORA_DISK_1: restoring datafile 00016 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:28:50
ORA-19870: error while restoring backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
ORA-19504: failed to create file "+DATA"
ORA-17502: ksfdcre:4 Failed to create file +DATA
ORA-15041: diskgroup "DATA" space exhausted

--------这里看到是可以恢复的 ,看到有1号incarnation的继续清理,

RMAN> 

 

 

RMAN> startup nomount force;
 

RMAN> 
RMAN> restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';

Starting restore at 2024-07-01 16:30:25
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=415 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 2024-07-01 16:30:28

RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18

3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> report schema;

Starting implicit crosscheck backup at 2024-07-01 16:30:49
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=421 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 2024-07-01 16:30:49

Starting implicit crosscheck copy at 2024-07-01 16:30:49
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 2024-07-01 16:30:49

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     +DATA/CDB/DATAFILE/system.258.1171797291
3    0        SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.287.1171797291
4    0        UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.302.1171797291
5    0        PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
6    0        PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
7    0        USERS                ***     +DATA/CDB/DATAFILE/users.259.1171797291
8    0        PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
9    0        UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.290.1171797291
10   0        UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.276.1171797291
11   0        PDB:SYSTEM           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
12   0        PDB:SYSAUX           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
13   0        PDB:UNDOTBS1         ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
14   0        PDB:UNDO_3           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
15   0        PDB:UNDO_4           ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
16   0        PDB:USERS            ***     +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11

12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> 

RMAN> run{
2> set until sequence 6 thread 3;
3> restore database;
4> recover database;
5> }

executing command: SET until clause

Starting restore at 2024-07-01 16:31:11
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:31:12
RMAN-06026: some targets not found - aborting restore

RMAN-06100: no channel to restore a backup or copy of datafile 1

RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
141     B  A  A SBT_TAPE    2024-06-16 12:28:18 1       1       YES        FULLDBBACKUP0617
142     B  F  A SBT_TAPE    2024-06-16 12:28:50 1       1       YES        FULLDBBACKUP0617
143     B  F  A SBT_TAPE    2024-06-16 12:29:16 1       1       YES        FULLDBBACKUP0617
144     B  F  A SBT_TAPE    2024-06-16 12:29:39 1       1       YES        FULLDBBACKUP0617
145     B  A  A SBT_TAPE    2024-06-16 12:29:44 1       1       YES        FULLDBBACKUP0617
146     B  F  A SBT_TAPE    2024-06-16 12:29:45 1       1       NO         TAG20240616T122945
147     B  A  A DISK        2024-06-16 12:33:25 1       1       YES        FULLDBBACKUP0617
148     B  F  A DISK        2024-06-16 12:33:58 1       1       YES        FULLDBBACKUP0617
149     B  F  A DISK        2024-06-16 12:34:23 1       1       YES        FULLDBBACKUP0617
150     B  F  A DISK        2024-06-16 12:34:47 1       1       YES        FULLDBBACKUP0617
151     B  A  A DISK        2024-06-16 12:34:51 1       1       YES        FULLDBBACKUP0617
152     B  F  A DISK        2024-06-16 12:34:52 1       1       NO         TAG20240616T123452
153     B  F  A DISK        2024-06-16 13:06:48 1       1       NO         TAG20240616T130648

 

  

RMAN> run{
2>  set until sequence 7 thread 3;----6刚好恢复不了
3>  restore database;
4>  recover database;
5>  }

executing command: SET until clause

Starting restore at 2024-07-01 17:52:52
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.258.1171797291
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.287.1171797291
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.302.1171797291
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.259.1171797291
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.290.1171797291
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.276.1171797291
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
channel ORA_DISK_1: restoring datafile 00012 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
channel ORA_DISK_1: restoring datafile 00013 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
channel ORA_DISK_1: restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
channel ORA_DISK_1: restoring datafile 00015 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
channel ORA_DISK_1: restoring datafile 00016 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
channel ORA_DISK_1: restoring datafile 00006 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
channel ORA_DISK_1: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 2024-07-01 17:54:47

Starting recover at 2024-07-01 17:54:47
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=3 sequence=6
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/annnf0_fulldbbackup0617_0.384.1171802091
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/annnf0_fulldbbackup0617_0.384.1171802091 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_6.261.1173160489 thread=3 sequence=6
channel default: deleting archived log(s)
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_6.261.1173160489 RECID=337 STAMP=1173203688
media recovery complete, elapsed time: 00:00:01
Finished recover at 2024-07-01 17:54:50

RMAN> alter database open resetlogs;

Statement processed

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 17:56:12 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE YES
SQL> 

------再次恢复就出问题了, 因为已经有了最新的redo-------------

RMAN> run{
2>  set until sequence 7 thread 3;
3>  restore database;
4>  recover database;
5>  }

executing command: SET until clause

Starting restore at 2024-07-01 18:01:54
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.341.1173160769
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.338.1173160769
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.331.1173160769
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.273.1173160769
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.259.1173160769
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.298.1173160769
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007

channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
channel ORA_DISK_1: restoring datafile 00012 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
channel ORA_DISK_1: restoring datafile 00013 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
channel ORA_DISK_1: restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
channel ORA_DISK_1: restoring datafile 00015 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
channel ORA_DISK_1: restoring datafile 00016 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
channel ORA_DISK_1: restoring datafile 00006 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
channel ORA_DISK_1: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 2024-07-01 18:03:29

Starting recover at 2024-07-01 18:03:29
using channel ORA_DISK_1

starting media recovery
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 18:03:31
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover
 if needed start until cancel using backup controlfile
ORA-00283: recovery session canceled due to errors
ORA-19912: cannot recover to target incarnation 18

RMAN> report schema;

using target database control file instead of recovery catalog
RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1170     SYSTEM               ***     +DATA/CDB/DATAFILE/system.273.1173160915
3    910      SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.298.1173160915
4    615      UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.259.1173160915
5    510      PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.269.1173160985
6    480      PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.267.1173160985
7    5        USERS                ***     +DATA/CDB/DATAFILE/users.341.1173160915
8    215      PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.270.1173160985
9    250      UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.331.1173160915
10   75       UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.338.1173160915
11   510      PDB:SYSTEM           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.276.1173160959
12   490      PDB:SYSAUX           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.360.1173160959
13   215      PDB:UNDOTBS1         ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.275.1173160959

restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421

restore出来的文件名不一样,可以备份后做过switch datafile?

14   215      PDB:UNDO_3           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.282.1173160959
15   215      PDB:UNDO_4           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.293.1173160959
16   5        PDB:USERS            ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.258.1173160959

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> recover database;

Starting recover at 2024-07-01 18:05:42
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1178 device type=DISK

starting media recovery
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 18:05:42
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover
 if needed start until cancel using backup controlfile
ORA-00283: recovery session canceled due to errors
ORA-19912: cannot recover to target incarnation 18---因为这个sequence 6 不在最新的里面

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59

12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
18      18      CDB      2265125454       CURRENT 7607066    2024-07-01 17:55:49
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> reset database to incarnation 17;   

database reset to incarnation 17

RMAN> recover database;

name=+DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_6.259.1173161195 thread=3 sequence=6
channel default: deleting archived log(s)
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_6.259.1173161195 RECID=337 STAMP=1173204395
unable to find archived log
archived log thread=3 sequence=7
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 18:06:37
RMAN-06054: media recovery requesting unknown archived log for thread 3 with sequence 7 and starting SCN of 7607065


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
         3 PDB                            MOUNTED

SQL> alter database open,   不能控制pdb不open
SQL> alter pluggable database pdb close abort;

Pluggable database altered.

SQL>  flashback pluggable database pdb to timestamp to_date('16-JUN-2024 12:32:46','DD-MON-YYYY HH24:MI:SS');
*
ERROR at line 1:
ORA-39892: PDB PITR/Flashback to a point in time on an orphan database
incarnation is not allowed.


--这种情况只能一步到位,pdb 不能再flashback了

 

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
 
[oracle@rac1 ~]$ rman target /

 

RMAN> restore  pluggable database pdb to timestamp to_date('16-JUN-2024 12:32:46','DD-MON-YYYY HH24:MI:SS');

RMAN-00571: ===========================================================
 

RMAN> restore  pluggable database pdb ;

 

channel ORA_DISK_1: restoring datafile 00014 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.282.1173160959
channel ORA_DISK_1: restoring datafile 00015 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.293.1173160959
channel ORA_DISK_1: restoring datafile 00016 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.258.1173160959
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulld 

RMAN> exit

[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 18:31:40 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN>   run{
2> set until time "(to_date('06/16/2024 12:30:00', 'mm/dd/yyyy hh24:mi:ss'))";
3> restore  pluggable database pdb ;
4>  ##recover database;
5>  }

 RMAN-06100: no channel to restore a backup or copy of datafile 11

RMAN>   run{
2> set until time "(to_date('06/16/2024 12:33:00', 'mm/dd/yyyy hh24:mi:ss'))";
3> restore  pluggable database pdb ;
4>  ##recover database;
5>  }


RMAN-06100: no channel to restore a backup or copy of datafile 11

RMAN>   run{
2> set until time "(to_date('06/16/2024 12:35:00', 'mm/dd/yyyy hh24:mi:ss'))";
3> restore  pluggable database pdb ;
4>  ##recover database;
5>  }

executing command: SET until clause

Starting restore at 2024-07-01 18:32:16
using channel ORA_DISK_1

skipping datafile 11; already restored to file +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.276.1173160959
skipping datafile 12; already restored to file +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.360.1173160959
skipping datafile 13; already restored to file +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.275.1173160959
skipping datafile 14; already restored to file +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.282.1173160959
skipping datafile 15; already restored to file +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.293.1173160959
skipping datafile 16; already restored to file +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.258.1173160959
restore not done; all files read only, offline, excluded, or already restored
Finished restore at 2024-07-01 18:32:17

RMAN> 

--------再做一次教科级恢复--------------------------------

RMAN>  list backup of  controlfile;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
146     Full    24.00M     SBT_TAPE    00:00:00     2024-06-16 12:29:45
        BP Key: 187   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T122945
        Handle: c-2265125454-20240616-0e   Media: /nfs,c-2265125454-202406
  Control File Included: Ckp SCN: 7606743      Ckp time: 2024-06-16 12:29:45

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
152     Full    19.45M     DISK        00:00:00     2024-06-16 12:34:52
        BP Key: 193   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T123452
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
  Control File Included: Ckp SCN: 7607081      Ckp time: 2024-06-16 12:34:52

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
153     Full    19.45M     DISK        00:00:00     2024-06-16 13:06:48
        BP Key: 194   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T130648
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
  Control File Included: Ckp SCN: 7817829      Ckp time: 2024-06-16 13:06:48

RMAN>  startup nomount force;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN>  restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093';

Starting restore at 2024-07-01 17:37:32
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=413 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 2024-07-01 17:37:35

RMAN> list backup of  controlfile;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 07/01/2024 17:37:39
ORA-01507: database not mounted

RMAN> 

RMAN> alter database mount;  

released channel: ORA_DISK_1
Statement processed

RMAN> list backup of  controlfile;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
146     Full    24.00M     SBT_TAPE    00:00:00     2024-06-16 12:29:45
        BP Key: 187   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T122945
        Handle: c-2265125454-20240616-0e   Media: /nfs,c-2265125454-202406
  Control File Included: Ckp SCN: 7606743      Ckp time: 2024-06-16 12:29:45

RMAN> list backup of database ;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
142     Full    600.00M    SBT_TAPE    00:00:32     2024-06-16 12:28:50
        BP Key: 183   Status: AVAILABLE  Compressed: YES  Tag: FULLDBBACKUP0617
        Handle: 5k2tghj2_180_1_1   Media: /nfs,5k2tghj2_180_1_1
  List of Datafiles in backup set 142
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1       Full 7605102    2024-06-16 12:28:18              NO    +DATA/CDB/DATAFILE/system.258.1171797291
  3       Full 7605102    2024-06-16 12:28:18              NO    +DATA/CDB/DATAFILE/sysaux.287.1171797291
  4       Full 7605102    2024-06-16 12:28:18              NO    +DATA/CDB/DATAFILE/undotbs1.302.1171797291
  7       Full 7605102    2024-06-16 12:28:18              NO    +DATA/CDB/DATAFILE/users.259.1171797291
  9       Full 7605102    2024-06-16 12:28:18              NO    +DATA/CDB/DATAFILE/undotbs2.290.1171797291
  10      Full 7605102    2024-06-16 12:28:18              NO    +DATA/CDB/DATAFILE/undotbs3.276.1171797291

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
143     Full    424.00M    SBT_TAPE    00:00:22     2024-06-16 12:29:16
        BP Key: 184   Status: AVAILABLE  Compressed: YES  Tag: FULLDBBACKUP0617
        Handle: 5l2tghk6_181_1_1   Media: /nfs,5l2tghk6_181_1_1
  List of Datafiles in backup set 143
  Container ID: 3, PDB Name: PDB
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  11      Full 7605114    2024-06-16 12:28:54              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
  12      Full 7605114    2024-06-16 12:28:54              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
  13      Full 7605114    2024-06-16 12:28:54              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
  14      Full 7605114    2024-06-16 12:28:54              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
  15      Full 7605114    2024-06-16 12:28:54              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
  16      Full 7605114    2024-06-16 12:28:54              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
144     Full    404.00M    SBT_TAPE    00:00:20     2024-06-16 12:29:39
        BP Key: 185   Status: AVAILABLE  Compressed: YES  Tag: FULLDBBACKUP0617
        Handle: 5m2tghkv_182_1_1   Media: /nfs,5m2tghkv_182_1_1
  List of Datafiles in backup set 144
  Container ID: 2, PDB Name: PDB$SEED
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  5       Full 5317292    2023-09-27 11:50:35              NO    +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
  6       Full 5317292    2023-09-27 11:50:35              NO    +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
  8       Full 5317292    2023-09-27 11:50:35              NO    +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
148     Full    598.23M    DISK        00:00:32     2024-06-16 12:33:58
        BP Key: 189   Status: AVAILABLE  Compressed: YES  Tag: FULLDBBACKUP0617
        Piece Name: +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
  List of Datafiles in backup set 148
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1       Full 7606990    2024-06-16 12:33:26              NO    +DATA/CDB/DATAFILE/system.258.1171797291
  3       Full 7606990    2024-06-16 12:33:26              NO    +DATA/CDB/DATAFILE/sysaux.287.1171797291
  4       Full 7606990    2024-06-16 12:33:26              NO    +DATA/CDB/DATAFILE/undotbs1.302.1171797291
  7       Full 7606990    2024-06-16 12:33:26              NO    +DATA/CDB/DATAFILE/users.259.1171797291
  9       Full 7606990    2024-06-16 12:33:26              NO    +DATA/CDB/DATAFILE/undotbs2.290.1171797291
  10      Full 7606990    2024-06-16 12:33:26              NO    +DATA/CDB/DATAFILE/undotbs3.276.1171797291

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
149     Full    421.28M    DISK        00:00:22     2024-06-16 12:34:23
        BP Key: 190   Status: AVAILABLE  Compressed: YES  Tag: FULLDBBACKUP0617
        Piece Name: +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
  List of Datafiles in backup set 149
  Container ID: 3, PDB Name: PDB
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  11      Full 7607003    2024-06-16 12:34:01              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
  12      Full 7607003    2024-06-16 12:34:01              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
  13      Full 7607003    2024-06-16 12:34:01              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
  14      Full 7607003    2024-06-16 12:34:01              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
  15      Full 7607003    2024-06-16 12:34:01              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
  16      Full 7607003    2024-06-16 12:34:01              NO    +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
150     Full    402.35M    DISK        00:00:21     2024-06-16 12:34:47
        BP Key: 191   Status: AVAILABLE  Compressed: YES  Tag: FULLDBBACKUP0617
        Piece Name: +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
  List of Datafiles in backup set 150
  Container ID: 2, PDB Name: PDB$SEED
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  5       Full 5317292    2023-09-27 11:50:35              NO    +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
  6       Full 5317292    2023-09-27 11:50:35              NO    +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
  8       Full 5317292    2023-09-27 11:50:35              NO    +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11
5       5       CDB      2265125454       PARENT  7326604    2024-06-16 02:21:34
14      14      CDB      2265125454       PARENT  7326605    2024-06-16 05:07:19
11      11      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:12:40
10      10      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:06:17
4       4       CDB      2265125454       ORPHAN  7326802    2024-06-16 02:12:57
3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> restore database;

Starting restore at 2024-07-01 17:38:44
Starting implicit crosscheck backup at 2024-07-01 17:38:44
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1184 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 2024-07-01 17:38:45

Starting implicit crosscheck copy at 2024-07-01 17:38:45
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 2024-07-01 17:38:45

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.258.1171797291
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.287.1171797291
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.302.1171797291
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.259.1171797291
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.290.1171797291
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.276.1171797291
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.296.1171800421
channel ORA_DISK_1: restoring datafile 00012 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.289.1171800421
channel ORA_DISK_1: restoring datafile 00013 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.259.1171800421
channel ORA_DISK_1: restoring datafile 00014 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.338.1171800421
channel ORA_DISK_1: restoring datafile 00015 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.345.1171800421
channel ORA_DISK_1: restoring datafile 00016 to +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.347.1171800421
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
channel ORA_DISK_1: restoring datafile 00006 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
channel ORA_DISK_1: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 2024-07-01 17:40:21

RMAN>  list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18

15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> report schema;

RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1170     SYSTEM               ***     +DATA/CDB/DATAFILE/system.270.1173159525
3    910      SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.261.1173159525
4    615      UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.275.1173159525
5    510      PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.292.1173159597
6    480      PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.265.1173159597
7    5        USERS                ***     +DATA/CDB/DATAFILE/users.258.1173159525
8    215      PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.268.1173159597
9    250      UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.282.1173159525
10   75       UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.293.1173159525
11   510      PDB:SYSTEM           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.287.1173159571
12   490      PDB:SYSAUX           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.302.1173159571
13   215      PDB:UNDOTBS1         ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.290.1173159571
14   215      PDB:UNDO_3           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.288.1173159571
15   215      PDB:UNDO_4           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.272.1173159571
16   5        PDB:USERS            ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.291.1173159571

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.279.1171775251

RMAN> run{
2> set until sequence 7 thread 3;
3> ##restore database;
4> recover database;
5> }

executing command: SET until clause

Starting recover at 2024-07-01 17:41:22
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=3 sequence=6
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/annnf0_fulldbbackup0617_0.384.1171802091
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/annnf0_fulldbbackup0617_0.384.1171802091 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_6.289.1173159683 thread=3 sequence=6
channel default: deleting archived log(s)
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_07_01/thread_3_seq_6.289.1173159683 RECID=337 STAMP=1173202883
media recovery complete, elapsed time: 00:00:00
Finished recover at 2024-07-01 17:41:24

RMAN> alter database open resetlogs;

Statement processed

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 17:41:54 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE YES
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 17:44:18 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1170     SYSTEM               YES     +DATA/CDB/DATAFILE/system.270.1173159525
3    910      SYSAUX               NO      +DATA/CDB/DATAFILE/sysaux.261.1173159525
4    615      UNDOTBS1             YES     +DATA/CDB/DATAFILE/undotbs1.275.1173159525
5    510      PDB$SEED:SYSTEM      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.292.1173159597
6    480      PDB$SEED:SYSAUX      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.265.1173159597
7    5        USERS                NO      +DATA/CDB/DATAFILE/users.258.1173159525
8    215      PDB$SEED:UNDOTBS1    NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.268.1173159597
9    250      UNDOTBS2             YES     +DATA/CDB/DATAFILE/undotbs2.282.1173159525
10   75       UNDOTBS3             YES     +DATA/CDB/DATAFILE/undotbs3.293.1173159525
11   510      PDB:SYSTEM           NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.287.1173159571
12   490      PDB:SYSAUX           NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.302.1173159571
13   215      PDB:UNDOTBS1         NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.290.1173159571
14   215      PDB:UNDO_3           NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.288.1173159571
15   215      PDB:UNDO_4           NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.272.1173159571
16   5        PDB:USERS            NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.291.1173159571

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.341.1173159699

RMAN> list incarnation;      


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
-
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
18      18      CDB      2265125454       CURRENT 7607066    2024-07-01 17:41:33
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN>

RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
141     B  A  A SBT_TAPE    2024-06-16 12:28:18 1       1       YES        FULLDBBACKUP0617
142     B  F  A SBT_TAPE    2024-06-16 12:28:50 1       1       YES        FULLDBBACKUP0617
143     B  F  A SBT_TAPE    2024-06-16 12:29:16 1       1       YES        FULLDBBACKUP0617
144     B  F  A SBT_TAPE    2024-06-16 12:29:39 1       1       YES        FULLDBBACKUP0617
145     B  A  A SBT_TAPE    2024-06-16 12:29:44 1       1       YES        FULLDBBACKUP0617
146     B  F  A SBT_TAPE    2024-06-16 12:29:45 1       1       NO         TAG20240616T122945
147     B  A  A DISK        2024-06-16 12:33:25 1       1       YES        FULLDBBACKUP0617
148     B  F  A DISK        2024-06-16 12:33:58 1       1       YES        FULLDBBACKUP0617
149     B  F  A DISK        2024-06-16 12:34:23 1       1       YES        FULLDBBACKUP0617
150     B  F  A DISK        2024-06-16 12:34:47 1       1       YES        FULLDBBACKUP0617
151     B  A  A DISK        2024-06-16 12:34:51 1       1       YES        FULLDBBACKUP0617
152     B  F  A DISK        2024-06-16 12:34:52 1       1       NO         TAG20240616T123452
153     B  F  A DISK        2024-06-16 13:06:48 1       1       NO         TAG20240616T130648

RMAN> list backup of controlfile summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
146     B  F  A SBT_TAPE    2024-06-16 12:29:45 1       1       NO         TAG20240616T122945
152     B  F  A DISK        2024-06-16 12:34:52 1       1       NO         TAG20240616T123452
153     B  F  A DISK        2024-06-16 13:06:48 1       1       NO         TAG20240616T130648

RMAN> restore controlfile from tag TAG20240616T130648;

Starting restore at 2024-07-01 16:35:43
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:35:43
RMAN-06496: must use the TO clause when the database is mounted or open

RMAN> restore controlfile from tag TAG20240616T130648 to 'data1';

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "to": expecting one of: "allforeign, application, archivelog, asdecrypted, asencrypted, backupset, channel, check, controlfile, database, database root, datafile, device, dump, farsync, file_name_convert, force, foreign, from, frompreplugin, from service, high, pluggable, preview, primary, section, skip preplugin, skip readonly, spfile, standby, tablespace, to restore point, until restore point, until, using, validate, (, ;"
RMAN-01007: at line 1 column 49 file: standard input

RMAN>  restore controlfile from tag TAG20240616T130648 ;      

Starting restore at 2024-07-01 16:37:06
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:37:06
RMAN-06496: must use the TO clause when the database is mounted or open

RMAN> startup nomount;   

database is already started

RMAN> startup nomount force;

Oracle instance started

Total System Global Area     574615864 bytes

Fixed Size                     9167160 bytes
Variable Size                524288000 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7606272 bytes

RMAN> restore controlfile from tag TAG20240616T130648 ; 

Starting restore at 2024-07-01 16:37:32
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=416 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:37:32
RMAN-06563: control file or SPFILE must be restored using FROM AUTOBACKUP

RMAN> alter database mount; 

released channel: ORA_DISK_1
Statement processed

--------------TAG20240616T123452 恢复不了,那就看看具体内容

RMAN>  list backup of controlfile;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
146     Full    24.00M     SBT_TAPE    00:00:00     2024-06-16 12:29:45
        BP Key: 187   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T122945
        Handle: c-2265125454-20240616-0e   Media: /nfs,c-2265125454-202406
  Control File Included: Ckp SCN: 7606743      Ckp time: 2024-06-16 12:29:45

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
152     Full    19.45M     DISK        00:00:00     2024-06-16 12:34:52
        BP Key: 193   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T123452
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
  Control File Included: Ckp SCN: 7607081      Ckp time: 2024-06-16 12:34:52

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
153     Full    19.45M     DISK        00:00:00     2024-06-16 13:06:48
        BP Key: 194   Status: AVAILABLE  Compressed: NO  Tag: TAG20240616T130648
        Piece Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
  Control File Included: Ckp SCN: 7817829      Ckp time: 2024-06-16 13:06:48

388.1171802093 是12点34分的备份
338.1171804009 

RMAN> startup nomount force;

RMAN> 

RMAN> restore controlfile from '+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009'
2> ;

Starting restore at 2024-07-01 16:38:38
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=418 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/CDB/CONTROLFILE/current.303.1148478735
output file name=+DATA/CDB/CONTROLFILE/current.289.1148478735
Finished restore at 2024-07-01 16:38:40

RMAN> restore database;

Starting restore at 2024-07-01 16:38:44
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2024 16:38:44
ORA-01507: database not mounted

RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11
5       5       CDB      2265125454       PARENT  7326604    2024-06-16 02:21:34
14      14      CDB      2265125454       PARENT  7326605    2024-06-16 05:07:19
11      11      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:12:40
10      10      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:06:17
4       4       CDB      2265125454       ORPHAN  7326802    2024-06-16 02:12:57
3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN>  restore database;

Starting restore at 2024-07-01 16:39:09
Starting implicit crosscheck backup at 2024-07-01 16:39:09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1151 device type=DISK
Crosschecked 6 objects
Finished implicit crosscheck backup at 2024-07-01 16:39:09

Starting implicit crosscheck copy at 2024-07-01 16:39:09
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 2024-07-01 16:39:09

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171804008.338.1171804009
File Name: +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.258.1171797291
channel ORA_DISK_1: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.287.1171797291
channel ORA_DISK_1: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.302.1171797291
channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.259.1171797291
channel ORA_DISK_1: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.290.1171797291
channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.276.1171797291
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.280.1171797313
channel ORA_DISK_1: restoring datafile 00006 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.285.1171797313
channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.293.1171797313
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067
channel ORA_DISK_1: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.382.1171802067 tag=FULLDBBACKUP0617
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 2024-07-01 16:40:20

RMAN> run{
2> set until sequence 6 thread 3;---
应该要大一个
3> ##restore database;
4> recover database;
5> }

executing command: SET until clause

Starting recover at 2024-07-01 16:40:40
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 16:40:40
RMAN-06556: datafile 1 must be restored from backup older than SCN 7606958

RMAN> recover database;

Starting recover at 2024-07-01 16:40:52
using channel ORA_DISK_1

starting media recovery

archived log for thread 3 with sequence 6 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091
archived log for thread 3 with sequence 7 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
archived log for thread 3 with sequence 8 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111
archived log for thread 3 with sequence 9 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091 thread=3 sequence=6
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027 thread=3 sequence=7
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_8.289.1171803111 thread=3 sequence=8
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_9.373.1171818489 thread=3 sequence=9
unable to find archived log
archived log thread=3 sequence=10
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2024 16:40:54
RMAN-06054: media recovery requesting unknown archived log for thread 3 with sequence 10 and starting SCN of 7821101

RMAN> list incarnation; 


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11
5       5       CDB      2265125454       PARENT  7326604    2024-06-16 02:21:34
14      14      CDB      2265125454       PARENT  7326605    2024-06-16 05:07:19
11      11      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:12:40
10      10      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:06:17
4       4       CDB      2265125454       ORPHAN  7326802    2024-06-16 02:12:57
3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
17      17      CDB      2265125454       CURRENT 7500404    2024-06-16 12:04:56
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52

9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42

RMAN> 

RMAN> alter database open resetlogs;--resetlogs之前也没有新的incarnation出现

Statement processed

RMAN> list incarnation; 


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB      2265125454       PARENT  1          2019-04-17 00:55:59
2       2       CDB      2265125454       PARENT  1920977    2023-09-26 01:52:18
6       6       CDB      2265125454       ORPHAN  7326532    2024-06-16 02:38:11
5       5       CDB      2265125454       PARENT  7326604    2024-06-16 02:21:34
14      14      CDB      2265125454       PARENT  7326605    2024-06-16 05:07:19
11      11      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:12:40
10      10      CDB      2265125454       ORPHAN  7326605    2024-06-16 02:06:17
4       4       CDB      2265125454       ORPHAN  7326802    2024-06-16 02:12:57
3       3       CDB      2265125454       ORPHAN  7329707    2024-06-16 03:22:45
7       7       CDB      2265125454       ORPHAN  7329707    2024-06-16 02:47:21
13      13      CDB      2265125454       ORPHAN  7329708    2024-06-16 05:00:46
12      12      CDB      2265125454       ORPHAN  7329708    2024-06-16 02:24:41
15      15      CDB      2265125454       PARENT  7496028    2024-06-16 11:16:00
17      17      CDB      2265125454       PARENT  7500404    2024-06-16 12:04:56
16      16      CDB      2265125454       ORPHAN  7500404    2024-06-16 11:46:27
8       8       CDB      2265125454       ORPHAN  7512942    2024-06-16 12:11:52
9       9       CDB      2265125454       ORPHAN  7620289    2024-06-16 01:44:42
18      18      CDB      2265125454       CURRENT 7821102    2024-07-01 16:41:22

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 16:41:42 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> showp pdbs;
SP2-0042: unknown command "showp pdbs" - rest of line ignored.
SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 16:42:04 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> rman target /
SP2-0734: unknown command beginning "rman targe..." - rest of line ignored.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 1 16:42:13 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1170     SYSTEM               YES     +DATA/CDB/DATAFILE/system.350.1173155951
3    910      SYSAUX               NO      +DATA/CDB/DATAFILE/sysaux.269.1173155951
4    615      UNDOTBS1             YES     +DATA/CDB/DATAFILE/undotbs1.267.1173155951
5    510      PDB$SEED:SYSTEM      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.282.1173155995
6    480      PDB$SEED:SYSAUX      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.293.1173155995
7    5        USERS                NO      +DATA/CDB/DATAFILE/users.279.1173155951
8    215      PDB$SEED:UNDOTBS1    NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.284.1173155995
9    250      UNDOTBS2             YES     +DATA/CDB/DATAFILE/undotbs2.261.1173155951
10   75       UNDOTBS3             YES     +DATA/CDB/DATAFILE/undotbs3.270.1173155951

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.276.1173156087

RMAN> 

RMAN>  recover pluggable database pdb  until time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')" auxiliary destination '+data1';

Starting recover at 2024-07-01 16:43:13
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=433 device type=DISK
RMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1
Tablespace UNDOTBS2
Tablespace UNDOTBS3

Creating automatic instance, with SID='khBq'

initialization parameters used for automatic instance:
db_name=CDB
db_unique_name=khBq_pitr_pdb_CDB
compatible=19.0.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_pdb_name_case_sensitive=false
_system_trig_enabled=FALSE
db_domain=cj.com
sga_target=548M
processes=200
db_create_file_dest=+data1
log_archive_dest_1='location=+data1'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance CDB

Oracle instance started

Total System Global Area     574618552 bytes

Fixed Size                     9165752 bytes
Variable Size                213909504 bytes
Database Buffers             343932928 bytes
Redo Buffers                   7610368 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# restore the controlfile
restore clone controlfile;
 
# mount the controlfile
sql clone 'alter database mount clone database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 2024-07-01 16:43:21
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=184 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/AUTOBACKUP/2024_06_16/s_1171802092.388.1171802093 tag=TAG20240616T123452
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
output file name=+DATA1/CDB/CONTROLFILE/current.346.1173156205
Finished restore at 2024-07-01 16:43:25

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  4 to new;
set newname for clone datafile  9 to new;
set newname for clone datafile  10 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  7 to new;
set newname for datafile  11 to new;
set newname for datafile  12 to new;
set newname for datafile  13 to new;
set newname for datafile  14 to new;
set newname for datafile  15 to new;
set newname for datafile  16 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 4, 9, 10, 3, 7, 11, 12, 13, 14, 15, 16;
 
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2024-07-01 16:43:30
using channel ORA_AUX_DISK_1

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 00001 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00004 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00009 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00010 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00003 to +data1
channel ORA_AUX_DISK_1: restoring datafile 00007 to +data1
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.377.1171802007 tag=FULLDBBACKUP0617
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
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 00011 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00012 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00013 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00014 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00015 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00016 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece +DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041
channel ORA_AUX_DISK_1: piece handle=+DATA1/CDB/06344F62B8C65A17E0636401A8C0F073/BACKUPSET/2024_06_16/nnndf0_fulldbbackup0617_0.381.1171802041 tag=FULLDBBACKUP0617
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 2024-07-01 16:44:50

datafile 11 switched to datafile copy
input datafile copy RECID=37 STAMP=1173199491 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.290.1173156255
datafile 12 switched to datafile copy
input datafile copy RECID=38 STAMP=1173199491 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.302.1173156255
datafile 13 switched to datafile copy
input datafile copy RECID=39 STAMP=1173199491 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.287.1173156255
datafile 14 switched to datafile copy
input datafile copy RECID=40 STAMP=1173199491 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.258.1173156255
datafile 15 switched to datafile copy
input datafile copy RECID=41 STAMP=1173199491 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.275.1173156255
datafile 16 switched to datafile copy
input datafile copy RECID=42 STAMP=1173199491 file name=+DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.360.1173156255
datafile 1 switched to datafile copy
input datafile copy RECID=43 STAMP=1173199491 file name=+DATA1/CDB/DATAFILE/system.316.1173156211
datafile 4 switched to datafile copy
input datafile copy RECID=44 STAMP=1173199491 file name=+DATA1/CDB/DATAFILE/undotbs1.266.1173156211
datafile 9 switched to datafile copy
input datafile copy RECID=45 STAMP=1173199491 file name=+DATA1/CDB/DATAFILE/undotbs2.368.1173156211
datafile 10 switched to datafile copy
input datafile copy RECID=46 STAMP=1173199491 file name=+DATA1/CDB/DATAFILE/undotbs3.261.1173156211
datafile 3 switched to datafile copy
input datafile copy RECID=47 STAMP=1173199491 file name=+DATA1/CDB/DATAFILE/sysaux.409.1173156211
datafile 7 switched to datafile copy
input datafile copy RECID=48 STAMP=1173199491 file name=+DATA1/CDB/DATAFILE/users.297.1173156211

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('16-JUN-2024 12:35:46','DD-MON-YYYY HH24:MI:SS')";
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  4 online";
sql clone "alter database datafile  9 online";
sql clone "alter database datafile  10 online";
sql clone "alter database datafile  3 online";
sql clone "alter database datafile  7 online";
sql clone 'PDB' "alter database datafile 
 11 online";
sql clone 'PDB' "alter database datafile 
 12 online";
sql clone 'PDB' "alter database datafile 
 13 online";
sql clone 'PDB' "alter database datafile 
 14 online";
sql clone 'PDB' "alter database datafile 
 15 online";
sql clone 'PDB' "alter database datafile 
 16 online";
#recover pdb
recover clone database tablespace  "SYSTEM", "UNDOTBS1", "UNDOTBS2", "UNDOTBS3", "SYSAUX", "USERS" pluggable database 
 'PDB'  delete archivelog;
#open in read write mode
sql clone 'alter database open resetlogs';
#unplug dropped pdb into temp file
sql clone "alter pluggable database PDB unplug into ''
/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_khBq.xml''";
#create pdb using temp file of recovered pdb
sql "create pluggable database PDB using ''
/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_khBq.xml'' nocopy tempfile reuse";
alter pluggable database PDB open;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  4 online

sql statement: alter database datafile  9 online

sql statement: alter database datafile  10 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  7 online

sql statement: alter database datafile  11 online

sql statement: alter database datafile  12 online

sql statement: alter database datafile  13 online

sql statement: alter database datafile  14 online

sql statement: alter database datafile  15 online

sql statement: alter database datafile  16 online

Starting recover at 2024-07-01 16:44:52
using channel ORA_AUX_DISK_1

Executing: alter database datafile 5, 6, 8 offline
starting media recovery

archived log for thread 3 with sequence 6 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091
archived log for thread 3 with sequence 7 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_6.383.1171802091 thread=3 sequence=6
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_06_16/thread_3_seq_7.296.1171803027 thread=3 sequence=7
media recovery complete, elapsed time: 00:00:01
Finished recover at 2024-07-01 16:44:54

sql statement: alter database open resetlogs

sql statement: alter pluggable database PDB unplug into ''/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_khBq.xml''

sql statement: create pluggable database PDB using ''/u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_khBq.xml'' nocopy tempfile reuse

Statement processed

Removing automatic instance
shutting down automatic instance 
Oracle instance shut down
Automatic instance removed
auxiliary instance file /u01/app/oracle/product/19.0.0/db_1/dbs/_rm_pdb_pitr_2_khBq.xml deleted
auxiliary instance file +DATA1/CDB/DATAFILE/sysaux.409.1173156211 deleted
auxiliary instance file +DATA1/CDB/CONTROLFILE/current.346.1173156205 deleted
Finished recover at 2024-07-01 16:45:28

RMAN> report schema;

Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1180     SYSTEM               YES     +DATA/CDB/DATAFILE/system.350.1173155951
3    910      SYSAUX               NO      +DATA/CDB/DATAFILE/sysaux.269.1173155951
4    615      UNDOTBS1             YES     +DATA/CDB/DATAFILE/undotbs1.267.1173155951
5    510      PDB$SEED:SYSTEM      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.282.1173155995
6    480      PDB$SEED:SYSAUX      NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.293.1173155995
7    5        USERS                NO      +DATA/CDB/DATAFILE/users.279.1173155951
8    215      PDB$SEED:UNDOTBS1    NO      +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.284.1173155995
9    250      UNDOTBS2             YES     +DATA/CDB/DATAFILE/undotbs2.261.1173155951
10   75       UNDOTBS3             YES     +DATA/CDB/DATAFILE/undotbs3.270.1173155951
29   510      PDB:SYSTEM           YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.290.1173156255
30   490      PDB:SYSAUX           NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.302.1173156255
31   215      PDB:UNDOTBS1         YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.287.1173156255
32   215      PDB:UNDO_3           YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.258.1173156255
33   215      PDB:UNDO_4           YES     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.275.1173156255
34   5        PDB:USERS            NO      +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.360.1173156255

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    24       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.347.1171775247
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.276.1173156087

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 07/01/2024 16:46:00
ORA-01531: a database already open by the instance

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 1 16:46:05 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE NO
SQL> 

-----restore pdb 看看

  • 15
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值