Announcements

Oracle training based on real-time expertise as per industry standards. Upcoming batch details are here.

View batch schedule

Free Oracle mock interview. Register using the link.

Register

#DBAchallenge: submit your questions.

Ask questions
Swipe for more →
Browse by Topic
Latest Posts

    Tuesday, July 6, 2021

    Restore & Recover Vs Clone - RMAN Restore and Clone differences

    Restore & Recover Vs Clone - RMAN Restore and Clone differences


    1. Source Database Details and Source Database Backup
    2. Copy Source Database Backup to Target Server
    3. RMAN Restore and Recover on Target Server to build new Database
    4. RMAN Clone on Target Server to build new Database 


    ##################################################################

    This Entire Activity logs can be found at bottom of this Article:

    ##################################################################

    1. Source Database Details and Source Database Backup

    =====================================================
    env |grep ORA
    sqlplus / as sysdba
    select DBID from v$database;

    rman target /
    run {
    allocate channel ch1 device type disk;
    crosscheck backup;
    crosscheck archivelog all;
    DELETE noprompt BACKUP COMPLETED BEFORE 'SYSDATE-2';
    DELETE noprompt archivelog all COMPLETED BEFORE 'SYSDATE-1';
    backup as backupset database format '/u01/backup/Fullback_%T_%U'
    plus archivelog format '/u01/backup/Archive_%T_%U';
    backup current controlfile format '/u01/backup/Controlback_%T_%U';
    release channel ch1;
    }

    2. Copy Source Database Backup to Target Server

    ===============================================
    scp *  oracle@10.38.4.109:/u01/backup/
    scp /u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2021_07_05/o1_mf_s_1077141943_jg6f6ztt_.bkp oracle@10.38.4.109:/u01/backup/


    3. RMAN Restore and Recover on Target Server to build new Database

    ===================================================================
    1. Take Source DB backup 
    2. Copy backups to Target Server 
    3. Start the Target Server DB in nomount 
    4. Restore Target DB controlfile 
    5. Restore Target DB 
    6. Recover Target DB
    7. Open Target DB with resetlogs

    Notes:
    1. Target DB name is same as source DB name
    2. Target DBID same as Source DBID 


    mkdir -p /u01/app/oracle/fast_recovery_area/DEVDB/archivelog
    mkdir -p /u01/app/oracle/oradata/DEVDB/datafile
    mkdir -p /u01/app/oracle/oradata/DEVDB/controlfile
    mkdir -p /u01/app/oracle/fast_recovery_area/DEVDB/controlfile

    sqlplus / as sysdba
    startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora';

    rman target /
    restore controlfile from '/u01/backup/Controlback_20210705_1q037odl_1_1';
    alter database mount;
    run {
    restore database;
    switch datafile all;
    recover database;
    }

    alter database open resetlogs;

    select DBID from v$database;


    4. RMAN Clone on Target Server to build new Database 

    ====================================================
    1. Take Source DB backup 
    2. Copy backups to Target Server 
    3. Start the Target Server DB in nomount 
    4. Clone the the Database (Source to Target)

    Notes:
    1. Target DB name may or maynot be same as source DB name(As per your wish)
    2. Target DBID different that the Source DBID 

    mkdir -p /u01/app/oracle/fast_recovery_area/DEVDB/archivelog
    mkdir -p /u01/app/oracle/oradata/DEVDB/datafile
    mkdir -p /u01/app/oracle/oradata/DEVDB/controlfile
    mkdir -p /u01/app/oracle/fast_recovery_area/DEVDB/controlfile

    sqlplus / as sysdba
    startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora';

    Clone with same name as source database Name

    rman AUXILIARY /
    run {
    DUPLICATE TARGET DATABASE TO DEVDB
    SPFILE
    BACKUP LOCATION '/u01/backup'
    NOFILENAMECHECK;
    }

    Clone with different name as source database Name

    sqlplus / as sysdba
    startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEV.ora';

    rman AUXILIARY /
    run{
    DUPLICATE DATABASE TO DEV 
      SPFILE
        parameter_value_convert ('DEVDB','DEV')
        set db_file_name_convert='/u01/app/oracle/oradata/DEVDB','/u01/app/oracle/oradata/DEV'
        set log_file_name_convert='/u01/app/oracle/oradata/DEVDB','/u01/app/oracle/oradata/DEV','/u01/app/oracle/fast_recovery_area/DEVDB','/u01/app/oracle/fast_recovery_area/DEV'
        set control_files='/u01/app/oracle/oradata/DEV/controlfile/control01.ctl','/u01/app/oracle/fast_recovery_area/DEV/controlfile/control02.ctl'
        set db_name='DEV'
        set log_archive_dest_1='location=/u01/app/oracle/fast_recovery_area/DEV'
      BACKUP LOCATION '/u01/backup'
      NOFILENAMECHECK;
    }

    ##################################################################

    logs:

    ##################################################################

    Source Database Details and Source Database Backup

    ==================================================
    [oracle@oraclelab2 ~]$ ps -ef|grep smon
    salcorp1 16260     1  0 Jun24 ?        00:00:31 ora_smon_alcprd01
    oracle   16686 16618  0 22:03 pts/2    00:00:00 grep --color=auto smon
    salcorp2 17574     1  0 Jun24 ?        00:00:16 ora_smon_alcprd02
    oracle   20280     1  0 03:09 ?        00:00:01 ora_smon_DEVDB

    [oracle@oraclelab2 ~]$ . oraenv
    ORACLE_SID = [oracle] ? DEVDB
    The Oracle base has been set to /u01/app/oracle
    [oracle@oraclelab2 ~]$ env |grep ORA
    ORACLE_SID=DEVDB
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1

    [oracle@oraclelab2 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 5 22:04:05 2021
    Version 19.3.0.0.0

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

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

    SQL> select DBID from v$database;

          DBID
    ----------
     981794806

    SQL>

    [oracle@oraclelab2 backup]$ rman target /
    Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 5 22:05:05 2021
    Version 19.3.0.0.0

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

    connected to target database: DEVDB (DBID=981794806)

    RMAN> run {
    allocate channel ch1 device type disk;
    2> 3> crosscheck backup;
    4> crosscheck archivelog all;
    5> DELETE noprompt BACKUP COMPLETED BEFORE 'SYSDATE-2';
    DELETE noprompt archivelog all COMPLETED BEFORE 'SYSDATE-1';
    6> 7> backup as backupset database format '/u01/backup/Fullback_%T_%U'
    8> plus archivelog format '/u01/backup/Archive_%T_%U';
    9> backup current controlfile format '/u01/backup/Controlback_%T_%U';
    release channel ch1;
    }10> 11>

    using target database control file instead of recovery catalog
    allocated channel: ch1
    channel ch1: SID=4 device type=DISK

    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u01/backup/Archive_20210705_1i036bhd_1_1 RECID=50 STAMP=1077095981
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u01/backup/Fullback_20210705_1j036bhg_1_1 RECID=51 STAMP=1077095984
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u01/backup/Archive_20210705_1k036bhn_1_1 RECID=52 STAMP=1077095991
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u01/backup/Controlback_20210705_1l036bhp_1_1 RECID=53 STAMP=1077095994
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2021_07_05/o1_mf_s_1077095995_jg50c360_.bkp RECID=54 STAMP=1077095995
    Crosschecked 5 objects

    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_5_jg42f3ko_.arc RECID=1 STAMP=1077065340
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_6_jg42fnxs_.arc RECID=2 STAMP=1077065356
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_7_jg44tydz_.arc RECID=3 STAMP=1077067830
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_8_jg44w8xx_.arc RECID=4 STAMP=1077067872
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_9_jg4573tc_.arc RECID=5 STAMP=1077068219
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_10_jg457ncc_.arc RECID=6 STAMP=1077068236
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_11_jg45r3t6_.arc RECID=7 STAMP=1077068763
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_12_jg45r8h9_.arc RECID=8 STAMP=1077068768
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_13_jg463087_.arc RECID=9 STAMP=1077069112
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_14_jg4638qy_.arc RECID=10 STAMP=1077069120
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_15_jg467hhz_.arc RECID=11 STAMP=1077069255
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_16_jg467n17_.arc RECID=12 STAMP=1077069260
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_17_jg47xmv1_.arc RECID=13 STAMP=1077070987
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_18_jg47yy9w_.arc RECID=14 STAMP=1077071030
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_19_jg48966q_.arc RECID=15 STAMP=1077071358
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_20_jg489nol_.arc RECID=16 STAMP=1077071372
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_21_jg4b543o_.arc RECID=17 STAMP=1077073276
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_22_jg4b5llk_.arc RECID=18 STAMP=1077073290
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_23_jg4btr44_.arc RECID=19 STAMP=1077073968
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_24_jg4bw2o3_.arc RECID=20 STAMP=1077074010
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_25_jg4c18q8_.arc RECID=21 STAMP=1077074176
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_26_jg4c1m7s_.arc RECID=22 STAMP=1077074187
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_27_jg50bo2o_.arc RECID=23 STAMP=1077095981
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_28_jg50bzpf_.arc RECID=24 STAMP=1077095991
    validation succeeded for archived log
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_29_jg6dzwvc_.arc RECID=25 STAMP=1077141717
    Crosschecked 25 objects

    specification does not match any backup in the repository

    Starting backup at 05-JUL-21
    current log archived
    channel ch1: starting archived log backup set
    channel ch1: specifying archived log(s) in backup set
    input archived log thread=1 sequence=5 RECID=1 STAMP=1077065340
    input archived log thread=1 sequence=6 RECID=2 STAMP=1077065356
    input archived log thread=1 sequence=7 RECID=3 STAMP=1077067830
    input archived log thread=1 sequence=8 RECID=4 STAMP=1077067872
    input archived log thread=1 sequence=9 RECID=5 STAMP=1077068219
    input archived log thread=1 sequence=10 RECID=6 STAMP=1077068236
    input archived log thread=1 sequence=11 RECID=7 STAMP=1077068763
    input archived log thread=1 sequence=12 RECID=8 STAMP=1077068768
    input archived log thread=1 sequence=13 RECID=9 STAMP=1077069112
    input archived log thread=1 sequence=14 RECID=10 STAMP=1077069120
    input archived log thread=1 sequence=15 RECID=11 STAMP=1077069255
    input archived log thread=1 sequence=16 RECID=12 STAMP=1077069260
    input archived log thread=1 sequence=17 RECID=13 STAMP=1077070987
    input archived log thread=1 sequence=18 RECID=14 STAMP=1077071030
    input archived log thread=1 sequence=19 RECID=15 STAMP=1077071358
    input archived log thread=1 sequence=20 RECID=16 STAMP=1077071372
    input archived log thread=1 sequence=21 RECID=17 STAMP=1077073276
    input archived log thread=1 sequence=22 RECID=18 STAMP=1077073290
    input archived log thread=1 sequence=23 RECID=19 STAMP=1077073968
    input archived log thread=1 sequence=24 RECID=20 STAMP=1077074010
    input archived log thread=1 sequence=25 RECID=21 STAMP=1077074176
    input archived log thread=1 sequence=26 RECID=22 STAMP=1077074187
    input archived log thread=1 sequence=27 RECID=23 STAMP=1077095981
    input archived log thread=1 sequence=28 RECID=24 STAMP=1077095991
    input archived log thread=1 sequence=29 RECID=25 STAMP=1077141717
    input archived log thread=1 sequence=30 RECID=26 STAMP=1077141921
    channel ch1: starting piece 1 at 05-JUL-21
    channel ch1: finished piece 1 at 05-JUL-21
    piece handle=/u01/backup/Archive_20210705_1n037od1_1_1 tag=TAG20210705T220521 comment=NONE
    channel ch1: backup set complete, elapsed time: 00:00:03
    Finished backup at 05-JUL-21

    Starting backup at 05-JUL-21
    channel ch1: starting full datafile backup set
    channel ch1: specifying datafile(s) in backup set
    input datafile file number=00001 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_jg41sonl_.dbf
    input datafile file number=00003 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_jg41trso_.dbf
    input datafile file number=00004 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_jg41vky8_.dbf
    input datafile file number=00007 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_jg41vlz4_.dbf
    channel ch1: starting piece 1 at 05-JUL-21
    channel ch1: finished piece 1 at 05-JUL-21
    piece handle=/u01/backup/Fullback_20210705_1o037od5_1_1 tag=TAG20210705T220525 comment=NONE
    channel ch1: backup set complete, elapsed time: 00:00:15
    Finished backup at 05-JUL-21

    Starting backup at 05-JUL-21
    current log archived
    channel ch1: starting archived log backup set
    channel ch1: specifying archived log(s) in backup set
    input archived log thread=1 sequence=31 RECID=27 STAMP=1077141940
    channel ch1: starting piece 1 at 05-JUL-21
    channel ch1: finished piece 1 at 05-JUL-21
    piece handle=/u01/backup/Archive_20210705_1p037odk_1_1 tag=TAG20210705T220540 comment=NONE
    channel ch1: backup set complete, elapsed time: 00:00:01
    Finished backup at 05-JUL-21

    Starting backup at 05-JUL-21
    channel ch1: starting full datafile backup set
    channel ch1: specifying datafile(s) in backup set
    including current control file in backup set
    channel ch1: starting piece 1 at 05-JUL-21
    channel ch1: finished piece 1 at 05-JUL-21
    piece handle=/u01/backup/Controlback_20210705_1q037odl_1_1 tag=TAG20210705T220541 comment=NONE
    channel ch1: backup set complete, elapsed time: 00:00:01
    Finished backup at 05-JUL-21

    Starting Control File and SPFILE Autobackup at 05-JUL-21
    piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2021_07_05/o1_mf_s_1077141943_jg6f6ztt_.bkp comment=NONE
    Finished Control File and SPFILE Autobackup at 05-JUL-21

    released channel: ch1

    RMAN> exit
    Recovery Manager complete.

    [oracle@oraclelab2 backup]$ ll
    total 1640064
    -rw-r-----. 1 oracle oinstall  350958080 Jul  5 22:05 Archive_20210705_1n037od1_1_1
    -rw-r-----. 1 oracle oinstall     169472 Jul  5 22:05 Archive_20210705_1p037odk_1_1
    -rw-r-----. 1 oracle oinstall   10682368 Jul  5 22:05 Controlback_20210705_1q037odl_1_1
    -rw-r-----. 1 oracle oinstall 1317609472 Jul  5 22:05 Fullback_20210705_1o037od5_1_1
    drwxr-xr-x. 2 oracle oinstall          6 Jul  5 03:12 Level0
    drwxr-xr-x. 2 oracle oinstall          6 Jul  5 03:12 Level1

    Copy Source Database Backup to Target Server

    ============================================
    [oracle@oraclelab2 backup]$ scp *1_1* oracle@10.38.4.109:/u01/backup/
    oracle@10.38.4.109's password:
    Archive_20210705_1n037od1_1_1                                                                          100%  335MB  66.9MB/s   00:05
    Archive_20210705_1p037odk_1_1                                                                          100%  166KB   4.2MB/s   00:00
    Controlback_20210705_1q037odl_1_1                                                                      100%   10MB  45.2MB/s   00:00
    Fullback_20210705_1o037od5_1_1                                                                         100% 1257MB 104.7MB/s   00:12
    [oracle@oraclelab2 backup]$ scp /u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2021_07_05/o1_mf_s_1077141943_jg6f6ztt_.bkp oracle@10.38.4.109:/u01/backup/
    oracle@10.38.4.109's password:
    o1_mf_s_1077141943_jg6f6ztt_.bkp                                                                       100%   10MB  83.2MB/s   00:00
    [oracle@oraclelab2 backup]$

    RMAN Restore and Recover on Target Server to build new Database

    ===============================================================
    [oracle@oraclelab3 backup]$ . oraenv
    ORACLE_SID = [oracle] ? DEVDB
    ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/19.0.0.0/dbhome_1
    The Oracle base has been set to /u01/app/oracle

    [oracle@oraclelab3 backup]$ env |grep ORA
    ORACLE_SID=DEVDB
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
    [oracle@oraclelab3 backup]$ cd /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/

    [oracle@oraclelab3 dbs]$ ls -ltrh
    total 21M
    -rw-r--r--. 1 oracle oinstall 3.1K May 14  2015 init.ora
    -rw-r-----. 1 oracle oinstall   24 Jul  5 00:33 lkTESTDB
    -rw-r-----. 1 oracle oinstall 2.0K Jul  5 00:34 orapwTESTDB
    -rw-r-----. 1 oracle oinstall 3.5K Jul  5 00:41 spfileTESTDB.ora
    -rw-rw----. 1 oracle oinstall 1.6K Jul  5 00:42 hc_TESTDB.dat
    -rw-r--r--. 1 oracle oinstall 1.2K Jul  5 00:45 initDEVDB.ora
    -rw-r-----. 1 oracle oinstall   24 Jul  5 00:48 lkDEVDB
    -rw-r--r--. 1 oracle oinstall 1.1K Jul  5 01:11 initDEV.ora
    -rw-r-----. 1 oracle oinstall   24 Jul  5 01:15 lkDEV
    -rw-r-----. 1 oracle oinstall  11M Jul  5 09:20 snapcf_DEVDB.f
    -rw-r-----. 1 oracle oinstall  11M Jul  5 09:32 snapcf_DEV.f
    -rw-r-----. 1 oracle oinstall 4.5K Jul  5 09:36 spfileDEV.ora
    -rw-rw----. 1 oracle oinstall 1.6K Jul  5 21:21 hc_DEVDB.dat
    -rw-rw----. 1 oracle oinstall 1.6K Jul  5 21:21 hc_DEV.dat

    [oracle@oraclelab3 dbs]$ cat initDEVDB.ora
    DEVDB.__data_transfer_cache_size=0
    DEVDB.__db_cache_size=1761607680
    DEVDB.__inmemory_ext_roarea=0
    DEVDB.__inmemory_ext_rwarea=0
    DEVDB.__java_pool_size=0
    DEVDB.__large_pool_size=16777216
    DEVDB.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    DEVDB.__pga_aggregate_target=822083584
    DEVDB.__sga_target=2432696320
    DEVDB.__shared_io_pool_size=117440512
    DEVDB.__shared_pool_size=520093696
    DEVDB.__streams_pool_size=0
    DEVDB.__unified_pga_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/DEVDB/adump'
    *.audit_trail='db'
    *.compatible='19.0.0'
    *.control_files='/u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_jg41wyll_.ctl','/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_jg41wyng_.ctl'
    *.db_block_size=8192
    *.db_create_file_dest='/u01/app/oracle/oradata'
    *.db_name='DEVDB'
    *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    *.db_recovery_file_dest_size=8256m
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVDBXDB)'
    *.open_cursors=300
    *.pga_aggregate_target=771m
    *.processes=300
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=2312m
    *.undo_tablespace='UNDOTBS1'

    [oracle@oraclelab3 dbs]$ sqlplus / as sysdba
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 5 22:02:05 2021
    Version 19.3.0.0.0

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

    Connected to an idle instance.

    SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora';
    ORACLE instance started.

    Total System Global Area 2432695144 bytes
    Fixed Size                  8899432 bytes
    Variable Size             536870912 bytes
    Database Buffers         1879048192 bytes
    Redo Buffers                7876608 bytes
    SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0

    [oracle@oraclelab3 dbs]$ rman target /
    Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 5 22:02:41 2021
    Version 19.3.0.0.0

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

    connected to target database: DEVDB (not mounted)

    RMAN> restore controlfile from '/u01/backup/Controlback_20210705_1q037odl_1_1';

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

    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    output file name=/u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_jg41wyll_.ctl
    output file name=/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_jg41wyng_.ctl
    Finished restore at 05-JUL-21

    RMAN> alter database mount;

    released channel: ORA_DISK_1
    Statement processed

    RMAN> run {
    restore database;
    switch datafile all;
    recover database;
    }2> 3> 4> 5>

    Starting restore at 05-JUL-21
    Starting implicit crosscheck backup at 05-JUL-21
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=25 device type=DISK
    Crosschecked 8 objects
    Finished implicit crosscheck backup at 05-JUL-21

    Starting implicit crosscheck copy at 05-JUL-21
    using channel ORA_DISK_1
    Finished implicit crosscheck copy at 05-JUL-21

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

    List of Cataloged Files
    =======================
    File Name: /u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2021_07_05/o1_mf_n_1077096030_jg50d6dm_.bkp

    using channel ORA_DISK_1

    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of restore command at 07/05/2021 22:03:36
    RMAN-06026: some targets not found - aborting restore
    RMAN-06023: no backup or copy of datafile 7 found to restore
    RMAN-06023: no backup or copy of datafile 4 found to restore
    RMAN-06023: no backup or copy of datafile 3 found to restore
    RMAN-06023: no backup or copy of datafile 1 found to restore

    RMAN> exit

    Issue:

    Restore and Recover Failed due to prevous autobackup was found on target server:

    Solution:

    We need to delete those prevous backups:

    [oracle@oraclelab3 dbs]$ cd /u01/app/oracle/fast_recovery_area/DEVDB/
    [oracle@oraclelab3 DEVDB]$ cd autobackup/
    [oracle@oraclelab3 autobackup]$ ll
    total 0
    drwxr-x---. 2 oracle oinstall 46 Jul  5 09:20 2021_07_05
    [oracle@oraclelab3 autobackup]$ rm -rf *
    [oracle@oraclelab3 autobackup]$ rman target /

    Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 5 22:04:05 2021
    Version 19.3.0.0.0

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

    connected to target database: DEVDB (DBID=981794806, not open)

    RMAN>
    [oracle@oraclelab3 autobackup]$ cd ..
    [oracle@oraclelab3 DEVDB]$ ll
    total 0
    drwxr-x---. 3 oracle oinstall 24 Jul  5 09:18 archivelog
    drwxr-x---. 2 oracle oinstall  6 Jul  5 22:04 autobackup
    drwxr-x---. 2 oracle oinstall 33 Jul  5 09:18 controlfile
    drwxr-x---. 2 oracle oinstall 93 Jul  5 09:20 onlinelog
    [oracle@oraclelab3 DEVDB]$ cd archivelog/
    [oracle@oraclelab3 archivelog]$ rm -rf *
    [oracle@oraclelab3 archivelog]$ cd ../autobackup/
    [oracle@oraclelab3 autobackup]$ ll
    total 0
    [oracle@oraclelab3 autobackup]$ cd ../controlfile/
    [oracle@oraclelab3 controlfile]$ rm *
    [oracle@oraclelab3 controlfile]$ cd ../onlinelog/
    [oracle@oraclelab3 onlinelog]$ ll
    total 614412
    -rw-r-----. 1 oracle oinstall 209715712 Jul  5 21:20 o1_mf_1_jg50cy9p_.log
    -rw-r-----. 1 oracle oinstall 209715712 Jul  5 09:20 o1_mf_2_jg50czgh_.log
    -rw-r-----. 1 oracle oinstall 209715712 Jul  5 09:20 o1_mf_3_jg50d0x6_.log
    [oracle@oraclelab3 onlinelog]$ rm *
    [oracle@oraclelab3 onlinelog]$ cd ..
    [oracle@oraclelab3 DEVDB]$ cd ..
    [oracle@oraclelab3 fast_recovery_area]$ ll
    total 0
    drwxr-xr-x. 5 oracle oinstall 60 Jul  5 09:32 DEV
    drwxr-xr-x. 6 oracle oinstall 78 Jul  5 09:20 DEVDB
    drwxr-x---. 5 oracle oinstall 60 Jul  5 00:34 TESTDB
    [oracle@oraclelab3 fast_recovery_area]$ cd DEV
    [oracle@oraclelab3 DEV]$ ll
    total 0
    drwxr-x---. 2 oracle oinstall 6 Jul  5 21:23 autobackup
    drwxr-xr-x. 2 oracle oinstall 6 Jul  5 21:23 controlfile
    drwxr-x---. 2 oracle oinstall 6 Jul  5 21:23 onlinelog
    [oracle@oraclelab3 DEV]$ cd autobackup/
    [oracle@oraclelab3 autobackup]$ ll
    total 0
    [oracle@oraclelab3 autobackup]$ cd ../controlfile/
    [oracle@oraclelab3 controlfile]$ ll
    total 0
    [oracle@oraclelab3 controlfile]$ rm /u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_jg41wyll_.ctl
    [oracle@oraclelab3 controlfile]$ rm /u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_jg41wyng_.ctl
    rm: cannot remove ‘/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_jg41wyng_.ctl’: No such file or directory
    [oracle@oraclelab3 controlfile]$ rm  /u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_jg41wyll_.ctl
    rm: cannot remove ‘/u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_jg41wyll_.ctl’: No such file or directory

    [oracle@oraclelab3 controlfile]$
    [oracle@oraclelab3 controlfile]$ ps -ef|grep smon
    oracle   14494     1  0 22:02 ?        00:00:00 ora_smon_DEVDB
    oracle   14769 13789  0 22:05 pts/4    00:00:00 grep --color=auto smon
    oracle   19041     1  0 00:41 ?        00:00:01 ora_smon_TESTDB
    [oracle@oraclelab3 controlfile]$ kill -9 14494
    [oracle@oraclelab3 controlfile]$ cd

    [oracle@oraclelab3 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 5 22:06:00 2021
    Version 19.3.0.0.0

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

    Connected to an idle instance.

    SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora';
    ORACLE instance started.

    Total System Global Area 2432695144 bytes
    Fixed Size                  8899432 bytes
    Variable Size             536870912 bytes
    Database Buffers         1879048192 bytes
    Redo Buffers                7876608 bytes
    SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0
    [oracle@oraclelab3 ~]$ rman target /

    Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 5 22:06:12 2021
    Version 19.3.0.0.0

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

    connected to target database: DEVDB (not mounted)

    RMAN> restore controlfile from '/u01/backup/Controlback_20210705_1q037odl_1_1';

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

    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    output file name=/u01/app/oracle/oradata/DEVDB/controlfile/o1_mf_jg41wyll_.ctl
    output file name=/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_jg41wyng_.ctl
    Finished restore at 05-JUL-21

    RMAN> alter database mount;

    released channel: ORA_DISK_1
    Statement processed

    RMAN> run {
    restore database;
    switch datafile all;
    recover database;
    }2> 3> 4> 5>

    Starting restore at 05-JUL-21
    Starting implicit crosscheck backup at 05-JUL-21
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=24 device type=DISK
    Crosschecked 8 objects
    Finished implicit crosscheck backup at 05-JUL-21

    Starting implicit crosscheck copy at 05-JUL-21
    using channel ORA_DISK_1
    Finished implicit crosscheck copy at 05-JUL-21

    searching for all files in the recovery area
    cataloging files...
    no files cataloged

    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 /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_jg41sonl_.dbf
    channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_jg41trso_.dbf
    channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_jg41vky8_.dbf
    channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_jg41vlz4_.dbf
    channel ORA_DISK_1: reading from backup piece /u01/backup/Fullback_20210705_1o037od5_1_1
    channel ORA_DISK_1: piece handle=/u01/backup/Fullback_20210705_1o037od5_1_1 tag=TAG20210705T220525
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
    Finished restore at 05-JUL-21

    Starting recover at 05-JUL-21
    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=1 sequence=31
    channel ORA_DISK_1: reading from backup piece /u01/backup/Archive_20210705_1p037odk_1_1
    channel ORA_DISK_1: piece handle=/u01/backup/Archive_20210705_1p037odk_1_1 tag=TAG20210705T220540
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_31_jg6f9cw6_.arc thread=1 sequence=31
    channel default: deleting archived log(s)
    archived log file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2021_07_05/o1_mf_1_31_jg6f9cw6_.arc RECID=28 STAMP=1077142019
    unable to find archived log
    archived log thread=1 sequence=32
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 07/05/2021 22:07:01
    RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 32 and starting SCN of 2149175

    RMAN> alter database open resetlogs;

    Statement processed

    RMAN> exit
    Recovery Manager complete.

    [oracle@oraclelab3 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 5 22:08:22 2021
    Version 19.3.0.0.0

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

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

    SQL> select DBID from v$database;

          DBID
    ----------
     981794806

    SQL> select name, open_mode from v$database;

    NAME      OPEN_MODE
    --------- --------------------
    DEVDB     READ WRITE

    SQL>

    RMAN Clone on Target Server to build new Database

    =================================================
    [oracle@oraclelab3 ~]$ . oraenv
    ORACLE_SID = [oracle] ? DEV
    ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/19.0.0.0/dbhome_1
    The Oracle base has been set to /u01/app/oracle
    [oracle@oraclelab3 ~]$
    [oracle@oraclelab3 ~]$
    [oracle@oraclelab3 ~]$ env|grep ORA
    ORACLE_SID=DEV
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
    [oracle@oraclelab3 ~]$ cd /u0/ba
    -bash: cd: /u0/ba: No such file or directory
    [oracle@oraclelab3 ~]$ cd /u01/backup/
    [oracle@oraclelab3 backup]$ ll
    total 1650528
    -rw-r-----. 1 oracle oinstall  350958080 Jul  5 22:00 Archive_20210705_1n037od1_1_1
    -rw-r-----. 1 oracle oinstall     169472 Jul  5 22:00 Archive_20210705_1p037odk_1_1
    -rw-r-----. 1 oracle oinstall   10682368 Jul  5 22:00 Controlback_20210705_1q037odl_1_1
    -rw-r-----. 1 oracle oinstall 1317609472 Jul  5 22:00 Fullback_20210705_1o037od5_1_1
    drwxr-xr-x. 2 oracle oinstall          6 Jul  5 02:11 Level0
    drwxr-xr-x. 2 oracle oinstall          6 Jul  5 02:14 Level1
    -rw-r-----. 1 oracle oinstall   10715136 Jul  5 22:00 o1_mf_s_1077141943_jg6f6ztt_.bkp

    [oracle@oraclelab3 backup]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEV.ora
    DEV.__data_transfer_cache_size=0
    DEV.__db_cache_size=1761607680
    DEV.__inmemory_ext_roarea=0
    DEV.__inmemory_ext_rwarea=0
    DEV.__java_pool_size=0
    DEV.__large_pool_size=16777216
    DEV.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    DEV.__pga_aggregate_target=822083584
    DEV.__sga_target=2432696320
    DEV.__shared_io_pool_size=117440512
    DEV.__shared_pool_size=520093696
    DEV.__streams_pool_size=0
    DEV.__unified_pga_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/DEV/adump'
    *.audit_trail='db'
    *.compatible='19.0.0'
    *.control_files='/u01/app/oracle/oradata/DEV/controlfile/o1_mf_jg41wyll_.ctl','/u01/app/oracle/fast_recovery_area/DEV/controlfile/o1_mf_jg41wyng_.ctl'
    *.db_block_size=8192
    *.db_create_file_dest='/u01/app/oracle/oradata'
    *.db_name='DEV'
    *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    *.db_recovery_file_dest_size=8256m
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVXDB)'
    *.open_cursors=300
    *.pga_aggregate_target=771m
    *.processes=300
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=2312m
    *.undo_tablespace='UNDOTBS1'

    [oracle@oraclelab3 backup]$ sqlplus / as sysdba
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 5 22:12:34 2021
    Version 19.3.0.0.0

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

    Connected to an idle instance.

    SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEV.ora';
    ORACLE instance started.

    Total System Global Area 2432695144 bytes
    Fixed Size                  8899432 bytes
    Variable Size             536870912 bytes
    Database Buffers         1879048192 bytes
    Redo Buffers                7876608 bytes
    SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0
    [oracle@oraclelab3 backup]$ rman AUXILIARY /

    Recovery Manager: Release 19.0.0.0.0 - Production on Mon Jul 5 22:13:00 2021
    Version 19.3.0.0.0

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

    connected to auxiliary database: DEV (not mounted)

    RMAN> run{
    DUPLICATE DATABASE TO DEV
      SPFILE
    2> 3> 4>     parameter_value_convert ('DEVDB','DEV')
        set db_file_name_convert='/u01/app/oracle/oradata/DEVDB','/u01/app/oracle/oradata/DEV'
    5> 6>     set log_file_name_convert='/u01/app/oracle/oradata/DEVDB','/u01/app/oracle/oradata/DEV','/u01/app/oracle/fast_recovery_area/DEVDB','/u01/app/oracle/fast_recovery_area/DEV'
    7>     set control_files='/u01/app/oracle/oradata/DEV/controlfile/control01.ctl','/u01/app/oracle/fast_recovery_area/DEV/controlfile/control02.ctl'
        set db_name='DEV'
    8> 9>     set log_archive_dest_1='location=/u01/app/oracle/fast_recovery_area/DEV'
    10>   BACKUP LOCATION '/u01/backup'
    11>   NOFILENAMECHECK;
    12> }

    Starting Duplicate Db at 05-JUL-21
    searching for database ID
    found backup of database ID 981794806

    contents of Memory Script:
    {
       restore clone spfile to  '/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileDEV.ora' from
     '/u01/backup/o1_mf_s_1077141943_jg6f6ztt_.bkp';
       sql clone "alter system set spfile= ''/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileDEV.ora''";
    }
    executing Memory Script

    Starting restore at 05-JUL-21
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=21 device type=DISK

    channel ORA_AUX_DISK_1: restoring spfile from AUTOBACKUP /u01/backup/o1_mf_s_1077141943_jg6f6ztt_.bkp
    channel ORA_AUX_DISK_1: SPFILE restore from AUTOBACKUP complete
    Finished restore at 05-JUL-21

    sql statement: alter system set spfile= ''/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileDEV.ora''

    contents of Memory Script:
    {
       sql clone "alter system set  db_name =
     ''DEV'' comment=
     ''duplicate'' scope=spfile";
       sql clone "alter system set  audit_file_dest =
     ''/u01/app/oracle/admin/DEV/adump'' comment=
     '''' scope=spfile";
       sql clone "alter system set  dispatchers =
     ''(PROTOCOL=TCP) (SERVICE=DEVXDB)'' comment=
     '''' scope=spfile";
       sql clone "alter system set  db_file_name_convert =
     ''/u01/app/oracle/oradata/DEVDB'', ''/u01/app/oracle/oradata/DEV'' comment=
     '''' scope=spfile";
       sql clone "alter system set  log_file_name_convert =
     ''/u01/app/oracle/oradata/DEVDB'', ''/u01/app/oracle/oradata/DEV'', ''/u01/app/oracle/fast_recovery_area/DEVDB'', ''/u01/app/oracle/fast_recovery_area/DEV'' comment=
     '''' scope=spfile";
       sql clone "alter system set  control_files =
     ''/u01/app/oracle/oradata/DEV/controlfile/control01.ctl'', ''/u01/app/oracle/fast_recovery_area/DEV/controlfile/control02.ctl'' comment=
     '''' scope=spfile";
       sql clone "alter system set  db_name =
     ''DEV'' comment=
     '''' scope=spfile";
       sql clone "alter system set  log_archive_dest_1 =
     ''location=/u01/app/oracle/fast_recovery_area/DEV'' comment=
     '''' scope=spfile";
       shutdown clone immediate;
       startup clone nomount;
    }
    executing Memory Script

    sql statement: alter system set  db_name =  ''DEV'' comment= ''duplicate'' scope=spfile

    sql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/DEV/adump'' comment= '''' scope=spfile

    sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=DEVXDB)'' comment= '''' scope=spfile

    sql statement: alter system set  db_file_name_convert =  ''/u01/app/oracle/oradata/DEVDB'', ''/u01/app/oracle/oradata/DEV'' comment= '''' scope=spfile

    sql statement: alter system set  log_file_name_convert =  ''/u01/app/oracle/oradata/DEVDB'', ''/u01/app/oracle/oradata/DEV'', ''/u01/app/oracle/fast_recovery_area/DEVDB'', ''/u01/app/oracle/fast_recovery_area/DEV'' comment= '''' scope=spfile

    sql statement: alter system set  control_files =  ''/u01/app/oracle/oradata/DEV/controlfile/control01.ctl'', ''/u01/app/oracle/fast_recovery_area/DEV/controlfile/control02.ctl'' comment= '''' scope=spfile

    sql statement: alter system set  db_name =  ''DEV'' comment= '''' scope=spfile

    sql statement: alter system set  log_archive_dest_1 =  ''location=/u01/app/oracle/fast_recovery_area/DEV'' comment= '''' scope=spfile

    Oracle instance shut down

    connected to auxiliary database (not started)
    Oracle instance started

    Total System Global Area    2432695144 bytes

    Fixed Size                     8899432 bytes
    Variable Size                536870912 bytes
    Database Buffers            1879048192 bytes
    Redo Buffers                   7876608 bytes

    contents of Memory Script:
    {
       sql clone "alter system set  db_name =
     ''DEVDB'' comment=
     ''Modified by RMAN duplicate'' scope=spfile";
       sql clone "alter system set  db_unique_name =
     ''DEV'' comment=
     ''Modified by RMAN duplicate'' scope=spfile";
       shutdown clone immediate;
       startup clone force nomount
       restore clone primary controlfile from  '/u01/backup/o1_mf_s_1077141943_jg6f6ztt_.bkp';
       alter clone database mount;
    }
    executing Memory Script

    sql statement: alter system set  db_name =  ''DEVDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

    sql statement: alter system set  db_unique_name =  ''DEV'' comment= ''Modified by RMAN duplicate'' scope=spfile

    Oracle instance shut down

    Oracle instance started

    Total System Global Area    2432695144 bytes

    Fixed Size                     8899432 bytes
    Variable Size                536870912 bytes
    Database Buffers            1879048192 bytes
    Redo Buffers                   7876608 bytes

    Starting restore at 05-JUL-21
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=237 device type=DISK

    channel ORA_AUX_DISK_1: restoring control file
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
    output file name=/u01/app/oracle/oradata/DEV/controlfile/control01.ctl
    output file name=/u01/app/oracle/fast_recovery_area/DEV/controlfile/control02.ctl
    Finished restore at 05-JUL-21

    database mounted
    released channel: ORA_AUX_DISK_1
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=237 device type=DISK

    contents of Memory Script:
    {
       set until scn  2149175;
       set newname for datafile  1 to
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_system_jg41sonl_.dbf";
       set newname for datafile  3 to
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_sysaux_jg41trso_.dbf";
       set newname for datafile  4 to
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_undotbs1_jg41vky8_.dbf";
       set newname for datafile  7 to
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_users_jg41vlz4_.dbf";
       restore
       clone database
       ;
    }
    executing Memory Script

    executing command: SET until clause

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    executing command: SET NEWNAME

    Starting restore at 05-JUL-21
    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 /u01/app/oracle/oradata/DEV/datafile/o1_mf_system_jg41sonl_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DEV/datafile/o1_mf_sysaux_jg41trso_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DEV/datafile/o1_mf_undotbs1_jg41vky8_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/DEV/datafile/o1_mf_users_jg41vlz4_.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/Fullback_20210705_1o037od5_1_1
    channel ORA_AUX_DISK_1: piece handle=/u01/backup/Fullback_20210705_1o037od5_1_1 tag=TAG20210705T220525
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
    Finished restore at 05-JUL-21

    contents of Memory Script:
    {
       switch clone datafile all;
    }
    executing Memory Script

    datafile 1 switched to datafile copy
    input datafile copy RECID=5 STAMP=1077142556 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_system_jg6fso2q_.dbf
    datafile 3 switched to datafile copy
    input datafile copy RECID=6 STAMP=1077142556 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_sysaux_jg6fso2t_.dbf
    datafile 4 switched to datafile copy
    input datafile copy RECID=7 STAMP=1077142556 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_undotbs1_jg6fso2x_.dbf
    datafile 7 switched to datafile copy
    input datafile copy RECID=8 STAMP=1077142556 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_users_jg6fso30_.dbf

    contents of Memory Script:
    {
       set until scn  2149175;
       recover
       clone database
        delete archivelog
       ;
    }
    executing Memory Script

    executing command: SET until clause

    Starting recover at 05-JUL-21
    using channel ORA_AUX_DISK_1

    starting media recovery

    channel ORA_AUX_DISK_1: starting archived log restore to default destination
    channel ORA_AUX_DISK_1: restoring archived log
    archived log thread=1 sequence=31
    channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/Archive_20210705_1p037odk_1_1
    channel ORA_AUX_DISK_1: piece handle=/u01/backup/Archive_20210705_1p037odk_1_1 tag=TAG20210705T220540
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
    archived log file name=/u01/app/oracle/fast_recovery_area/DEV/1_31_1077064824.dbf thread=1 sequence=31
    channel clone_default: deleting archived log(s)
    archived log file name=/u01/app/oracle/fast_recovery_area/DEV/1_31_1077064824.dbf RECID=1 STAMP=1077142556
    media recovery complete, elapsed time: 00:00:00
    Finished recover at 05-JUL-21
    Oracle instance started

    Total System Global Area    2432695144 bytes

    Fixed Size                     8899432 bytes
    Variable Size                536870912 bytes
    Database Buffers            1879048192 bytes
    Redo Buffers                   7876608 bytes

    contents of Memory Script:
    {
       sql clone "alter system set  db_name =
     ''DEV'' comment=
     ''Reset to original value by RMAN'' scope=spfile";
       sql clone "alter system reset  db_unique_name scope=spfile";
    }
    executing Memory Script

    sql statement: alter system set  db_name =  ''DEV'' comment= ''Reset to original value by RMAN'' scope=spfile

    sql statement: alter system reset  db_unique_name scope=spfile
    Oracle instance started

    Total System Global Area    2432695144 bytes

    Fixed Size                     8899432 bytes
    Variable Size                536870912 bytes
    Database Buffers            1879048192 bytes
    Redo Buffers                   7876608 bytes
    sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DEV" RESETLOGS ARCHIVELOG
      MAXLOGFILES     16
      MAXLOGMEMBERS      3
      MAXDATAFILES      100
      MAXINSTANCES     8
      MAXLOGHISTORY      292
     LOGFILE
      GROUP     1 ( '/u01/app/oracle/oradata/DEV/onlinelog/o1_mf_1_jg41x0yq_.log', '/u01/app/oracle/fast_recovery_area/DEV/onlinelog/o1_mf_1_jg41x1gf_.log' ) SIZE 200 M  REUSE,
      GROUP     2 ( '/u01/app/oracle/oradata/DEV/onlinelog/o1_mf_2_jg41x12g_.log', '/u01/app/oracle/fast_recovery_area/DEV/onlinelog/o1_mf_2_jg41x44x_.log' ) SIZE 200 M  REUSE,
      GROUP     3 ( '/u01/app/oracle/oradata/DEV/onlinelog/o1_mf_3_jg41x13l_.log', '/u01/app/oracle/fast_recovery_area/DEV/onlinelog/o1_mf_3_jg41x459_.log' ) SIZE 200 M  REUSE
     DATAFILE
      '/u01/app/oracle/oradata/DEV/datafile/o1_mf_system_jg6fso2q_.dbf'
     CHARACTER SET AL32UTF8


    contents of Memory Script:
    {
       set newname for tempfile  1 to
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_temp_jg41x9qs_.tmp";
       switch clone tempfile all;
       catalog clone datafilecopy  "/u01/app/oracle/oradata/DEV/datafile/o1_mf_sysaux_jg6fso2t_.dbf",
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_undotbs1_jg6fso2x_.dbf",
     "/u01/app/oracle/oradata/DEV/datafile/o1_mf_users_jg6fso30_.dbf";
       switch clone datafile all;
    }
    executing Memory Script

    executing command: SET NEWNAME

    renamed tempfile 1 to /u01/app/oracle/oradata/DEV/datafile/o1_mf_temp_jg41x9qs_.tmp in control file

    cataloged datafile copy
    datafile copy file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_sysaux_jg6fso2t_.dbf RECID=1 STAMP=1077142581
    cataloged datafile copy
    datafile copy file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_undotbs1_jg6fso2x_.dbf RECID=2 STAMP=1077142581
    cataloged datafile copy
    datafile copy file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_users_jg6fso30_.dbf RECID=3 STAMP=1077142581

    datafile 3 switched to datafile copy
    input datafile copy RECID=1 STAMP=1077142581 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_sysaux_jg6fso2t_.dbf
    datafile 4 switched to datafile copy
    input datafile copy RECID=2 STAMP=1077142581 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_undotbs1_jg6fso2x_.dbf
    datafile 7 switched to datafile copy
    input datafile copy RECID=3 STAMP=1077142581 file name=/u01/app/oracle/oradata/DEV/datafile/o1_mf_users_jg6fso30_.dbf

    contents of Memory Script:
    {
       Alter clone database open resetlogs;
    }
    executing Memory Script

    database opened
    Finished Duplicate Db at 05-JUL-21

    RMAN> exit
    Recovery Manager complete.

    [oracle@oraclelab3 backup]$ sqlplus / as sysdba
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 5 22:16:36 2021
    Version 19.3.0.0.0

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

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

    SQL> select dbID from v$database;

          DBID
    ----------
    4155481397

    SQL> select name, open_mode from v$database;

    NAME      OPEN_MODE
    --------- --------------------
    DEV       READ WRITE
    SQL>

    Regards,
    Mallik

    No comments:

    Post a Comment

    🌟 Proud to be an Oracle ACE Pro! 🚀

    🌟 Proud to be an Oracle ACE Pro! 🚀 I’m excited to share my official Oracle ACE Profile with the Oracle community. 👨‍💻 Mallikarjun ...