Tuesday, August 29, 2023

Patching Oracle Grid Infrastructure 19c using out-of-place SwitchGridHome

Suppose your currnt grid and rdbms home is 19.19 and you want to apply 19.20 ( released on July 2023) using out-of-place patching method.

So You donwload,

1. GI RELEASE UPDATE 19.20.0.0.0(Patch 35319490) for Linux x86-64 for Oracle Database 19.0.0.0.0

2. Latest OPatch from My Oracle Support (6880880).

3. Download the base release of Oracle Grid Infrastructure (LINUX.X64_193000_grid_home.zip) and database LINUX.X64_193000_db_home.zip


Steps Inovled

Suppose you have a 2 node cluster with hostname node1 and node2

1) Create necessary directory for the new home and change the permission,

As root run below commands on node1 and node2

mkdir -p /u01/app/19.20.0/grid

chown -R grid:oinstall  /u01/app/19.20.0

chmod -R 775 /u01/app/19.20.0


2) Copy the software.

As grid owner run below commands on node1(only)

cp LINUX.X64_193000_grid_home.zip /u01/app/19.20.0/grid

cp p6880880_190000_Linux-x86-64.zip  /u01/app/19.20.0/grid


As I want to apply 19.20.0 Release Update while I install the Grid home, extract the 19.20.0 patch.


cd /u01/software

mkdir 19.20_Patch

mv p35319490_190000_Linux-x86-64.zip 19.20_Patch

cd 19.20_Patch

unzip p35319490_190000_Linux-x86-64.zip


3)As grid user, Unzip the grid softwares on Node1

As grid user ,


cd /u01/app/19.20.0/grid

unzip LINUX.X64_193000_grid_home.zip

Once Zip is done for the base software, remove the Opatch directory

rm -rf OPatch

and unzip the latest OPatch 

unzip p6880880_190000_Linux-x86-64.zip


4) As grid user, Export the new grid home and run the prerequisites check for the new home.


 export NEWGRIDHOME=/u01/app/19.20.0/grid

 export ORACLE_HOME=$NEWGRIDHOME

 $ORACLE_HOME/gridSetup.sh -executePrereqs -silent


5) As grid user, from node1, install the Grid software.

export NEWGRIDHOME=/u01/app/19.20.0/grid

export ORACLE_HOME=$NEWGRIDHOME

export ORACLE_BASE=/u01/app/grid

export ORA_INVENTORY=/u01/app/oraInventory

export CLUSTER_NAME=$(olsnodes -c)

export CLUSTER_NODES=$(olsnodes | tr '\n' ','| sed 's/,\s*$//')

cd $ORACLE_HOME 

./gridSetup.sh -ignorePrereq -waitforcompletion -silent \

   -applyRU /u01/software/19.20_Patch/35319490 \

   -responseFile $ORACLE_HOME/install/response/gridsetup.rsp \

   INVENTORY_LOCATION=$ORA_INVENTORY \

   ORACLE_BASE=$ORACLE_BASE \

   SELECTED_LANGUAGES=en \

   oracle.install.option=CRS_SWONLY \

   oracle.install.asm.OSDBA=asmdba \

   oracle.install.asm.OSOPER=asmoper \

   oracle.install.asm.OSASM=asmadmin \

   oracle.install.crs.config.ClusterConfiguration=STANDALONE \

   oracle.install.crs.config.configureAsExtendedCluster=false \

   oracle.install.crs.config.clusterName=$CLUSTER_NAME \

   oracle.install.crs.config.gpnp.configureGNS=false \

   oracle.install.crs.config.autoConfigureClusterNodeVIP=false \

   oracle.install.crs.config.clusterNodes=$CLUSTER_NODES


* If you have one-off patches to install, you can use the -applyOneOffs parameter.


* Above script will copy the grid software to node2 and once it finish it will ask you to execute the root.sh 


/u01/app/19.20.0/grid/root.sh ( on node1 and node2 ) -- this will quick 


6) Once root.sh executed on all nodes, as grid user switch to the new grid home (Needs to execute from each node)


export ORACLE_HOME=/u01/app/19.20.0/grid

export CURRENT_NODE=$(hostname)

$ORACLE_HOME/gridSetup.sh \

   -silent -switchGridHome \

   oracle.install.option=CRS_SWONLY \

   ORACLE_HOME=$ORACLE_HOME \

   oracle.install.crs.config.clusterNodes=$CURRENT_NODE \

   oracle.install.crs.rootconfig.executeRootScript=false


Above script will ask you to execute /u01/app/19.20.0/grid/root.sh --> this will takes time.

* Actual downtime of first node starts here.

* Here root.sh brings down the clusterware stack from the old home and then bring it up from the new home.

* Once root.sh brings up the clusterware stack from the new home, go to node2 and repeat step 6


RDBMS Home Patching 

1) As oracle user create direcotory for new home on node1 and node2


mkdir -p /u01/app/oracle/product/19.20/dbhome_1


2) Copy the database and Opatch software to the newly created db home.


cp LINUX.X64_193000_db_home.zip  /u01/app/oracle/product/19.20/dbhome_1


cp p6880880_190000_Linux-x86-64.zip /u01/app/oracle/product/19.20/dbhome_1


3) Unzip the database software 


cd /u01/app/oracle/product/19.20/dbhome_1


unzip LINUX.X64_193000_db_home.zip


Once Zip is done for the base software, remove the Opatch directory


rm -rf OPatch


and unzip the latest OPatch 


unzip p6880880_190000_Linux-x86-64.zip


4)Export new Oracle HOme and install the new software 


export ORACLE_HOME=/u01/app/oracle/product/19.20/dbhome_1

cd $ORACLE_HOME

./runInstaller -applyRU /u01/software/19.20_Patch/35319490 \

-silent -ignorePrereqFailure -waitforcompletion \

oracle.install.option=INSTALL_DB_SWONLY \

UNIX_GROUP_NAME=oinstall \

INVENTORY_LOCATION=/u01/app/oraInventory \

ORACLE_BASE=/u00/app/oracle \

ORACLE_HOME=/u01/app/oracle/product/19.20/dbhome_1 \

oracle.install.db.InstallEdition=EE \

oracle.install.db.OSDBA_GROUP=dba \

oracle.install.db.OSOPER_GROUP=oper \

oracle.install.db.OSBACKUPDBA_GROUP=backupdba \

oracle.install.db.OSDGDBA_GROUP=dgdba \

oracle.install.db.OSKMDBA_GROUP=kmdba \

oracle.install.db.OSRACDBA_GROUP=dba \

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \

oracle.install.db.CLUSTER_NODES=node1,node2 \

DECLINE_SECURITY_UPDATES=true


** runInstaller will ask you to run root.sh from node1 and node2


run /u01/app/oracle/product/19.20/dbhome_1/root.sh on node1 and node2

5) update /etc/oratab (on all nodes) and then modifty the database properties 


srvctl config database -d MYDB

srvctl modify database -d MYDB -o /u01/app/oracle/product/19.20/dbhome_1

srvctl stop database -d MYDB

srvctl start database -d MYDB


6) Finally run the datapatch 

col action for a24

col version for a35

col bundle_series for a50

col comments for a99


select action,action_time,version,bundle_series,comments from dba_registry_history;


cd $ORACLE_HOME/OPatch


export ORACLE_HOME=/u01/app/oracle/product/19.20/dbhome_1

export ORACLE_SID=MYDB

cd $ORACLE_HOME/OPatch

./datapatch -verbose

Thursday, January 7, 2021

How to rename a pluggable database

In this Post I'm going to rename my pluggable database ORCL to SRPDB.

For renaming a PDB we need to open the pdb in restricted mode.

[oracle@orcldb01:~ ] $ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 7 21:32:46 2021

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 ORCL                           READ WRITE NO

SQL> alter pluggable database ORCL close ;

Pluggable database altered.

SQL>  show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 ORCL                           MOUNTED

SQL>  alter pluggable database ORCL open restricted;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 ORCL                           READ WRITE YES

 

SQL> alter pluggable database ORCL rename global_name to SRPDB;

alter pluggable database ORCL rename global_name to SRPDB

*

ERROR at line 1:

ORA-65046: operation not allowed from outside a pluggable database

SQL> alter session set container=ORCL;

Session altered.

SQL> 


The datafile directory does not get renamed after PDB rename.


SQL> select name from v$datafile;

NAME

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

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_hzb8ojfj_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hzb8j0hb_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hzb8j0gv_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hzb8ojmo_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hzb8j0rb_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hzb8j0vf_.dbf

6 rows selected.

SQL>

SQL> alter pluggable database ORCL rename global_name to SRPDB;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         3 SRPDB                          READ WRITE YES

SQL> select name from v$datafile;

NAME

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

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_hzb8ojfj_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hzb8j0hb_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hzb8j0gv_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hzb8ojmo_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hzb8j0rb_.dbf

/u01/app/oracle/oradata/srcdb/SRCDB/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hzb8j0vf_.dbf

6 rows selected.

SQL>


Close and open the PDB to take it away from restricted mode.


SQL> alter pluggable database SRPDB close ;

Pluggable database altered.

SQL> alter pluggable database SRPDB open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 SRPDB                          READ WRITE NO

SQL>


We could see new PDB is registered with listener as well.

[oracle@orcldb01:~ ] $ lsnrctl status listener

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 07-JAN-2021 21:42:06

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                07-JAN-2021 21:04:28

Uptime                    0 days 0 hr. 37 min. 38 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Default Service           orcl12c

Listener Parameter File   /u01/app/oracle/product/12.2/db_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/orcldb01/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.103)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=orcldb01)(PORT=8081))(Presentation=HTTP)(Session=RAW))

Services Summary...

Service "49bff8a6bb912582e0530100007f8be4" has 1 instance(s).

  Instance "SRCDB", status READY, has 2 handler(s) for this service...

Service "SRCDB" has 1 instance(s).

  Instance "SRCDB", status READY, has 2 handler(s) for this service...

Service "orcl12c" has 1 instance(s).

  Instance "orcl12c", status UNKNOWN, has 1 handler(s) for this service...

Service "srpdb" has 1 instance(s).

  Instance "SRCDB", status READY, has 2 handler(s) for this service...

The command completed successfully

[oracle@orcldb01:~ ] $


Tuesday, January 5, 2021

How to duplicate a database from RMAN backup location ?

We can perform RMAN DUPLICATE  operation without connecting to the target database, but this will work ONLY for disk backups. 

This is achieved via BACKUP LOCATION clause of DUPLICATE command i.e.

DUPLICATE DATABASE TO DBNAME 

UNTIL TIME "TO_DATE('11/01/2007 14:00:00', 'MM/DD/YYYY HH24:MI:SS')"

BACKUP LOCATION '/<backup location>/'

NOFILENAMECHECK;

Here is an example ,

orcl12c is my source which is a container database and I'm going to duplicate a container database "trorcl" from it .

First take full database backup of orcl12c.

RUN

{

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

allocate channel d4 type disk;

sql "alter system archive log current";

BACKUP AS COMPRESSED BACKUPSET FULL TAG 'ORCL12C_FULL' DATABASE format '/backup/Backup_%d_%T_%s' include current controlfile;

sql "alter system archive log current";

backup archivelog all format '/backup/Archive_%d_%T_%s';

}

[oracle@orcldb02 backup]$ . oraenv

ORACLE_SID = [orcl12c] ? 

ORACLE_BASE environment variable is not being set since this

information is not available for the current user ID oracle.

You can set ORACLE_BASE manually if it is required.

Resetting ORACLE_BASE to its previous value or ORACLE_HOME

The Oracle base remains unchanged with value /u01/app/oracle

[oracle@orcldb02 backup]$ 

[oracle@orcldb02 backup]$ rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Tue Jan 5 09:06:15 2021

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

connected to target database: ORCL12C (DBID=768045447)

RMAN> RUN

{

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

allocate channel d4 type disk;

sql "alter system archive log current";

BACKUP AS COMPRESSED BACKUPSET FULL TAG 'ORCL12C_FULL' DATABASE format '/backup/Backup_%d_%T_%s' include current controlfile;

sql "alter system archive log current";

backup archivelog all format '/backup/Archive_%d_%T_%s';

}

2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 

using target database control file instead of recovery catalog

allocated channel: d1

channel d1: SID=69 device type=DISK

allocated channel: d2

channel d2: SID=67 device type=DISK

allocated channel: d3

channel d3: SID=70 device type=DISK

allocated channel: d4

channel d4: SID=68 device type=DISK

sql statement: alter system archive log current

Starting backup at 05-JAN-21

channel d1: starting compressed full datafile backup set

channel d1: specifying datafile(s) in backup set

input datafile file number=00010 name=/u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf

input datafile file number=00014 name=/u01/app/oracle/oradata/orcl12c/orcl/APEX_1993195660370985.dbf

channel d1: starting piece 1 at 05-JAN-21

channel d2: starting compressed full datafile backup set

channel d2: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/orcl12c/system01.dbf

channel d2: starting piece 1 at 05-JAN-21

channel d3: starting compressed full datafile backup set

channel d3: specifying datafile(s) in backup set

input datafile file number=00003 name=/u01/app/oracle/oradata/orcl12c/sysaux01.dbf

channel d3: starting piece 1 at 05-JAN-21

channel d4: starting compressed full datafile backup set

channel d4: specifying datafile(s) in backup set

input datafile file number=00011 name=/u01/app/oracle/oradata/orcl12c/orcl/undotbs01.dbf

input datafile file number=00013 name=/u01/app/oracle/oradata/orcl12c/orcl/APEX_1991375173370654.dbf

channel d4: starting piece 1 at 05-JAN-21

channel d4: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_27 tag=ORCL12C_FULL comment=NONE

channel d4: backup set complete, elapsed time: 00:04:25

channel d4: starting compressed full datafile backup set

channel d4: specifying datafile(s) in backup set

input datafile file number=00009 name=/u01/app/oracle/oradata/orcl12c/orcl/system01.dbf

input datafile file number=00012 name=/u01/app/oracle/oradata/orcl12c/orcl/users01.dbf

channel d4: starting piece 1 at 05-JAN-21

channel d2: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_25 tag=ORCL12C_FULL comment=NONE

channel d2: backup set complete, elapsed time: 00:05:00

channel d2: starting compressed full datafile backup set

channel d2: specifying datafile(s) in backup set

input datafile file number=00006 name=/u01/app/oracle/oradata/orcl12c/pdbseed/sysaux01.dbf

channel d2: starting piece 1 at 05-JAN-21

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_26 tag=ORCL12C_FULL comment=NONE

channel d3: backup set complete, elapsed time: 00:05:06

channel d3: starting compressed full datafile backup set

channel d3: specifying datafile(s) in backup set

input datafile file number=00005 name=/u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf

channel d3: starting piece 1 at 05-JAN-21

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_30 tag=ORCL12C_FULL comment=NONE

channel d3: backup set complete, elapsed time: 00:02:48

channel d3: starting compressed full datafile backup set

channel d3: specifying datafile(s) in backup set

input datafile file number=00008 name=/u01/app/oracle/oradata/orcl12c/pdbseed/undotbs01.dbf

channel d3: starting piece 1 at 05-JAN-21

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_31 tag=ORCL12C_FULL comment=NONE

channel d3: backup set complete, elapsed time: 00:00:26

channel d3: starting compressed full datafile backup set

channel d3: specifying datafile(s) in backup set

input datafile file number=00015 name=/u01/app/oracle/oradata/orcl12c/undotbs2.dbf

channel d3: starting piece 1 at 05-JAN-21

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_32 tag=ORCL12C_FULL comment=NONE

channel d3: backup set complete, elapsed time: 00:00:09

channel d3: starting compressed full datafile backup set

channel d3: specifying datafile(s) in backup set

including current control file in backup set

channel d3: starting piece 1 at 05-JAN-21

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_33 tag=ORCL12C_FULL comment=NONE

channel d3: backup set complete, elapsed time: 00:00:03

channel d3: starting compressed full datafile backup set

channel d3: specifying datafile(s) in backup set

input datafile file number=00007 name=/u01/app/oracle/oradata/orcl12c/users01.dbf

channel d3: starting piece 1 at 05-JAN-21

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_34 tag=ORCL12C_FULL comment=NONE

channel d3: backup set complete, elapsed time: 00:00:01

channel d4: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_28 tag=ORCL12C_FULL comment=NONE

channel d4: backup set complete, elapsed time: 00:04:08

channel d2: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_29 tag=ORCL12C_FULL comment=NONE

channel d2: backup set complete, elapsed time: 00:04:41

channel d1: finished piece 1 at 05-JAN-21

piece handle=/backup/Backup_ORCL12C_20210105_24 tag=ORCL12C_FULL comment=NONE

channel d1: backup set complete, elapsed time: 00:11:28

Finished backup at 05-JAN-21

Starting Control File and SPFILE Autobackup at 05-JAN-21

piece handle=/u01/app/oracle/fast_recovery_area/orcl12c/ORCL12C/autobackup/2021_01_05/o1_mf_s_1061025496_hz8x9bow_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 05-JAN-21

sql statement: alter system archive log current

Starting backup at 05-JAN-21

current log archived

channel d1: starting archived log backup set

channel d1: specifying archived log(s) in backup set

input archived log thread=1 sequence=21 RECID=1 STAMP=1061014251

channel d1: starting piece 1 at 05-JAN-21

channel d2: starting archived log backup set

channel d2: specifying archived log(s) in backup set

input archived log thread=1 sequence=25 RECID=5 STAMP=1061022907

input archived log thread=1 sequence=26 RECID=6 STAMP=1061023293

input archived log thread=1 sequence=27 RECID=7 STAMP=1061023587

channel d2: starting piece 1 at 05-JAN-21

channel d3: starting archived log backup set

channel d3: specifying archived log(s) in backup set

input archived log thread=1 sequence=28 RECID=8 STAMP=1061024604

input archived log thread=1 sequence=29 RECID=9 STAMP=1061024803

input archived log thread=1 sequence=30 RECID=10 STAMP=1061025509

channel d3: starting piece 1 at 05-JAN-21

channel d4: starting archived log backup set

channel d4: specifying archived log(s) in backup set

input archived log thread=1 sequence=22 RECID=2 STAMP=1061014300

input archived log thread=1 sequence=23 RECID=3 STAMP=1061014409

input archived log thread=1 sequence=24 RECID=4 STAMP=1061014805

channel d4: starting piece 1 at 05-JAN-21

channel d1: finished piece 1 at 05-JAN-21

piece handle=/backup/Archive_ORCL12C_20210105_36 tag=TAG20210105T091830 comment=NONE

channel d1: backup set complete, elapsed time: 00:00:02

channel d1: starting archived log backup set

channel d1: specifying archived log(s) in backup set

input archived log thread=1 sequence=31 RECID=11 STAMP=1061025510

channel d1: starting piece 1 at 05-JAN-21

channel d2: finished piece 1 at 05-JAN-21

piece handle=/backup/Archive_ORCL12C_20210105_37 tag=TAG20210105T091830 comment=NONE

channel d2: backup set complete, elapsed time: 00:00:01

channel d3: finished piece 1 at 05-JAN-21

piece handle=/backup/Archive_ORCL12C_20210105_38 tag=TAG20210105T091830 comment=NONE

channel d3: backup set complete, elapsed time: 00:00:01

channel d4: finished piece 1 at 05-JAN-21

piece handle=/backup/Archive_ORCL12C_20210105_39 tag=TAG20210105T091830 comment=NONE

channel d4: backup set complete, elapsed time: 00:00:00

channel d1: finished piece 1 at 05-JAN-21

piece handle=/backup/Archive_ORCL12C_20210105_40 tag=TAG20210105T091830 comment=NONE

channel d1: backup set complete, elapsed time: 00:00:00

Finished backup at 05-JAN-21

Starting Control File and SPFILE Autobackup at 05-JAN-21

piece handle=/u01/app/oracle/fast_recovery_area/orcl12c/ORCL12C/autobackup/2021_01_05/o1_mf_s_1061025514_hz8x9two_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 05-JAN-21

released channel: d1

released channel: d2

released channel: d3

released channel: d4

RMAN> 

[oracle@orcldb02 backup]$ ls -lhrt

total 994M

-rw-r----- 1 oracle oinstall 1.8M Jan  5 09:07 Backup_ORCL12C_20210105_27

-rw-r----- 1 oracle oinstall 110M Jan  5 09:09 Backup_ORCL12C_20210105_26

-rw-r----- 1 oracle oinstall 205M Jan  5 09:11 Backup_ORCL12C_20210105_25

-rw-r----- 1 oracle oinstall  52M Jan  5 09:14 Backup_ORCL12C_20210105_30

-rw-r----- 1 oracle oinstall 7.8M Jan  5 09:15 Backup_ORCL12C_20210105_31

-rw-r----- 1 oracle oinstall 1.4M Jan  5 09:15 Backup_ORCL12C_20210105_32

-rw-r----- 1 oracle oinstall 1.1M Jan  5 09:15 Backup_ORCL12C_20210105_33

-rw-r----- 1 oracle oinstall 1.1M Jan  5 09:15 Backup_ORCL12C_20210105_34

-rw-r----- 1 oracle oinstall  88M Jan  5 09:15 Backup_ORCL12C_20210105_28

-rw-r----- 1 oracle oinstall 105M Jan  5 09:16 Backup_ORCL12C_20210105_29

-rw-r----- 1 oracle oinstall 409M Jan  5 09:18 Backup_ORCL12C_20210105_24

-rw-r----- 1 oracle oinstall 7.3M Jan  5 09:18 Archive_ORCL12C_20210105_36

-rw-r----- 1 oracle oinstall 3.5M Jan  5 09:18 Archive_ORCL12C_20210105_37

-rw-r----- 1 oracle oinstall 3.1M Jan  5 09:18 Archive_ORCL12C_20210105_38

-rw-r----- 1 oracle oinstall 470K Jan  5 09:18 Archive_ORCL12C_20210105_39

-rw-r----- 1 oracle oinstall 3.5K Jan  5 09:18 Archive_ORCL12C_20210105_40

[oracle@orcldb02 backup]$ 


Create a pfile for target database. 

[oracle@orcldb02 backup]$ 

[oracle@orcldb02 backup]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 5 06:48:42 2021

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

SQL> create pfile='/tmp/inittrorcl.ora' from spfile ;

File created.

SQL> 


Lets edit it, 


[oracle@orcldb02 ~]$ cat /tmp/inittrorcl.ora 

trorcl.__data_transfer_cache_size=0

trorcl.__db_cache_size=536870912

trorcl.__inmemory_ext_roarea=0

trorcl.__inmemory_ext_rwarea=0

trorcl.__java_pool_size=4194304

trorcl.__large_pool_size=8388608

trorcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

trorcl.__pga_aggregate_target=209715200

trorcl.__sga_target=838860800

trorcl.__shared_io_pool_size=0

trorcl.__shared_pool_size=276824064

trorcl.__streams_pool_size=0

*._ash_size=25165824

*.audit_file_dest='/u01/app/oracle/admin/trorcl/adump'

*.audit_trail='db'

*.compatible='12.2.0'

*.control_files='/u01/app/oracle/oradata/trorcl/control01.ctl','/u01/app/oracle/fast_recovery_area/trorcl/control02.ctl'

*.db_block_size=8192

*.db_name='trorcl'

*.db_create_file_dest='/u01/app/oracle/oradata'

*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/trorcl'

*.db_recovery_file_dest_size=5g

*.diagnostic_dest='/u01/app/oracle'

*.enable_pluggable_database=true

*.local_listener='LISTENER_ORCL12C'

*.nls_language='AMERICAN'

*.nls_territory='AMERICA'

*.open_cursors=300

*.pga_aggregate_target=200m

*.processes=300

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=800m

*.shared_servers=25

*.undo_tablespace='UNDOTBS2'

[oracle@orcldb02 ~]$ 


Create necessary directories,


[oracle@orcldb02 backup]$ 

[oracle@orcldb02 backup]$ mkdir -p /u01/app/oracle/admin/trorcl/adump

[oracle@orcldb02 backup]$ mkdir -p /u01/app/oracle/oradata/trorcl

[oracle@orcldb02 backup]$ 

[oracle@orcldb02 backup]$ mkdir -p /u01/app/oracle/fast_recovery_area/trorcl

[oracle@orcldb02 backup]$ 


Create a source file for new database and set it. 


[oracle@orcldb02 ~]$ cat settrorcl 

export ORACLE_SID=trorcl

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/12.2/db_1

export PATH=$ORACLE_HOME/bin:$PATH

[oracle@orcldb02 ~]$ 

[oracle@orcldb02 ~]$ . settrorcl

[oracle@orcldb02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 5 07:04:16 2021

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

Connected to an idle instance.

SQL> startup nomount pfile='/tmp/inittrorcl.ora';

ORACLE instance started.

Total System Global Area  838860800 bytes

Fixed Size     8798312 bytes

Variable Size   339742616 bytes

Database Buffers   486539264 bytes

Redo Buffers     3780608 bytes

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@orcldb02 ~]$


Now duplicate the database using below syntax,


Run

{

ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux4 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux5 DEVICE TYPE DISK;

DUPLICATE DATABASE TO TRORCL BACKUP LOCATION '/backup/' NOFILENAMECHECK;

}


[oracle@orcldb02 ~]$ rman auxiliary /

Recovery Manager: Release 12.2.0.1.0 - Production on Tue Jan 5 09:26:46 2021

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

connected to auxiliary database: TRORCL (not mounted)

RMAN> 

Run

{

ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux4 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux5 DEVICE TYPE DISK;

DUPLICATE DATABASE TO TRORCL BACKUP LOCATION '/backup/' NOFILENAMECHECK;

}

RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 

allocated channel: aux1

channel aux1: SID=35 device type=DISK

allocated channel: aux2

channel aux2: SID=36 device type=DISK

allocated channel: aux3

channel aux3: SID=37 device type=DISK

allocated channel: aux4

channel aux4: SID=38 device type=DISK

allocated channel: aux5

channel aux5: SID=39 device type=DISK

Starting Duplicate Db at 05-JAN-21

contents of Memory Script:

{

   sql clone "create spfile from memory";

}

executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:

{

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area     838860800 bytes

Fixed Size                     8798312 bytes

Variable Size                339742616 bytes

Database Buffers             486539264 bytes

Redo Buffers                   3780608 bytes

allocated channel: aux1

channel aux1: SID=35 device type=DISK

allocated channel: aux2

channel aux2: SID=36 device type=DISK

allocated channel: aux3

channel aux3: SID=37 device type=DISK

allocated channel: aux4

channel aux4: SID=38 device type=DISK

allocated channel: aux5

channel aux5: SID=39 device type=DISK

contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL12C'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   sql clone "alter system set  db_unique_name = 

 ''trorcl'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   shutdown clone immediate;

   startup clone force nomount

   restore clone primary controlfile from  '/backup/Backup_ORCL12C_20210105_33';

   alter clone database mount;

}

executing Memory Script

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     838860800 bytes

Fixed Size                     8798312 bytes

Variable Size                339742616 bytes

Database Buffers             486539264 bytes

Redo Buffers                   3780608 bytes

allocated channel: aux1

channel aux1: SID=35 device type=DISK

allocated channel: aux2

channel aux2: SID=36 device type=DISK

allocated channel: aux3

channel aux3: SID=37 device type=DISK

allocated channel: aux4

channel aux4: SID=38 device type=DISK

allocated channel: aux5

channel aux5: SID=39 device type=DISK

Starting restore at 05-JAN-21

channel aux2: skipped, AUTOBACKUP already found

channel aux3: skipped, AUTOBACKUP already found

channel aux4: skipped, AUTOBACKUP already found

channel aux5: skipped, AUTOBACKUP already found

channel aux1: restoring control file

channel aux1: restore complete, elapsed time: 00:00:14

output file name=/u01/app/oracle/oradata/trorcl/control01.ctl

output file name=/u01/app/oracle/fast_recovery_area/trorcl/control02.ctl

Finished restore at 05-JAN-21

database mounted

contents of Memory Script:

{

   set until scn  2945638;

   set newname for clone datafile  1 to new;

   set newname for clone datafile  3 to new;

   set newname for clone datafile  5 to new;

   set newname for clone datafile  6 to new;

   set newname for clone datafile  7 to new;

   set newname for clone datafile  8 to new;

   set newname for clone datafile  9 to new;

   set newname for clone datafile  10 to new;

   set newname for clone datafile  11 to new;

   set newname for clone datafile  12 to new;

   set newname for clone datafile  13 to new;

   set newname for clone datafile  14 to new;

   set newname for clone datafile  15 to new;

   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

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 05-JAN-21

channel aux1: starting datafile backup set restore

channel aux1: specifying datafile(s) to restore from backup set

channel aux1: restoring datafile 00010 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_%u_.dbf

channel aux1: restoring datafile 00014 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_%u_.dbf

channel aux1: reading from backup piece /backup/Backup_ORCL12C_20210105_24

channel aux2: starting datafile backup set restore

channel aux2: specifying datafile(s) to restore from backup set

channel aux2: restoring datafile 00003 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_%u_.dbf

channel aux2: reading from backup piece /backup/Backup_ORCL12C_20210105_26

channel aux3: starting datafile backup set restore

channel aux3: specifying datafile(s) to restore from backup set

channel aux3: restoring datafile 00011 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_%u_.dbf

channel aux3: restoring datafile 00013 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_%u_.dbf

channel aux3: reading from backup piece /backup/Backup_ORCL12C_20210105_27

channel aux4: starting datafile backup set restore

channel aux4: specifying datafile(s) to restore from backup set

channel aux4: restoring datafile 00001 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_system_%u_.dbf

channel aux4: reading from backup piece /backup/Backup_ORCL12C_20210105_25

channel aux5: starting datafile backup set restore

channel aux5: specifying datafile(s) to restore from backup set

channel aux5: restoring datafile 00009 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_%u_.dbf

channel aux5: restoring datafile 00012 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_%u_.dbf

channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_28

channel aux3: piece handle=/backup/Backup_ORCL12C_20210105_27 tag=ORCL12C_FULL

channel aux3: restored backup piece 1

channel aux3: restore complete, elapsed time: 00:03:15

channel aux3: starting datafile backup set restore

channel aux3: specifying datafile(s) to restore from backup set

channel aux3: restoring datafile 00005 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_system_%u_.dbf

channel aux3: reading from backup piece /backup/Backup_ORCL12C_20210105_30

channel aux2: piece handle=/backup/Backup_ORCL12C_20210105_26 tag=ORCL12C_FULL

channel aux2: restored backup piece 1

channel aux2: restore complete, elapsed time: 00:03:56

channel aux2: starting datafile backup set restore

channel aux2: specifying datafile(s) to restore from backup set

channel aux2: restoring datafile 00006 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_%u_.dbf

channel aux2: reading from backup piece /backup/Backup_ORCL12C_20210105_29

channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_28 tag=ORCL12C_FULL

channel aux5: restored backup piece 1

channel aux5: restore complete, elapsed time: 00:04:11

channel aux5: starting datafile backup set restore

channel aux5: specifying datafile(s) to restore from backup set

channel aux5: restoring datafile 00007 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_%u_.dbf

channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_34

channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_34 tag=ORCL12C_FULL

channel aux5: restored backup piece 1

channel aux5: restore complete, elapsed time: 00:00:02

channel aux5: starting datafile backup set restore

channel aux5: specifying datafile(s) to restore from backup set

channel aux5: restoring datafile 00008 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_%u_.dbf

channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_31

channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_31 tag=ORCL12C_FULL

channel aux5: restored backup piece 1

channel aux5: restore complete, elapsed time: 00:00:26

channel aux5: starting datafile backup set restore

channel aux5: specifying datafile(s) to restore from backup set

channel aux5: restoring datafile 00015 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_%u_.dbf

channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_32

channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_32 tag=ORCL12C_FULL

channel aux5: restored backup piece 1

channel aux5: restore complete, elapsed time: 00:00:15

channel aux3: piece handle=/backup/Backup_ORCL12C_20210105_30 tag=ORCL12C_FULL

channel aux3: restored backup piece 1

channel aux3: restore complete, elapsed time: 00:01:47

channel aux4: piece handle=/backup/Backup_ORCL12C_20210105_25 tag=ORCL12C_FULL

channel aux4: restored backup piece 1

channel aux4: restore complete, elapsed time: 00:05:57

channel aux2: piece handle=/backup/Backup_ORCL12C_20210105_29 tag=ORCL12C_FULL

channel aux2: restored backup piece 1

channel aux2: restore complete, elapsed time: 00:02:11

channel aux1: piece handle=/backup/Backup_ORCL12C_20210105_24 tag=ORCL12C_FULL

channel aux1: restored backup piece 1

channel aux1: restore complete, elapsed time: 00:07:07

Finished restore at 05-JAN-21

contents of Memory Script:

{

   switch clone datafile all;

}

executing Memory Script

datafile 1 switched to datafile copy

input datafile copy RECID=14 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_system_hz8xwbs9_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=15 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=16 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_system_hz8y2x7y_.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=17 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=18 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=19 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf

datafile 9 switched to datafile copy

input datafile copy RECID=20 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_hz8xwc2q_.dbf

datafile 10 switched to datafile copy

input datafile copy RECID=21 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf

datafile 11 switched to datafile copy

input datafile copy RECID=22 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf

datafile 12 switched to datafile copy

input datafile copy RECID=23 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf

datafile 13 switched to datafile copy

input datafile copy RECID=24 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf

datafile 14 switched to datafile copy

input datafile copy RECID=25 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf

datafile 15 switched to datafile copy

input datafile copy RECID=26 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf

contents of Memory Script:

{

   set until scn  2945638;

   recover

   clone database

    delete archivelog

   ;

}

executing Memory Script

executing command: SET until clause

Starting recover at 05-JAN-21

starting media recovery

channel aux1: starting archived log restore to default destination

channel aux1: restoring archived log

archived log thread=1 sequence=30

channel aux1: reading from backup piece /backup/Archive_ORCL12C_20210105_38

channel aux2: starting archived log restore to default destination

channel aux2: restoring archived log

archived log thread=1 sequence=31

channel aux2: reading from backup piece /backup/Archive_ORCL12C_20210105_40

channel aux1: piece handle=/backup/Archive_ORCL12C_20210105_38 tag=TAG20210105T091830

channel aux1: restored backup piece 1

channel aux1: restore complete, elapsed time: 00:00:02

archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_30_hz8y9w5v_.arc thread=1 sequence=30

channel clone_default: deleting archived log(s)

archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_30_hz8y9w5v_.arc RECID=1 STAMP=1061026540

channel aux2: piece handle=/backup/Archive_ORCL12C_20210105_40 tag=TAG20210105T091830

channel aux2: restored backup piece 1

channel aux2: restore complete, elapsed time: 00:00:03

archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_31_hz8y9w7o_.arc thread=1 sequence=31

channel clone_default: deleting archived log(s)

archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_31_hz8y9w7o_.arc RECID=2 STAMP=1061026540

media recovery complete, elapsed time: 00:00:00

Finished recover at 05-JAN-21

released channel: aux1

released channel: aux2

released channel: aux3

released channel: aux4

released channel: aux5

Oracle instance started

Total System Global Area     838860800 bytes

Fixed Size                     8798312 bytes

Variable Size                339742616 bytes

Database Buffers             486539264 bytes

Redo Buffers                   3780608 bytes

contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''TRORCL'' 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 =  ''TRORCL'' 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     838860800 bytes

Fixed Size                     8798312 bytes

Variable Size                339742616 bytes

Database Buffers             486539264 bytes

Redo Buffers                   3780608 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TRORCL" RESETLOGS ARCHIVELOG 

  MAXLOGFILES     16

  MAXLOGMEMBERS      3

  MAXDATAFILES     1024

  MAXINSTANCES     8

  MAXLOGHISTORY      292

 LOGFILE

  GROUP   1  SIZE 200 M ,

  GROUP   2  SIZE 200 M ,

  GROUP   3  SIZE 200 M 

 DATAFILE

  '/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_system_hz8xwbs9_.dbf',

  '/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_system_hz8y2x7y_.dbf',

  '/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_hz8xwc2q_.dbf'

 CHARACTER SET AL32UTF8

contents of Memory Script:

{

   set newname for clone tempfile  1 to new;

   set newname for clone tempfile  2 to new;

   set newname for clone tempfile  3 to new;

   switch clone tempfile all;

   catalog clone datafilecopy  "/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf", 

 "/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf";

   switch clone datafile all;

}

executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_temp_%u_.tmp in control file

renamed tempfile 2 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_temp_%u_.tmp in control file

renamed tempfile 3 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_temp_%u_.tmp in control file

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf RECID=1 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf RECID=2 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf RECID=3 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf RECID=4 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf RECID=5 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf RECID=6 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf RECID=7 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf RECID=8 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf RECID=9 STAMP=1061026579

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf RECID=10 STAMP=1061026579

datafile 3 switched to datafile copy

input datafile copy RECID=1 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=2 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=3 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=4 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf

datafile 10 switched to datafile copy

input datafile copy RECID=5 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf

datafile 11 switched to datafile copy

input datafile copy RECID=6 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf

datafile 12 switched to datafile copy

input datafile copy RECID=7 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf

datafile 13 switched to datafile copy

input datafile copy RECID=8 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf

datafile 14 switched to datafile copy

input datafile copy RECID=9 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf

datafile 15 switched to datafile copy

input datafile copy RECID=10 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf

contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script


database opened


contents of Memory Script:

{

   sql clone "alter pluggable database all open";

}

executing Memory Script


sql statement: alter pluggable database all open

Cannot remove created server parameter file

Finished Duplicate Db at 05-JAN-21

RMAN> 


Lets verify it 


[oracle@orcldb02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 5 09:47:40 2021

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select name ,open_mode from v$database ;

NAME   OPEN_MODE

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

TRORCL   READ WRITE


SQL> show pdbs


    CON_ID CON_NAME   OPEN MODE  RESTRICTED

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

2 PDB$SEED   READ ONLY  NO

3 ORCL   READ WRITE NO

SQL>